My app has to display an image preview from the image data obtained as 
InputStream from a web service. InputStream is decoded to Bitmap to display 
in ImageView. This entire flow is working fine in Android 2.2 and 2.3, 
whereas it's not functioning with Android 3.0 and 4.0. The bitmap decoded 
is null in the latter case whereas its fine in 2.x.

Here is the code snippet I use.

ImageView imgView = (ImageView) findViewById(R.id.image);       
String imageUrl = "my webservice url";      
HttpClient httpClient = new DefaultHttpClient();
HttpGet mHttpGetEntity = new HttpGet(imageUrl);
HttpResponse response;
try {
    response = httpClient.execute(mHttpGetEntity);
    InputStream is = response.getEntity().getContent();
    imgView.setImageBitmap(BitmapFactory.decodeStream(is));
} catch (ClientProtocolException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
}

How can I make this work even with Android 3.0 above. Please advice.

-Girish



-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to