[英]How to retrieve data from a database efficiently?
I'm building an android app, and I need to retrieve a list of users from a database. 我正在构建一个android应用程序,我需要从数据库中检索用户列表。 I know how to write the query.
我知道如何编写查询。 I will have back a list of object.
我将返回一个对象列表。
I was wondering how to do this in an efficient way considering that I need that list in 3 activities. 考虑到我需要3项活动中的清单,我想知道如何以有效的方式进行此操作。 I think that repeating the same code for 3 times, in 3 different activities is not optimal.
我认为在3个不同的活动中重复3次相同的代码并不是最佳选择。
Thanks 谢谢
As per you comment you are fetching this user data from server, you can consider following: 根据您的评论,您正在从服务器获取此用户数据,可以考虑以下事项:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.