この API からの読み取りに問題があります
http://api.xhanch.com/islamic-get-prayer-time.php?lng=67&lat=24&yy=2012&mm=7&gmt=5&m=json
これが私のコードです:
new Read().execute("sunrise");
public JSONObject retrieveInfo(String user) throws ClientProtocolException,IOException, JSONException {
StringBuilder url = new StringBuilder(URL);
url.append(user);
HttpGet get = new HttpGet(url.toString());
HttpResponse r = client.execute(get);
HttpEntity e = r.getEntity();
String data = EntityUtils.toString(e);
JSONArray timeline = new JSONArray(data);
JSONObject last = timeline.getJSONObject(1);
return last;
}
public class Read extends AsyncTask<String, Integer, String> {
protected String doInBackground(String... arg0) {
// TODO Auto-generated method stub
try {
json = retrieveInfo("");
return json.getString(arg0[0]);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
このメソッドは、必要な情報ではなく、常に空の文字列を返します。