How to use onNewIntent while displaying list view?

懵懂的女人 提交于 2019-12-13 05:48:40

问题


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).

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?


回答1:


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.



来源:https://stackoverflow.com/questions/8500636/how-to-use-onnewintent-while-displaying-list-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!