title: Image doesn't load from url
body: <p>Hello i am building an application which populates a listview with data from mysql.</p>
  
  <p>The thing is that all other data are being displayed except the image. I am using this method to get image from url</p>
  
  <pre><code>public Bitmap getBitmapFromUrl(String src) {
          try {
              URL url = new URL(src);
              HttpURLConnection connection = (HttpURLConnection) url.openConnection();
              connection.setDoInput(true);
              connection.connect();
              InputStream inputStream = connection.getInputStream();
              Bitmap myBitmap = BitmapFactory.decodeStream(inputStream);
              return myBitmap;
          } catch (Exception e) {
              e.printStackTrace();
              return null;
          }
      }
  </code></pre>
  
  <p>then my adapters uses setImageBitmap to the imageview like this</p>
  
  <pre><code>ImageView stockImage = (ImageView)stockView.findViewById(R.id.imagestartinglist);
              stockImage.setImageBitmap(current.getStockImage());
  </code></pre>
  
  <p>and i get the image from JSON like this</p>
  
  <pre><code>public void ListDrawer() {
          customList = new ArrayList&lt;StockList&gt;();
          try {
              JSONObject jsonResponse = new JSONObject(jsonResult);
              JSONArray jsonMainNode = jsonResponse.optJSONArray("metoxes");
              for (int i = 0; i &lt; jsonMainNode.length(); i++) {
                  JSONObject jsonChildNode = jsonMainNode.getJSONObject(i);
                  String name = jsonChildNode.optString("name");
                  String price = jsonChildNode.optString("price");
                  String price1 = jsonChildNode.optString("price1");
                  String price2 = jsonChildNode.optString("price2");
                  String price3 = jsonChildNode.optString("price3");
                  String price4 = jsonChildNode.optString("price4");
                  String price5 = jsonChildNode.optString("price5");
                  String price6 = jsonChildNode.optString("price6");
                  String price7 = jsonChildNode.optString("price7");
                  String price8 = jsonChildNode.optString("price8");
                  String price9 = jsonChildNode.optString("price9");
                  String price10 = jsonChildNode.optString("price10");
                  String price11 = jsonChildNode.optString("price11");
                  String price12 = jsonChildNode.optString("price12");
                  String price13 = jsonChildNode.optString("price13");
                  String price14 = jsonChildNode.optString("price14");
                  String price15 = jsonChildNode.optString("price15");
  
                  String image = jsonChildNode.optString("image");
  
                  Bitmap bmp = getBitmapFromUrl(image);
  
                  loipesTimes = new String[]{price1, price2, price3, price4, price5, price6, price7, price8, price9,
                          price10, price11, price12, price13, price14, price15};
                  customList.add(new StockList(name, price, bmp, loipesTimes));
              }
          } catch (Exception e) {
              Intent intent1 = new Intent(ListLoaderActivity.this,
                      RefreshActivity.class);
              startActivity(intent1);
              ListLoaderActivity.this.finish();
          }
  
          ArrayAdapter adapter = new MyStocksAdapter(ListLoaderActivity.this, R.layout.list_item, customList);
          adapter.notifyDataSetChanged();
          startList.setAdapter(adapter);
      }
  </code></pre>
  
  <p>my php file for retrieving data from mysql database is <a href="http://stockpredictions.url.ph/getstocks.php" rel="nofollow">Here</a></p>
  
  <p>Any ideas?? Thanks in Advance!!!</p>