コード例 #1
0
 private List<ApplicationInfo> extractApplications(String rawXML) {
   List<ApplicationInfo> infos = new ArrayList<ApplicationInfo>();
   NSArray apps = null;
   try {
     apps = (NSArray) XMLPropertyListParser.parse(rawXML.getBytes("UTF-8"));
   } catch (Exception e) {
     log.warning("Error parsing the xml returned : " + e.getMessage() + " , xml=\n" + rawXML);
     return infos;
   }
   for (int i = 0; i < apps.count(); i++) {
     NSObject app = apps.objectAtIndex(i);
     ApplicationInfo info = new ApplicationInfo(app);
     infos.add(info);
   }
   return infos;
 }
コード例 #2
0
ファイル: Info.java プロジェクト: rubensworks/hydra
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setTitle(R.string.title_info);

    EasyTracker.getInstance().setContext(this);

    NSArrayWrapper wrapper = (NSArrayWrapper) getIntent().getParcelableExtra("content");
    NSArray content;
    if (wrapper != null) {
      content = wrapper.array;
    } else {
      try {
        content =
            (NSArray)
                XMLPropertyListParser.parse(getResources().openRawResource(R.raw.info_content));

      } catch (Exception ex) {
        Log.e("[Hydra.Info]", "Failed to parse the info content!");
        ex.printStackTrace();
        this.finish();
        return;
      }
    }

    if (getIntent() != null) {
      if (getIntent().getStringExtra("tracking") == null) {
        getIntent().putExtra("tracking", "Info");
      } else {
        EasyTracker.getTracker().sendView(getIntent().getStringExtra("tracking"));
        Log.i("Tracking", getIntent().getStringExtra("tracking"));
      }
    }

    setListAdapter(new InfoList(this, content));
  }