Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在 Android 中开发一个 SMS 应用程序。我没有实现自己的广播接收器,而是使用设备中的默认值。现在的问题是我必须调用onResume()方法来通过切换活动来显示消息列表视图中的变化。有没有办法以编程方式刷新它而无需重新打开我的应用程序 r 切换到其他活动(以便调用onResume())以显示收到的消息。只是我希望我的适配器能够通过在 listView 中添加另一行来刷新并能够显示收到的消息。
onResume()
调用它会刷新 Listview
adapter.notifyDataSetChanged();
希望有帮助!
您必须使用线程,您的线程将自动查找任何新消息。收到任何消息后,您可以刷新您的ListView
ListView
问候海克·纳哈佩蒂安