i'm tyring to get parse json in int to textview in xml but dont know how.
this is the json
{
"sys":
{
"sunrise":1381107633,
"sunset":1381149604
}
}
i'm tyring to call the textview and change it to int but still didn't work.
TextView asetBaik = (TextView) findViewById(R.id.asetangka);
and this is how i call the json
@Override
protected String doInBackground(String... params) {
String link_url = "https://example.com/api/sun";
JSONParser jParser = new JSONParser();
JSONObject json = jParser.AmbilJson(link_url);
try {
JSONObject data = json.getJSONObject("sys");
baik = Integer.parseInt(asetBaik.getText().toString());
baik = data.getInt("sunrise");
asetBaik.setText(baik);
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(String s) {
pDialog.dismiss();
}
}
please help me how i can take the int value json and take it in Sting TextView