Android 正确使用 setId()?
我有一系列共享数据库的活动。在主要活动中,用户将执行程序自动将数据记录到数据库中的操作。这将一直持续到用户想要通过启动查看数据库活动来查看数据库为止。我的设置方式是 onPause 将关闭数据库,以便 DBViewer onStart() 将重新打开它。效率低下,但我想不出更好的方法。任何暂停时都不会被叫到的人。当 Activity B 开始 onStart() 时,Activity A 的所有线程仍在运行。 任何线索或帮助将不胜感激。
~伊顿
I have a series of activities that share a database. In the primary activity the user will be doing things will the program automatically logs data into the db. This continues until the user would like to view the database by starting the view database activity. How I have it set up is that onPause will close the database so the the DBViewer onStart() will reopen it. Inefficient but I can't think of a better way to do it. Any who, on pause is never being called. All the threads of the Activity A are still running as Activity B begins onStart().
Any clues or help would be appreciated.
~Aedon
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 SDK 中包含的示例 NotePad 应用程序或 <针对您需要的特定代码的 href="http://developer.android.com/resources/samples/NotePad/index.html" rel="nofollow">NotePad 教程。您还应该使用
Activity。 startManagingCursor(Cursor c)
因此您不必管理游标的生命周期。Take a look at the sample NotePad app included in the SDK or the NotePad tutorial for the specific code you need. You should also use
Activity.startManagingCursor(Cursor c)
so you don't have to manage the cursor's lifecycle.