目的是要选择一个手机安装了的app,本来有一个点击监听事件,然后有listView点击选择这个app,但是我现在想要通过adb命令传入一个包名来持续选择,而不是需要一次次的点击,请问该用哪种方法实现。
下面是点击事件监听的代码:
mExpandableList.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
TextView txtPackage = (TextView) v.findViewById(R.id.txtListPkg);
TextView txtAppName = (TextView) v.findViewById(R.id.txtListItem);
loadSelectedApp(txtPackage.getText().toString()); //加载选定的app的信息
TextView txtAppSelected = (TextView) view.findViewById(R.id.txtAppSelected);
txtAppSelected.setText(">>> " + txtPackage.getText().toString());
Toast.makeText(context, "" + txtAppName.getText().toString(), Toast.LENGTH_SHORT).show();
loadListView(view);
return true;
}
});