Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AsyncHttpClient client = new AsyncHttpClient();
- client.get(ENDPOINT_URL + Uri.encode(city + "," + country),
- new JsonHttpResponseHandler() {
- public void onSuccess(JSONObject result) {
- try {
- int code = result.getJSONObject("cond").getInt(
- "code");
- int temp = result.getJSONObject("cond").getInt(
- "temp");
- Log.i("hae", "Weather Code :: " + code);
- Log.i("hae", "Weather Temp :: " + temp);
- // BLA BLA BLA
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
- public void onFailure(Throwable e, String content) {
- e.printStackTrace();
- Toast.makeText(getApplicationContext(),
- "Failed to get weather data",
- Toast.LENGTH_SHORT).show();
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment