如何使用onNewIntent同时显示列表视图? [英] How to use onNewIntent while displaying list view?
问题描述
我如何使用 onNewIntent
A 的ListView
活动里面呢?其实我显示的ListView
,同时显示我从服务器端的事件或状态,然后我需要里面的一些改变当前显示的的ListView
(例如这里的的ListView
是一个联系人列表,并根据事件我想改变特定项目的文本颜色为联机/脱机状态) 。
How do I use onNewIntent
inside a ListView
activity? Actually I am displaying a ListView
, while displaying I got an event or status from the server side and then I need to make some changes inside the currently displaying ListView
(e.g here the ListView
is a contact list and based on event I want to change the text color of particular items as online/offline status).
所以,我的观点是,有没有什么办法让的ListView
活动的内部状态,或 ArrayAdapter
使我可以做任何需要我的previous意图的变化已经运行我不想做出任何更改,并 onNewIntent
让我做相同的我在找?
So my point is, is there any way to get the status inside the ListView
activity or ArrayAdapter
so that I can make the changes whatever is required as my previous intent is already running I dont want to make any changes in that, does onNewIntent
allow me to do the same that I'm looking for?
推荐答案
标记为您的活动机器人:launchMode =singleTop
在的AndroidManifest.xml ,然后覆盖 onNewIntent()
来捕捉新的意图。随后,执行您的改变列表的数据,最后调用 yourAdapter.notifyDataSetChanged()
应用更改。
Mark your activity as android:launchMode="singleTop"
in AndroidManifest.xml and then override onNewIntent()
to capture new intents. Afterwards, perform your changes in list's data and finally call yourAdapter.notifyDataSetChanged()
to apply changes.
这篇关于如何使用onNewIntent同时显示列表视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!