ListViewの位置2にあるボタンをクリックするなどのシナリオを自動化したい。PFBコードは、ListViewのインデックス1にあるボタンを自動的にクリックします
TextView a = (TextView)solo.getView(R.id.dialog);
solo.clickOnView(a);
Why don't you use performClick() method on the ListViews item like that:
((Button)((View) listView.get(1)).findViewById(R.id.mybutton)).performClick();
if you want just make itemClick, you should use onItemCkick() of the ListView
そのボタンには特定の ID があります。setTag()
そのボタンのタグを設定してから、on click event:: like を設定します
getView((int position, View convertView, ViewGroup parent) {
View view = convertView;
if (view == null) {
LayoutInflater inflater = context.getLayoutInflater();
// use inflater and do all those normal things..
}
view.setTag(position);
myButton.setTag(view.getTag());
myButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Toast.makeText(getContext()," Slot Button clicked " + v.getTag(),Toast.LENGTH_SHORT).show();
}
});