1

我有一个 Activity,它有 3 个标签,它们是片段。

  1. 精选
  2. 即将到来
  3. 收藏夹

现在,当我单击特定选项卡时,我的工具会从 Internet 下载内容并显示它。

当我浏览 Google Play 应用程序时。我发现当我进入应用程序部分时,选项卡上的所有内容Featured - Top Free - Top Paid etc都已经存在,只有图像是延迟加载的。

我正在尝试弄清楚如何实现这一点。

4

2 回答 2

2

在我的应用程序中,我有一个 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;
    }

}
于 2013-05-19T16:13:30.817 回答
1

这是ViewPager的一个功能

于 2013-05-20T02:13:04.813 回答