I'm trying to use the TouchListView made available here: https://github.com/commonsguy/cwac-touchlist. It's an Android library to create reorderable lists.
I can run the demo fine, but I can't find a way to create a TouchList in Java, ie without defining it in an XLM layout.
Here's the code from the demo:
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
TouchListView tlv=(TouchListView)getListView();
adapter=new IconicAdapter();
setListAdapter(adapter);
tlv.setDropListener(onDrop);
tlv.setRemoveListener(onRemove);
}
It's inside a ListActivity. That works fine. Now here what I've tried to avoid the use of a ListActivity:
...
TouchListView tlv = new TouchListView(this, null);
adapter=new IconicAdapter();
setListAdapter(adapter);
...
No luck.
LayoutInflater inflater = (LayoutInflater)getSystemService(LAYOUT_INFLATER_SERVICE);
TouchListView tlv = (TouchListView) (inflater.inflate(R.layout.touchlistview, null));
Doesn't work either.
In both cases the list is displayed correctly but I can't move the items around.
Any idea?