---
title: "处女apk纠结过的技术点<2>"
author: "ping8080"
date: "2011-02-28T11:50:23Z"
tags: []
categories: ["移动开发"]
slug: "apk-2"
draft: false
lastmod: "2011-02-28T11:50:23Z"
id: 933286
url: "https://ping8080.iteye.com/blog/933286"
---

android  json 解析

android自带json解析类，和java的使用有那么点区别，主要在实例化的时候 看代码

public static JSONArray jsonAnalyze(String result) {    
  JSONObject jsonObj;  
  try {  
   jsonObj = new JSONObject(result);//直接实例化  
   String suc = jsonObj.getString("success");  
   Log.i("success", suc);

   int count = jsonObj.getInt("totalCount");  
   Log.i("totalCount", String.valueOf(count));  
   JSONArray jobjData = jsonObj.getJSONArray("rows");    //解析获取数组  
   return jobjData;  
  } catch (JSONException e1) {  
   e1.printStackTrace();  
   return null;  
  }  
 }