Exemplo n.º 1
0
 @Override
 public boolean CreateFromJson(JSONObject result) {
   try {
     this.status = result.getInt("STATUS");
     this.info = result.getString("INFO");
     if (this.status == 1) {
       jsonArray = result.getJSONArray("DATA");
       int length = jsonArray.length();
       items = new RescueListItem[length];
       for (int i = 0; i < length; i++) {
         JSONObject obj = jsonArray.getJSONObject(i);
         CommonConvert convert = new CommonConvert(obj);
         RescueListItem temp = new RescueListItem();
         temp.name = convert.getString("NAME");
         temp.id = convert.getString("ID");
         temp.phone = convert.getString("PHONE");
         items[i] = temp;
       }
     }
   } catch (Exception e) {
     this.status = -1;
     this.info = e.toString();
     Log.d("gwjtag", info);
     return false;
   }
   return true;
 }
Exemplo n.º 2
0
 @Override
 public boolean CreateFromJson(JSONObject result) {
   try {
     this.status = result.getInt("STATUS");
     this.info = result.getString("INFO");
     if (this.status == 1) {
       jsonArray = result.getJSONArray("DATA");
       int length = jsonArray.length();
       items = new BookListItem[length];
       for (int i = 0; i < length; i++) {
         JSONObject obj = jsonArray.getJSONObject(i);
         CommonConvert convert = new CommonConvert(obj);
         BookListItem temp = new BookListItem();
         temp.title = "《" + convert.getString("F1_4416") + "》";
         temp.id = convert.getString("AID");
         temp.image = UrlFactory.rootUrl_short + convert.getString("F2_4416");
         temp.author = "作者:" + convert.getString("F4_4416");
         temp.synopsis = convert.getString("F6_4416");
         items[i] = temp;
       }
     }
   } catch (Exception ex) {
     this.status = -1;
     this.info = ex.toString();
     Log.d("gwjtag", info);
     return false;
   }
   return true;
 }