如何管理Android活动 [英] how to manage activities in android
问题描述
喜的朋友我在改变使用标签一项活动确定的问题,在标签的活动我加入的数据在其他选项卡活动的SQLite我使用的ListView(阵列适配器)显示它们
但是当我回来的添加数据和增加新的项目的SQLite新添加的记录后列表视图不更新
hi friends i identified problem in changing one activity using tab, in on tab activity i am adding data to sqlite in other tab activity i am displaying them using listview(array adapter) but when i come back to add data and after adding new item to sqlite the newly added records are not updated in listview
PLZ向前üř有价值的建议,以解决我的问题。
plz forward u r valuable suggestions to solve my problem
推荐答案
您似乎是从DB拉列表中的数据。是否有一个原因,您使用的是ArrayAdapter而不是CursorAdapter的呢?
You seem to be pulling the list data from a DB. Is there a reason why you are using an ArrayAdapter instead of a CursorAdapter?
无论如何,你应该叫<一个href=\"http://developer.android.com/reference/android/widget/BaseAdapter.html#notifyDataSetChanged%28%29\"相对=nofollow> notifyDataSetChanged()在您的列表适配器当数据发生了变化,因此它可以刷新视图。
Anyway, you should call notifyDataSetChanged() on your list adapter when the data has changed so it can refresh the view.
这篇关于如何管理Android活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!