Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 使用JSON解析检测天气_Android_Json_Api - Fatal编程技术网

Android 使用JSON解析检测天气

Android 使用JSON解析检测天气,android,json,api,Android,Json,Api,如何从下面解析代码、消息、计算时间、城市、id、国家、名称 使用此URL: 请遵循以下代码: JSONObject jObj=new JSONObject(jsonResponse); String msg=jObj.getString("message"); String calctime=jObj.getString("calctime"); 请遵循以下代码: JSONObject jObj=new JSONObject(jsonResponse); String msg=jObj.get

如何从下面解析代码、消息、计算时间、城市、id、国家、名称 使用此URL:


请遵循以下代码:

JSONObject jObj=new JSONObject(jsonResponse);
String msg=jObj.getString("message");
String calctime=jObj.getString("calctime");

请遵循以下代码:

JSONObject jObj=new JSONObject(jsonResponse);
String msg=jObj.getString("message");
String calctime=jObj.getString("calctime");

使用下面的代码解析代码,消息,计算时间,城市,id,国家,从上面的url名称,它将解决您的问题

JSONObject mJsonObj = new JSONObject(mJsonResponse);
String mCode = mJsonObj.getString("cod");
String mMessage = mJsonObj.getString("message");
String mCalcTime = mJsonObj.getString("calctime");

JSONObject mJsonCityObj = mJsonObj.getJSONObject("city");
String mId = mJsonCityObj.getString("id");
String mConuntry = mJsonCityObj.getString("country");
String mName = mJsonCityObj.getString("name");

使用下面的代码解析代码,消息,计算时间,城市,id,国家,从上面的url名称,它将解决您的问题

JSONObject mJsonObj = new JSONObject(mJsonResponse);
String mCode = mJsonObj.getString("cod");
String mMessage = mJsonObj.getString("message");
String mCalcTime = mJsonObj.getString("calctime");

JSONObject mJsonCityObj = mJsonObj.getJSONObject("city");
String mId = mJsonCityObj.getString("id");
String mConuntry = mJsonCityObj.getString("country");
String mName = mJsonCityObj.getString("name");

请看我的答案,它会解决你的问题。请看我的答案,它会解决你的问题。