以前用JSonObject解析的时候需要导入一大堆的@H_301_2@jar@H_301_2@包,所以很不方便。其实@H_301_2@android@H_301_2@自带@H_301_2@JSonObject@H_301_2@解析。特意把使用方法记录下来@H_301_2@
/**@H_301_2@
@H_301_2@*上传结果@H_301_2@*/@H_301_2@privatevoid@H_301_2@upLoadResult@H_301_2@(Messagemsg){@H_301_2@@H_301_2@//{"errorDesc":"","code":"000"}@H_301_2@Stringresult=(String)msg.@H_301_2@obj@H_301_2@;@H_301_2@JSONTokenertoker=@H_301_2@new@H_301_2@JSONTokener(result)@H_301_2@try@H_301_2@{@H_301_2@JSONObjectjsonObject=(JSONObject)toker.nextValue()@H_301_2@Stringcode=jsonObject.getString(@H_301_2@"code"@H_301_2@)@H_301_2@StringerrorDesc=jsonObject.getString(@H_301_2@"errorDesc"@H_301_2@if@H_301_2@(@H_301_2@"000"@H_301_2@.equals(code)){@H_301_2@UpLoad.@H_301_2@this@H_301_2@.finish()@H_301_2@}@H_301_2@else@H_301_2@Toast.@H_301_2@makeText@H_301_2@(UpLoad.@H_301_2@this,@H_301_2@"上传失败"@H_301_2@+errorDesc@H_301_2@,255)">LENGTH_SHORT@H_301_2@).show()@H_301_2@catch@H_301_2@(JSONExceptione){@H_301_2@e.printStackTrace()@H_301_2@}@H_301_2@
@H_301_2@
导入的包@H_301_2@
import@H_301_2@org.json.JSONException@H_301_2@org.json.JSONObject@H_301_2@org.json.JSONTokener@H_301_2@;@H_301_2@