Skip to content Skip to sidebar Skip to footer

Set Onclicklistener In List View With Image And Text Using Simple Adapter?

I make List view with image and text using simple adapter in android. But i tired make OnClickListener to switch other activity using intent. Example, i click India, activity switc

Solution 1:

listView.setOnItemClickListener(new OnItemClickListener() {

  public void onItemClick(AdapterView adapterView, View view, int position, long id) {
    SimpleAdapter adapter = (SimpleAdapter) adapterView.getAdapter();
    ListView currentLv = (ListView) view;

    Object item = adapter.getItem(position);
    //Do some more stuff here and launch new activity


  }
});

Post a Comment for "Set Onclicklistener In List View With Image And Text Using Simple Adapter?"