Hi Tadas,
It is simple.
1. onLongClick you will get Item position, remove that position data from
ArrayList<Day> object.
2. Then Notified Listview adapter data has changed as "
listAdapter.notifyDataSetChanged(); ".
Hope it will resolve your issue. If not then let me know.
Regards
Imran Ali
On Friday, 18 May 2012 17:17:08 UTC+5:30, Tadas Martinkus wrote:
>
> Hello,
> In code I have listview which is saving in Arraylist<Day>. Everything with
> item adding work, but i want to delete it using long click listener. I use
> some tutorials but it doesn't work - when i run program it get froce close.
> i use this source code.
>
> listView_monday = (ListView)
> findViewById(R.id.myListview_monday);
>
> listView_monday.setAdapter(new
> ArrayAdapter<Day>(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;
> }
> });
> If i understand good i need to get postition of lsitview item, and romeve
> it, but how to do it?
> P.S Later i save all my list in file, but know i just want to delete it
> from listview after long press.
>
>
> <https://lh5.googleusercontent.com/-CLaBX-eFbkY/T7Y0r8bDZvI/AAAAAAAAABM/kf45jhiYBa0/s1600/Untitled.jpg>
>
> This is picture of my project, i think it will be easier to understand for
> you.
>
> If you need more info or source code, write here :) I hope 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en