fermyth

Untitled

Jun 20th, 2011
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.40 KB | None | 0 0
  1. public String getNodeDetail(int nid){
  2.         int nilaiku=0;
  3.         String Alamat = "http://twitter.piecesofstory.com/";
  4.        XMLRPCClient client = new XMLRPCClient(Alamat+"xmlrpc.php");
  5.        ArrayList<nodeResult> hasilnya = new ArrayList<nodeResult>();
  6.         try {
  7.             Object sum = (Object) client.call("node.get", nid);
  8.             Log.i("Ferry-code", sum.toString());
  9.             // get All
  10.                 HashMap hm = (HashMap) sum;
  11.                
  12.             // get COmponent
  13.                 String title = hm.get("title").toString();
  14.                
  15.                 Object[] dummi = (Object[]) hm.get("field_link");
  16.                 HashMap dummi2 = (HashMap) dummi[0];
  17.                 String filelink = dummi2.get("value").toString();
  18.                
  19.                 dummi = (Object[]) hm.get("field_price");
  20.                 dummi2 = (HashMap) dummi[0];
  21.                 int price = Integer.parseInt(dummi2.get("value").toString());
  22.                
  23.                 //icon path
  24.                 dummi2 = (HashMap) hm.get("files");
  25.                 Set set = dummi2.entrySet();
  26.                 Iterator k = set.iterator();
  27.                 Map.Entry me = (Map.Entry) k.next();
  28.                 dummi2 = (HashMap) me.getValue();
  29.                 String filepath = Alamat+dummi2.get("filepath").toString();
  30.                 String body = hm.get("body").toString();               
  31.                 hasilnya.add(new nodeResult(title, nid, filepath, price,filelink,body));
  32.             //}        
  33.             Gson gson = new Gson();        
  34.             String hasil = gson.toJson(hasilnya);
  35.             Log.i("Ferry-code", hasil);
  36.             return hasil;
  37.         } catch (Exception e) {        
  38.             e.printStackTrace();
  39.             return "error";
  40.         }
  41.    }
Advertisement
Add Comment
Please, Sign In to add comment