2013-05-19 24 views
1

我有一個活動,其中有3個標籤是碎片。安卓標籤內容更好的用戶體驗

  1. 精選
  2. 最多即將
  3. 收藏

現在我實現當我點擊它從Internet下載內容,並顯示一個特定的標籤。

當我瀏覽Google Play應用程序時。我發現,當我進入應用程序部分所有標籤Featured - Top Free - Top Paid etc的內容已經在那裏,只有圖像是延遲加載。

我想弄明白這是如何實現的。

回答

2

在我的應用程序,我有一個活動至極有4個標籤至極的片段..

我用辛格爾頓解決您的問題解釋。我從SQLite數據庫加載的所有相關信息,並將其傳遞到一個ArrayList中Singletion .. 這樣我就可以從每一個片段訪問內容...

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; 
    } 

}