I have a requirement that, in my list view I am having an image icon, a text view and a button.
when I click on any one of these it should move me to next screen. I tried implementing these methods, but no success.
Can anybody help me?
Note:My class does not extends ListActivity rather only Activity.
Here is my code....
ListView listView = (ListView)findViewById(R.id.listView1);
listView.set开发者_C百科OnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
Intent in2 = new Intent(City.this, TourDescription.class);
startActivity(in2);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});
You need to set OnItemClickListener, not OnItemSelectedListener
精彩评论