0

I'm using a TouchListView by CommonWare and so far it's working fine, But it fails in the following case:

  • activity A has a TouchListView and button to add an item , now when i click over a button,
  • activity B opens up and once the user choose the item i am calling finish to end activity B
  • and it comes back to activity A.

Now here drag n drop in TouchListView doesn't work I mean items are getting dragged but not able to be placed where a user wants, I tried a lot but could not find a way to fix it.

4

1 回答 1

0

I suspect you're doing some setup in onCreate() that's not getting called when you return to Activity A because you're entering it the 2nd (and subsequent) time(s) via onResume().

http://developer.android.com/reference/android/app/Activity.html

enter image description here

BaseAdapter adapter;
List<myStuff> stuffs;

if (adapter == null) {
    adapter = new BaseAdapter()
    if (stuffs == null) {
        stuffs = new List<myStuff>();
    }
}

You're going to need to do something like that and add List to your savedInstanceState bundle in onSaveInstanceState() then dig it out when the activity restarts.

于 2013-03-30T14:35:20.050 回答