I see I have some typos in the example above. For example: String[] myImageWithPath should be String myImageWithPath
Just thought you should know that this isn't a completely working example. :) Editing may be necessary. Shawn On Jul 17, 11:13 am, nation-x <[email protected]> wrote: > I just use an ImageView and resize the image before I display it. Here > is my layout: > > <?xml version="1.0" encoding="utf-8"?> > <ImageView xmlns:android="http://schemas.android.com/apk/res/android" > android:id="@+id/image" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:scaleType="centerInside" > android:src="@drawable/wait" > /> > > private Display display; > > /* in onCreate */ > display = ((WindowManager) > getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); > > /* add the image to the ImageView */ > String[] myImageWithPath = "/sdcard/DCIM/image.jpg"; > > ImageView image = (ImageView)findViewById(R.id.image); > image.setImageDrawable(getScaledDrawable(myImageWithPath)); > > private int getScreenWidth() { > int width = display.getWidth(); > return width; > > } > > private int getScreenHeight() { > int height = display.getHeight(); > return height; > > } > > private Drawable getScaledDrawable(String imagePath) { > Bitmap scaledBitmap = null; > BitmapFactory.Options options=new BitmapFactory.Options(); > options.inSampleSize = 2; > Bitmap origBitmap = BitmapFactory.decodeFile(imagePath, options); > > int oWidth = origBitmap.getWidth(); > int oHeight = origBitmap.getHeight(); > > int screenwidth = getScreenWidth(); > int screenheight = getScreenHeight(); > > /* Scale the image according to orientation */ > if ((oWidth > screenwidth) && (oHeight > screenheight)) { > switch (display.getOrientation()) { > case PORTRAIT: > int factor = screenwidth / oWidth; > int new_height = factor * oHeight; > scaledBitmap = > Bitmap.createScaledBitmap(origBitmap,screenwidth, > new_height, true); > break; > case LANDSCAPE: > factor = screenheight / oHeight; > int new_width = factor * oWidth; > scaledBitmap = > Bitmap.createScaledBitmap(origBitmap,new_width, > screenheight, true); > break; > } > } > else { > /* Image doesn't need to be resized */ > return Drawable.createFromPath(imagePath); > } > System.gc(); > return new BitmapDrawable(getResources(), scaledBitmap); > > } > > On Jul 16, 4:08 pm, "Maps.Huge.Info (Maps API Guru)" > > <[email protected]> wrote: > > You can do whatever you want to with webview. It's a browser, well > > sort of, and as such, a little css/html/JavaScript will do just about > > anything. > > > -John Coryat > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

