json - Android ListView not showing on real device but on emulator does -
i'm having weird problem regarding simple listview
. on emulator allright , data loaded correctly json api, data loads on device. problem on emulator, listview
populated on real device, not, if there data json, why ?
private void additemstolistview(jsonobject message) { try { jsonarray jsonarray = message.getjsonarray("android"); (int = 0; < jsonarray.length(); i++) { jsonobject c = jsonarray.getjsonobject(i); string imagepath = c.getstring("path"); try { myimages.add(new imagesmodel(i, imagepath, r.drawable.mtr)); } catch(exception e) { e.printstacktrace(); } } } catch (jsonexception e) { e.printstacktrace(); } }
got problem, i've changed layout relativelayout linearlayout , working fine.
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/view_background" android:orientation="vertical" android:padding="10dp" android:weightsum="1"> <progressbar android:id="@+id/progressbar1" style="@style/base.widget.appcompat.progressbar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:progress="@integer/abc_config_activityshortdur" android:layout_centerinparent="true" android:maxheight="100dp" android:maxwidth="100dp" android:minheight="200dp" android:minwidth="200dp" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancelarge" android:text="@string/btnuploadedactivity" android:id="@+id/imageslistviewtitle" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true" /> <listview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageslistview" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_alignleft="@+id/imageslistviewtitle" android:layout_below="@+id/imageslistviewtitle" android:smoothscrollbar="true" /> </linearlayout>
Comments
Post a Comment