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. How to connect Emulator with internet???

Hi All,

currently i am using "android-sdk_m5-rc15_windows" SDK. Now i want to
browse some site in emulator. i tried it on emulator but didant get
succeed. even not found any "settings" to set connection in browser.

Anyone have idea regarding use of internet in Android???

Thanks,
kamlesh

--~--~---------~--~----~------------~-------~--~----~

2. Why can't I connect to network using emulator

Hi every one,I am a Chinaese user,using ADSL to connect to
network,with dynamic IP. The computer works well with
network connection.But in android,emulator or in eclipse,I can't
connect to network.While using android maps,it tells me that "the
network seems to be down,...",in browser,it tells me that "connection
failed...". I have closed the firewall,and tried to use
http_proxy ,but got the seam problem.What's wrong?Can anyone give me
suggestion?
--~--~---------~--~----~------------~-------~--~----~

3. how to set the list according to font size

4. No such table

5. Which web hosting service allows dowloading of apk files?

6. RCP for Android is open source now

7. Protecting data and application from illegal use