title: Android get parsed data back to activity
body: <p>I'm trying to parse a plist file, and as I see in log cat I'm doing that good, but when I try to return the arraylist that contains the objects I have parsed it gives me null(by this I mean that my object has an arraylist as parameter, and those arraylists are null). Can someone tell me where I'm going wrong?</p>
  
  <p>Here is my parser:</p>
  
  <pre><code>public class XmlMapParser {
  
      private final static String CAT = "Category";
      private final static String TITLE_AR = "TitleAr";
      private final static String TITLE_FR = "TitleFr";
      private final static String TITLE_EN = "TitleEn";
  
      private final static String DESC_FR = "DescriptionFr";
      private final static String DESC_AR = "DescriptionAr";
      private final static String DESC_EN = "DescriptionEn";
      private final static String DESC_PH = "DescriptionPh";
  
      private XmlPullParser parser;
      private ArrayList&lt;String&gt; ar, en, ph, fr;
      private ArrayList&lt;MyObjectFinal&gt; parsedElements;
      private String category, titleAr, titleFr, titleEn;
  
      public XmlMapParser(Context context, int xmlid) {
          parser = context.getResources().getXml(xmlid);
          ar = new ArrayList&lt;String&gt;();
          fr = new ArrayList&lt;String&gt;();
          ph = new ArrayList&lt;String&gt;();
          en = new ArrayList&lt;String&gt;();
          parsedElements = new ArrayList&lt;MyObjectFinal&gt;();
      }
  
      public HashMap&lt;String, ArrayList&lt;String&gt;&gt; convert() {
          HashMap&lt;String, ArrayList&lt;String&gt;&gt; map = new HashMap&lt;String, ArrayList&lt;String&gt;&gt;();
  
          final String KEY = "key", STRING = "string";
  
          try {
              parser.next();
              int eventType = parser.getEventType();
              String lastTag = null;
              String lastKey = null;
  
              while (eventType != XmlPullParser.END_DOCUMENT) {
  
                  if (eventType == XmlPullParser.START_TAG) {
                      lastTag = parser.getName();
                  } else if (eventType == XmlPullParser.TEXT) {
                      // some text
  
                      if (KEY.equalsIgnoreCase(lastTag)) {
                          // start tracking a new key
                          lastKey = parser.getText();
                      } else if (STRING.equalsIgnoreCase(lastTag)) {
                          // a new string for the last encountered key
                          if (!map.containsKey(lastKey)) {
                              map.put(lastKey, new ArrayList&lt;String&gt;());
                          }
                          try {
                              if (lastKey.equals("Category")) {
                                  category = parser.getText();
                                  Log.v("--", "OBJECT DA " + ar.size());
                                  parsedElements.add(new MyObjectFinal(category,
                                          titleEn, titleFr, titleAr, ar, en, fr,
                                          ph));
                                  Log.v("--", "Adding cat:" + category + " tit:"
                                          + titleEn + " descEn" + en.size()
                                          + " desckAr:" + ar.size());
                                  ar.clear();
                                  en.clear();
                                  ph.clear();
                                  fr.clear();
                                  category = null;
                                  titleAr = null;
                                  titleFr = null;
                                  titleEn = null;
                              } else {
                                  if (lastKey.equals(DESC_AR)) {
                                      ar.add(parser.getText());
                                  }
                                  if (lastKey.equals(DESC_FR))
                                      fr.add(parser.getText());
                                  if (lastKey.equals(DESC_EN))
                                      en.add(parser.getText());
                                  if (lastKey.equals(DESC_PH))
                                      ph.add(parser.getText());
                                  if (lastKey.equals(CAT))
                                      category = parser.getText();
                                  if (lastKey.equals(TITLE_EN))
                                      titleEn = parser.getText();
                                  if (lastKey.equals(TITLE_FR))
                                      titleFr = parser.getText();
                                  if (lastKey.equals(TITLE_AR))
                                      titleAr = parser.getText();
                              }
                          } catch (Exception e) {
                              e.printStackTrace();
                          }
                          map.get(lastKey).add(parser.getText());
                      }
                  }
  
                  eventType = parser.next();
              }
          } catch (XmlPullParserException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          return map;
      }
  
      public int parsedElementsSize() {
          return parsedElements.size();
      }
  
      public ArrayList&lt;MyObjectFinal&gt; getParsedElements() {
          return parsedElements;
      }
  </code></pre>
  
  <p>And I'm getting size 0 by doing this <code>myXmlParser.getParsedElements().get(0).getDescriptionEn().size();</code> </p>