fermyth

getContentList

Jun 19th, 2011
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. public String getContent(int nid){
  2.         int nilaiku=0;
  3.         String Alamat = "http://twitter.piecesofstory.com/";
  4.            XMLRPCClient client = new XMLRPCClient(Alamat+"xmlrpc.php");
  5.            ArrayList<jsonResult> hasilnya = new ArrayList<jsonResult>();
  6.         try {
  7.             Object[] sum = (Object[]) client.call("node.getContent", nid);
  8.             for (int i=0;i<sum.length;i++){
  9.                 HashMap hm = (HashMap) sum[i];
  10.                 hasilnya.add(new jsonResult(hm.get("title").toString(), Integer.parseInt(hm.get("nid").toString()),Alamat+hm.get("filepath").toString()));
  11.             }          
  12.             Gson gson = new Gson();        
  13.             String hasil = gson.toJson(hasilnya);
  14.             Log.i("Ferry-code", hasil);
  15.             return hasil;
  16.         } catch (Exception e) {        
  17.             e.printStackTrace();
  18.             Gson gson = new Gson();
  19.             hasilnya.add(new jsonResult(e.toString(), nilaiku,e.toString()));
  20.             String hasil = gson.toJson(hasilnya);
  21.             Log.i("Ferry-code", hasil);
  22.             return hasil;
  23.         }  
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment