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
anything.

-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=" 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: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.

Shawn





--



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
 http://lukehutch.wordpress.com/2010/01/06/my-multi-touch-code-ported-to-eclair/ 
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!

Thanks

-- 

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.

Thanks
Kavitha

-- 

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