Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Abhijeet Naik
Courses Plus Student 33 PointsDrag And Drop Android
I am trying to implement Neil Harmaan Library in Android But the new position is not updating
lstMain.enableDragAndDrop(); lstMain.setDraggableManager(new TouchViewDraggableManager(R.id.textView_callName)); lstMain.setOnItemMovedListener(this); lstMain.setOnItemLongClickListener( new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(final AdapterView<?> parent, final View view, final int position, final long id) {
lstMain.startDragging(position);
return true;
}
}
);
@Override public void onItemMoved(int originalPosition, int newPosition) {
Log.i("MOVEITEM", "MOVE ITEM CALLED");
Toast.makeText(getApplicationContext(), adapter.getItem(newPosition) + " moved to position " + newPosition, Toast.LENGTH_SHORT).show();
dbString arrayList = adapter.getItem(originalPosition);
adapter.swapItems(originalPosition, newPosition);
adapter.moveItem(arrayList, newPosition);
}