Problem with Creating Bitmap Images

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Problem with Creating Bitmap Images

Postby paul.ramesh » Thu Mar 26, 2009 2:00 pm

Hi everybody,
Im displaying the thumbnails of images in a gridview those are stored in the server .
Now im trying to display the actual image of the thumbnail according to user selection.
When i select any thumbnail at the first time, it works fine and displaying the actual image. Now if i select the
back button and again select another thumbnail, it gives error. Now again if i select the same thumbnail, it works fine.So my alternate selections are giving an error..

this is my code


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public void onCreate(Bundle savedInstanceState) {
  2.  
  3.                 super.onCreate(savedInstanceState);            
  4.  
  5.                 setContentView(R.layout.storageimage);
  6.  
  7.                 iv = (ImageView) findViewById(R.id.storageimg);        
  8.  
  9.                 Intent i = getIntent();
  10.  
  11.                 Bundle extras = i.getBundleExtra("extra");
  12.  
  13.                 url = extras.getString("url");         
  14.  
  15.                 try
  16.  
  17.                 {
  18.  
  19.                         URL myURL=new URL(url);
  20.  
  21.                         final URLConnection ucon = myURL.openConnection();
  22.  
  23.                         ucon.connect();
  24.  
  25.                         final BufferedInputStream bis=new BufferedInputStream(ucon.getInputStream());
  26.  
  27.                        
  28.  
  29.                         final Bitmap bm = BitmapFactory.decodeStream(bis);     
  30.  
  31.                         bis.close();
  32.  
  33.                        
  34.  
  35.                         iv.setImageBitmap(bm);
  36.  
  37.                 }
  38.  
  39.                 catch(Exception e)
  40.  
  41.                 {
  42.  
  43.                        
  44.  
  45.                 }
  46.  
  47.         }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


Im getting the correct url for every selection. InputStream also not null..


Can anybody help me in this?

Thanks,
Ramesh.
paul.ramesh
Freshman
Freshman
 
Posts: 4
Joined: Sat Mar 14, 2009 11:18 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 9 guests