Esempio n. 1
0
 public XmlDataService() {
   try {
     int i;
     IDataNode node =
         XmlHelper.parse(
             XmlHelper.createParser(App.get().getAssets().open("PreloadData.xml"), "UTF-8"));
     IDataView<IDataNode> cs = new DataNodeView(node, "Categories/Category");
     for (i = 0; i < cs.getItemCount(); i++) {
       Category c = new Category();
       c.copyPropertiesFrom(cs.getItem(i));
       categories.addItem(c);
     }
     IDataView<IDataNode> ps = new DataNodeView(node, "Products/Product");
     for (i = 0; i < ps.getItemCount(); i++) {
       Product p = new Product();
       p.copyPropertiesFrom(ps.getItem(i));
       products.addItem(p);
     }
   } catch (IOException e) {
     Logger.error(e.getMessage());
   }
 }
 @Override
 public void onCreate() {
   super.onCreate();
   Logger.debug("SampleApplication.onCreate");
 }