How To Get The Content Of Listview With A Button Outside The List
Whatever I searched so far is about getting the list view data by placing the button in each row, But what I want to achieve is to pick the listview content by placing the button o
Solution 1:
Try the below code snippet on the button click
for (inti=0; i < listView.getAdapter().getCount(); i++) {
Productspold= (Products) listView.getAdapter().getItem(i);
Productspnew= prodlist.get(i);
if(pold.getCaption() !=null)
{
if(pold.getCaption() != pnew.getCaption().toString())
{
//Call sqlite save here
Log.d("yes", "yes");
}
else {
Log.d("no", "no");
}
}
Hope this helps
Solution 2:
For listview ...as it has edit text..set on text change listener on edit text...and keep a hasmap to store the pos of these records...along with value entered , so as and when user starts typing...put check if editext is empty or unchanged ...then don't add it to list.
As when user press save ...get name and address value...also u get values from hashmap. I hope clear enough to explain you.
Post a Comment for "How To Get The Content Of Listview With A Button Outside The List"