启动新意图并返回列表活动后列表视图消失
我有一个 TabHost。 其中一个选项卡包含 ListActivity。 加载后 - 用户可以搜索并且项目将填充在列表中。
当用户单击 ListViewItem 时,将创建新 TabHost 的新 Intent。 当用户按下“后退”按钮时,他会返回到 ListActivity 上的 TabHost(从新的 Inetnt 启动的位置)。
问题是现在列表视图为空......我
该如何维护它? (我有 2 个不同的列表视图,它发生在 - 1 在本地数据库上搜索并具有 CursorAdapter (因此也必须维护光标)。第二个是来自 Web 的查询。所以我只有一些在其上显示的对象屏幕+图像。
I am having a TabHost.
One of the tabsconains ListActivity.
When it is loaded - user can search and items are populated in the list.
When user clicks on a ListViewItem a new Intent of a new TabHost is being created.
When user presses the BACK button, he gets back to the TabHost on the ListActivity (from where the new Inetnt was started)
The problem is that now the listview is empty.................
How can I maintain it?
(I have 2 different listviews that it happens from - 1 is searcing on the local DB and haveing CursorAdapter (so have to maintain the cursor as well). The 2nd is query from the Web. so I just have some object that I display on the screen + IMAGES.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对此不确定,但这可能是因为您正在动态生成列表视图的内容。尝试覆盖 onSaveInstanceState ,然后将列表的值保存在那里。然后覆盖 onRestoreInstanceState 并在那里重新加载列表视图。
I'm not sure about this but this is probably because you are generating the contents of your list view dynamically. Try to overwrite onSaveInstanceState and then save the value of your list there. Then overwrite onRestoreInstanceState and reload your listview there.
可能是在启动意图后您正在调用 finish() 方法。如果是这样,请将其删除。
May be after starting the intent you are calling finish() method. If that is so remove it.