HOw to resize image view.

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

HOw to resize image view.

Postby ansh.chauhan » Wed Jun 24, 2009 6:45 am

Hi friends
I m showing image using image view but it convert my small image in to very large one.so tell me how i can re size my image to original size
ansh.chauhan
Experienced Developer
Experienced Developer
 
Posts: 75
Joined: Tue May 27, 2008 7:04 am

Top

Postby ansh.chauhan » Wed Jun 24, 2009 6:46 am

here My code is


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  public void onCreate(Bundle savedInstanceState) {
  3.  
  4.         super.onCreate(savedInstanceState);
  5.  
  6.          setContentView(connecting());
  7.  
  8.     }
  9.  
  10.    
  11.  
  12.     public ImageView connecting() {
  13.  
  14.         ImageView i = new ImageView(this);
  15.  
  16.         URL aURL;
  17.  
  18.                 try {
  19.  
  20.                         aURL = new URL("http://upload.wikimedia.org/wikipedia/commons/a/af/Wiki-x-face.png");
  21.  
  22.                         URLConnection conn = aURL.openConnection();
  23.  
  24.                         conn.connect();
  25.  
  26.                         InputStream is = conn.getInputStream();
  27.  
  28.                         BufferedInputStream bis = new BufferedInputStream(is);
  29.  
  30.                         Bitmap bm = BitmapFactory.decodeStream(is);
  31.  
  32.                        
  33.  
  34.                         i.setImageBitmap(bm);
  35.  
  36.                         i.setScaleType(ImageView.ScaleType.FIT_CENTER);
  37.  
  38.                 } catch (Exception e) {
  39.  
  40.                         e.printStackTrace();
  41.  
  42.                 }
  43.  
  44.         return i;
  45.  
  46.         }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
ansh.chauhan
Experienced Developer
Experienced Developer
 
Posts: 75
Joined: Tue May 27, 2008 7:04 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot] and 4 guests