Android – how do I check the listview’s checkbox when I click an item?
How do I check the of listview when I click an item Check@R_ 283_ 2419@?
I have a belt Check@R_ 283_ 2419 @, textview, listview of button
Here, I want to select a multiline listview to use Check@R_ 283_ 2419@. If I click on a row, I want to check its corresponding Check@R_ 283_ 2419 @ and get the ROWID of the clicked item of the listview
If I click the button, I want to open a pop-up window or another screen (active), but I can't check it Check@R_ 283_ 2419@.
What should I do? Please help.
Thank you in advance
Edit:
This is my layout
The code of using adapter to listview is very simple
public class Adapter extends BaseAdapter{
private Context context;
Button btnView;
Check@R_283_2419@ @R_283_2419@;
ArrayList<String> altextView1;
ArrayList<String> altextView2;
public Adapter(Context c, Button view, Check@R_283_2419@ check@R_283_2419@, ArrayList<String> textView1, ArrayList<String> textView2) {
this.context=c;
this.btnView=view;
this.@R_283_2419@=check@R_283_2419@;
this.altextView1=textView1;
this.altextView2=textView2;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return altextView1.size();
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return 0;
}
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
// TODO Auto-generated method stub
View view=arg1;
view=LayoutInflater.from(context).inflate(R.layout.list7, null);
TextView tv1=(TextView)view.findViewById(R.id.tV1);
TextView tv2=(TextView)view.findViewById(R.id.tV2);
btnView=(Button)findViewById(R.id.btnView);
@R_283_2419@=(Check@R_283_2419@)findViewById(R.id.cB);
tv1.setText(altextView1.get(arg0));
tv2.setText(altextView2.get(arg0));
return view;
}
}
resolvent:
>Will check@R_ 283_ 2419 @ the object is set as the tag of the row view, which may be 'convertview' in the getview() method of the adapter. > write the click listener on the row view. > inside the click listener, view the gettag from the view of the onclick method, cast it into a check box, and then set setchecked to true
The code may look like this,
convertView.setTag(yourCheck@R_283_2419@Object);
convertView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Check@R_283_2419@ cb = (Check@R_283_2419@) v.getTag();
cb.setChecked(true);
}
});
Getting an issue while checking the dynamically generated checkbox through list view