Find out an item is clicked in listView in android -


i have approx 150 items in custom listview. trying implement following:

list.setonitemclicklistener(new onitemclicklistener() {

1. position of item

2. data arraylist

3. add data database.

this part working fine.

but if want remove particular item database clicking on item not able achieve part?

reason because not sure if item clicked or not? have problem when want implement search in listview , add selected item database , remove selected item database.

    // click event single list row     list.setonitemclicklistener(new onitemclicklistener()     {         @override         public void onitemclick(adapterview<?> parent, view view,                 int position, long id)          {              if (notfromsearch == true)             {                 string profile_id = profilelist.get(position).get(key_id);                 string profile_display_name = profilelist.get(position).get(key_display_name);               //add database              }             elseif (notfromsearch == false)             {                 string searchresult_profile_id = searchprofileresults.get(position).get(key_id);                 string searchrresult_profile_display_name = searchprofileresults.get(position).get(key_display_name);                 //add database             }         }     });  

but how implement remove database? not able differentiate if item clicked before or not remove database.

can me out this?

thanks!

on list view, use

setonitemclicklistener

and can want next .


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -