I am really stuck here. What I want is not simple (for me), however I’ve been programming android a year now.
What I want is a listview with an imageview, a textview, a checkbox, and another textview in each row.
Let’s have a textview and a checkbox first in the layout.
Based on this tutorial I managed to do that (there are a lot, but this seems to be the best for me). I have a listview populated with textviews and checkboxes.
This is the result:

This is how I get the text of textview I click on:
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView tv = (TextView) v ;
String text_of_clicked_textview = tv.getText().toString();
Log.i("TAG", "" + text_of_clicked_textview);
}
});
So When I click on Mercury, I get Mercury in the text_of_clicked_textview variable.
But how can i check which checkbox I clicked on? E.g I click on the 3rd checkbox, I want to now it is in the row of Earth. Best would be if I get to know both the text of textview in the row of the listview(Earth) and and number of the item (3).
I guess I have to set an onClickListener on the checkbox but what next?
checkBox.setOnClickListener( new View.OnClickListener() {
public void onClick(View v) {
CheckBox cb = (CheckBox) v ;
}
});
This is XML for Custom Row in ListView :
This is Complete Activity in which List is implemented :
Just Copy this Activity for test then understand code. Place one listview in main Activity