title: How to display a bmp image in android
body: <p>I'm new to java and android development. I tried to find answer to this question but it seems that the is obvious so nobody asks that..
  I used this example to display an image:</p>
  
  <pre><code>/** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      String str="http://logproj.500mb.net/image.php?id=8";
      ImageView imView;
      imView = (ImageView)findViewById(R.id.image);
       try{
      url = new URL(str);
      }
      catch(MalformedURLException e)
      {
              e.printStackTrace();
      }
      try{
              HttpURLConnection conn =  (HttpURLConnection)url.openConnection();
              conn.setDoInput(true);
  
              conn.connect();
              int length = conn.getContentLength();
  
              int[] bitmapData =new int[length];
              byte[] bitmapData2 =new byte[length];
  
              InputStream is = conn.getInputStream();
  
              bmp = BitmapFactory.decodeStream(is);
              imView.setImageBitmap(bmp);
              } catch (IOException e)
              {
                      e.printStackTrace();
              }
  
  }
  </code></pre>
  
  <p>It works great for jpg images, but my image is bmp and application crashes or "stopps unexpectadly".</p>
  
  <p>I hope you'll help with this problem. thanks in advance.</p>