title: How to use the master detail flow theme with dynamic data?
body: <p>By creating a new android project and selecting the master detail flow theme, this will provide with a sample on how to use this theme, which is good. My issue is that this example uses a static data and I need it to be dynamic. my application uses async task to get the data from a service in JSON format then I pars it and save it in the phone DB.</p>
  
  <p>this is the DummyContent class:</p>
  
  <pre><code>public class DummyContent {
  
      /**
       * An array of sample (dummy) items.
       */
  public static List&lt;DummyItem&gt; ITEMS = new ArrayList&lt;DummyItem&gt;();
  
  /**
   * A map of sample (dummy) items, by ID.
   */
  public static Map&lt;String, DummyItem&gt; ITEM_MAP = new HashMap&lt;String, DummyItem&gt;();
  
  //  static {
  //      // Add 3 sample items.
  //      addItem(new DummyItem("1", "Item 1"));
  //      addItem(new DummyItem("2", "Item 2"));
  //      addItem(new DummyItem("3", "Item 3"));
  //  }
  
  public static void setContext(Context c) {
      if (db == null) db = new MyDbAdapter(c); // SQLiteOpenHelper + SQLiteDatabase manager
      if (db.isOpen() == false) {
          db.open();
          Cursor c = db.getProfiles(); // database query
          if (c.moveToFirst()) {
              do {
                  ProfileItem item = new ProfileItem(c.getString(0), c.getString(1),
                      c.getString(2));
                  addItem(item);
              } while (c.moveToNext());
          }
      }
  }
  
  private static void addItem(DummyItem item) {
      ITEMS.add(item);
      ITEM_MAP.put(item.id, item);
  }
  
  /**
   * A dummy item representing a piece of content.
   */
  public static class DummyItem {
      public String id;
      public String content;
  
      public DummyItem(String id, String content) {
          this.id = id;
          this.content = content;
      }
  
      @Override
      public String toString() {
          return content;
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>You can see that I commented the static data and added the "setContext" which should be called to add data from DB. My issue is that where and when should I call this function so that the data will show up? Should I call it in the "kind_name_ListFragment.java" "onCreate" or "kind_name_DetailFragment.java" "onCreate" or both (If both wont that be redundant) or somewhere else and is there a better solution?</p>