I\'m a new programmer in android. I want to create a Clickable Listview. I mean when users clicked on one item it goes to a new page and start a new activity. Please help me
ListView lv = getListView();
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
String selval = ((TextView) view).getText().toString();
Intent intnt = new Intent(getApplicationContext(), nextactivity.class);
intnt.putExtra("selval ", selval);
startActivity(i);
}
});
use Listview item click listener
getListView().setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
// your code is here on item click
}
});