我有一个 Activity,它有 3 个标签,它们是片段。
- 精选
- 即将到来
- 收藏夹
现在,当我单击特定选项卡时,我的工具会从 Internet 下载内容并显示它。
当我浏览 Google Play 应用程序时。我发现当我进入应用程序部分时,选项卡上的所有内容Featured - Top Free - Top Paid etc
都已经存在,只有图像是延迟加载的。
我正在尝试弄清楚如何实现这一点。
我有一个 Activity,它有 3 个标签,它们是片段。
现在,当我单击特定选项卡时,我的工具会从 Internet 下载内容并显示它。
当我浏览 Google Play 应用程序时。我发现当我进入应用程序部分时,选项卡上的所有内容Featured - Top Free - Top Paid etc
都已经存在,只有图像是延迟加载的。
我正在尝试弄清楚如何实现这一点。
在我的应用程序中,我有一个 Activity,它有 4 个标签,它们是片段。
我通过使用单例解决了您解释的问题。我从 sqlite 数据库加载所有相关信息并将其传递到 Singletion 中的 ArrayList 中。所以我可以访问每个片段中的内容...
public class Singleton {
private static Singleton instance = null;
public ArrayList<MyObject> myObjectList;
protected Singleton() {
// Exists only to defeat instantiation.
}
public static Singleton getInstance() {
if(instance == null) {
instance = new Singleton();
myObjectList = new ArrayList<MyObject>();
}
return instance;
}
}