[android-developers] How can i remove item in listview

2011-09-12 Thread Jhew SAN
 listViewInfo = (ListView)findViewById(R.id.listView1);
tempListAdapter = new SimpleAdapter(this, weatherlist, 
R.layout.list_row,
new String[] {city, low, high}, new int[] {R.id.CITY_CELL, 
R.id.LOW_CELL, R.id.HIGH_CELL});
listViewInfo.setAdapter(tempListAdapter);
tempUpdate(); 
listViewInfo.setOnItemClickListener(new OnItemClickListener() {

@Override
public void onItemClick(AdapterView? a, View v,
 final int position, long id) {
// TODO Auto-generated method stub
AlertDialog.Builder adb = new AlertDialog.Builder(
EditCity.this);
adb.setTitle(Delete?);
adb.setMessage(Are you sure you want to delete );
// final int positionToRemove = position;
adb.setNegativeButton(Cancel, null);
adb.setPositiveButton(Ok,
new AlertDialog.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
// TODO Auto-generated method stub
try
{ 
weatherlist.remove(map); 
listViewInfo.setAdapter(tempListAdapter); 
}catch(Exception e)
{
// 
}
}
});
adb.show();
}
});
}
}

This can remove only 1 row

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] How can i remove item in listview

2011-09-12 Thread TreKing
On Mon, Sep 12, 2011 at 2:11 AM, Jhew SAN tawisak.ruksu...@gmail.comwrote:

 This can remove only 1 row


You can't just pots a giant block of code and expect people to fix your
problem. Explain what you're trying to do. Explain what you have tried to
solve your problem. Explain what isn't working. Explain what your ultimate
goal is. Show as little code as possible to narrow down and focus your
issue.

http://catb.org/~esr/faqs/smart-questions.html

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en