I want to display a png file in a view.
but i found the picture was fuzzy, I don't know what's wrong with it.
code:
Using java Syntax Highlighting
- private Bitmap downloadImage(String urlStr) {
- Bitmap bitmap = null;
- InputStream in = null;
- URL url = null;
- try {
- url = new URL(urlStr);
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
- in = conn.getInputStream();
- BitmapFactory.Options opts = new BitmapFactory.Options() ;
- opts.inSampleSize = 1;
- bitmap = BitmapFactory.decodeStream(in);
- } catch (IOException e1) {
- e1.printStackTrace();
- }finally{
- try {
- if(in != null)
- in.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- return bitmap;
- }
- adapt = downloadImage("http://www.x-navi.cn/images/map_blocks/2/6/6/6/00000069_00000069.png");
- canvas.drawBitmap(adapt, 0, 0, paint);
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
anyone help me.
thanks.
normal:



