Skip to content

Instantly share code, notes, and snippets.

@guilhermecarvalhocarneiro
Last active December 20, 2015 21:08
Show Gist options
  • Save guilhermecarvalhocarneiro/6195255 to your computer and use it in GitHub Desktop.
Save guilhermecarvalhocarneiro/6195255 to your computer and use it in GitHub Desktop.
@Override
protected String doInBackground(City... params) {
// TODO Auto-generated method stub
String nameCity, idCity;
nameCity = "Palmas";
idCity = null;
try {
JSONParser jsonParser = new JSONParser();
String url = "http://mobile.nuvolscloud.com.br/cidade/api/cidade/1/?format=json";
JSONObject json = jsonParser.getJSONFromUrl(url);
JSONObject jsonCityObject = json.getJSONObject("ativo");
// nameCity = jsonCityObject.getString("nome");
// Log.d("Turismo", jsonCityObject.toString());
} catch (Exception e) {
// TODO: handle exception
Log.e("ErroTurismo", e.toString());
return "";
}
return nameCity;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment