android Json show only lasy item
Posted
by
03uk
on Stack Overflow
See other posts from Stack Overflow
or by 03uk
Published on 2012-12-02T10:20:33Z
Indexed on
2012/12/02
11:04 UTC
Read the original article
Hit count: 182
android
|android-asynctask
i have one problem, my json parser show only last item! But at Logcat i see all item's! Can you help me?
@Override
protected void onPostExecute(JSONObject result) {
super.onPostExecute(result);
Log.d("Log", result.toString());
JSONObject jsn = result;
try {
JSONArray jarray = jsn.getJSONArray("item");
for (int i = 0; i < jarray.length(); i++){
JSONObject jsno = jarray.getJSONObject(i);
title.setText(Html.fromHtml("<a href=\""+jsno.getString("link")+"\">"+jsno.getString("title")+"</a>"));
cat.setText(jsno.getString("category"));
date.setText(jsno.getString("pubDate"));
desc.getSettings().setJavaScriptEnabled(true);
desc.getSettings().setDefaultTextEncodingName("charset=UTF-8"); desc.loadData(jsno.getString("description"), "text/html; charset=UTF-8", "utf-8");
}
} catch (JSONException e) {
e.printStackTrace();
}
© Stack Overflow or respective owner