See the onItemLongClick() method in your code? arg2 is the position of the
item that was long-pressed.
See here:
http://developer.android.com/reference/android/widget/AdapterView.OnItemLongClickListener.html#onItemLongClick%28android.widget.AdapterView%3C?%3E,%20android.view.View,%20int,%20long%29
arg0 is an AdapterView, which you can get your adapter from... Since you
are using an ArrayAdapter you will be able to call remove() on it and give
it the position of the item to remove.
Pretty straightforward stuff if you read the docs...
Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware
On Fri, May 18, 2012 at 5:58 AM, Tadas Martinkus tadas...@gmail.com wrote:
Hello,
I need to delete item from list view. i serch in google for examples but
no one work. Here is a picuture of my project
https://lh6.googleusercontent.com/-z78McA3Jyxw/T7Y3ghXZkrI/ABY/xsJY7SuaOaY/s1600/Untitled.jpg
Everything with adding work. But i need to delete one of them after long
click. If i understand good i need to get index/id of added item and delete
it. Something like what -
listView_monday = (ListView)
findViewById(R.id.myListview_monday);
listView_monday.setAdapter(new
ArrayAdapterDay(this,R.layout.list_view_monday,
SilentClockActivity.listas_monday));
listView_monday.setOnItemLongClickListener(new
AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView? arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
return false;
}
});
Thats all, if You need more info or source code - write here, I think
someone helps for me! :) Thanks ;)
--
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
--
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