Image viewers on android phones not always the best experience?

by Maps.Huge.Info (Maps API Guru) » Fri, 16 Jul 2010 07:33:27 GMT

Sponsored Links
 You can always use a webview. It's pretty easy to write your own
method or use the default. Images in webview seem to work quite well
and start fairly fast.

-John Coryat


Image viewers on android phones not always the best experience?

by Maps.Huge.Info (Maps API Guru) » Sat, 17 Jul 2010 04:08:57 GMT

 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

-John Coryat


Sponsored Links

Image viewers on android phones not always the best experience?

by nation-x » Sat, 17 Jul 2010 23:14:11 GMT

 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="" ;

private Display display;

/* in onCreate */
display = ((WindowManager)

/* add the image to the ImageView */
String[] myImageWithPath = "/sdcard/DCIM/image.jpg";

ImageView image = (ImageView)findViewById(;

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 = 
new_height, true);
                case LANDSCAPE:
                        factor  = screenheight / oHeight;
                        int new_width = factor * oWidth;
                        scaledBitmap = 
screenheight, true);
        else {
            /* Image doesn't need to be resized */
                return Drawable.createFromPath(imagePath);
        return new BitmapDrawable(getResources(), scaledBitmap);

On Jul 16, 4:08pm, "Maps.Huge.Info (Maps API Guru)"


Image viewers on android phones not always the best experience?

by nation-x » Sun, 18 Jul 2010 20:53:12 GMT

 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.



Image viewers on android phones not always the best experience?

by Joseph Earl » Wed, 21 Jul 2010 04:36:33 GMT

 I would recommend implementing a custom view class which extends
ImageView and overrides the onTouch event.
Take a look at Luke Hutch's MultiTouchController 
and samples.

This will be
a) Quicker to load
b) Use less memory
c) Give you multi-touch pinch-zoom


Other Threads

1. Access Context from a different Package

I have an Activity which is packaged as a jar and I want to get the system
service for Connectivity and use the ConnectivityManager. Hence, I am using
getSystemService(Context.CONNECTIVITY_SERVICE). I want to use
getActivity().getSystemService() or getApplication() of that activity but
when I create a reference of it from other application(say Hello World) to
which the jar file has already been added.

I want to have that application(Hello World) in another package. In this
scenario the getApplication() method returns null.

1. Is there any way to get the application/ context?

2. Is there any other way by which i could access the
getSystemService(Context.CONNECTIVITY_SERVICE) of the activity which i have
bundled as the jar?

Please Help!



2. Rotate an image in android

Hi All,

I have to rotate an image continuously.

How to do it in android?

Any example for it?

It is urgent.Please help.



3. Access Context from a different Package : getApplication returns null

4. Problem in handling Incoming Calls

5. Start another application from another package with an Intent

6. Obtain list of devices in network

7. Android 2.1 and MS SQL Server