I am using the nhaarman ListviewAnimation library https://github.com/nhaarman/ListViewAnimations , which works great.
But I am having the following problems:
The main problem I am facing is that I cannot debug my code. I directly copied / pasted the four required libraries into the libs folder. Placing a debug point inside any of the listview methods, such as onItemLongClick() , does not work.
The second problem is that drag-drop listView does not work in my code. Whenever I try to drag any list item, when I delete a list item, the item takes the same position from which it was dragged.
Here is the code I used:
listview.enableDragAndDrop(); listview.setDraggableManager(new TouchViewDraggableManager( R.id.list_row_draganddrop_textview)); listview.setOnItemMovedListener(this); listview.setOnItemLongClickListener(this); @Override public void onItemMoved(final int originalPosition, final int newPosition) { if (mToast != null) { mToast.cancel(); } mToast = Toast.makeText(getApplicationContext(), "Moved" + swingBottomInAnimationAdapter.getItem(newPosition) + newPosition, Toast.LENGTH_SHORT); mToast.show(); } @Override public boolean onItemLongClick(final AdapterView<?> parent, final View view, final int position, final long id) { if (listview != null) { listview.startDragging(position - listview.getHeaderViewsCount()); } return true; }
user4094364
source share