fermyth

getNodeDetail

Jun 19th, 2011
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.25 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.             // get All
  9.                 HashMap hm = (HashMap) sum[0];
  10.                
  11.             // get COmponent
  12.                 String title = hm.get("title");
  13.                 int nid = Integer.parseInt(hm.get("nid").toString());
  14.                 hashMap dummi = (HashMap) hm.get("field_link")[0];
  15.                 String filelink = Alamat+dummi.get("value");
  16.                 dummi = (HashMap) hm.get("field_price")[0];
  17.                 int price = Integer.parseInt(dummi.get("value").toString);
  18.                 //String fileLink;
  19.                 String body = hm.get("body");
  20.                
  21.                
  22.                
  23.                 hasilnya.add(new nodeResult(title, nid, filelink, price,filelink,body));
  24.             //}        
  25.             Gson gson = new Gson();        
  26.             String hasil = gson.toJson(hasilnya);
  27.             Log.i("Ferry-code", hasil);
  28.             return hasil;
  29.         } catch (Exception e) {        
  30.             e.printStackTrace();
  31.             //Gson gson = new Gson();
  32.             //hasilnya.add(new jsonResult(e.toString(), nilaiku,e.toString()));
  33.             //String hasil = gson.toJson(hasilnya);
  34.             //Log.i("Ferry-code", hasil);
  35.             return "error";
  36.         }
Advertisement
Add Comment
Please, Sign In to add comment