Note that there are some explanatory texts on larger screens.

plurals
  1. POmy json show only single image and text
    primarykey
    data
    text
    <p>my json file show only single image not show all images and text below is my code ths is my screen shot </p> <p><a href="https://i.stack.imgur.com/5oF0m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5oF0m.png" alt="image"></a></p> <p>and i want to make like this</p> <p><a href="https://i.stack.imgur.com/Dpb4W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Dpb4W.png" alt="image"></a></p> <p>tell me whats wrong in my code? why its not show all three images and textview?????</p> <pre><code> { "worldpopulation": [{ "rank": 1, "name": "BREAKFAST", "url": "http://niel986.files.wordpress.com/2012/07/fast-food.jpg" }, { "rank": 2, "name2": "LUNCH ", "url2": "http://www.bubblews.com/assets/images/news/1107772406_1370520219.gif" }, { "rank": 3, "name3": "SUPPER", "url3": "http://2.bp.blogspot.com/_JU_j7jj5TjU/TSBQKRukf1I/AAAAAAAAAs8/X1w5_z6pjwQ / s1600 / chicken - biryani.jpg " } ] } </code></pre> <hr> <pre><code> ImageView img1 = (ImageView) findViewById(R.id.img1); TextView txt1 = (TextView) findViewById(R.id.txt1); ImageView img2 = (ImageView) findViewById(R.id.img2); TextView txt2 = (TextView) findViewById(R.id.txt2); ImageView img3 = (ImageView) findViewById(R.id.img3); TextView txt3 = (TextView) findViewById(R.id.txt3); cla3 = new CategoryListAdapter3(thirdstep.this); MenuSelect = Utils.MenuSelect; try { HttpClient client = new DefaultHttpClient(); HttpConnectionParams.setConnectionTimeout(client.getParams(), 15000); HttpConnectionParams.setSoTimeout(client.getParams(), 15000); HttpUriRequest request = new HttpGet(MenuSelect); HttpResponse response = client.execute(request); InputStream atomInputStream = response.getEntity().getContent(); BufferedReader in = new BufferedReader(new InputStreamReader(atomInputStream)); String line; String str = ""; while ((line = in.readLine()) != null){ str += line; } JSONObject json = new JSONObject(str); JSONArray data = json.getJSONArray("worldpopulation"); for ( int i = 0; i &lt; data.length(); i++ ) { JSONObject jsonOrder = (JSONObject)data.get(i); int rabk = jsonOrder.getInt("rank"); String name = jsonOrder.getString("name"); String url1 = jsonOrder.getString("url"); txt1.setText(name); Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL(url1).getContent()); img1.setImageBitmap(bitmap); int rabk2 = jsonOrder.getInt("rank2"); String name2 = jsonOrder.getString("name2"); String url2 = jsonOrder.getString("url2"); txt2.setText(name2); Bitmap bitmap2 = BitmapFactory.decodeStream((InputStream)new URL(url2).getContent()); img2.setImageBitmap(bitmap2); int rabk3 = jsonOrder.getInt("rank3"); String name3 = jsonOrder.getString("name3"); String url3 = jsonOrder.getString("url3"); txt3.setText(name3); Bitmap bitmap3 = BitmapFactory.decodeStream((InputStream)new URL(url3).getContent()); img3.setImageBitmap(bitmap3); } </code></pre> <p>below is my xml code:</p> <pre><code> &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" android:gravity="center" android:orientation="horizontal" &gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/img1" android:layout_width="70dp" android:layout_height="80dp" android:contentDescription="@null" android:background="@drawable/imagebgborder" android:src="@drawable/ic_launcher" /&gt; &lt;TextView android:id="@+id/txt1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="5dp" android:textStyle="bold" android:contentDescription="@null" android:text="@string/hello_world" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/img2" android:layout_width="match_parent" android:layout_height="match_parent" android:contentDescription="@null" android:src="@drawable/ic_launcher" /&gt; &lt;TextView android:id="@+id/txt2" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="5dp" android:contentDescription="@null" android:text="@string/hello_world" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/img3" android:layout_width="match_parent" android:layout_height="match_parent" android:contentDescription="@null" android:src="@drawable/ic_launcher" /&gt; &lt;TextView android:id="@+id/txt3" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="5dp" android:contentDescription="@null" android:text="@string/hello_world" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload