当父活动结束TouchListView不工作 [英] TouchListView is not working when parent activity finishes

查看:115
本文介绍了当父活动结束TouchListView不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了一个 TouchListView 通过CommonWare,到目前为止,它的正常工作,但它无法在以下情况:

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

  • 活动A 有TouchListView和按钮添加一个项目,现在当我点击了一个按钮,
  • b活动打开,一旦用户选择我打电话的项目完成终止 b活动
  • 和它回来活动A
  • 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.

现在这里拖动ñ下降的 TouchListView 不工作,我的意思是项目越来越拖累,但不能够被放置在用户想要,我想了很多,但能没有找到一个方法来解决这个问题。

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.

推荐答案

我怀疑你在做的onCreate一些设置()当您返回到活动一,这不是获取调用,因为你进入它的第二个(以及随后的)通过onResume时间(s)()。

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

BaseAdapter adapter;
List<myStuff> stuffs;

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

你会需要做这样的事情,并添加到列表中的onSaveInstanceState(你savedInstanceState包),那么挖掘出来活动时重新启动。

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.

这篇关于当父活动结束TouchListView不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆