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. can i run .exe in android and what is opengl o/p format?

No, you'll need an .apk file which is the installer for android
applications.
Nearly all phones support openGL ES1
The newer ones (N1, Droid etc) support openGL ES2 via the ndk



> 

2. Images Reused in a ListView

I've made a custom ListAdaptor, with associated View, that displays an 
icon on the left of each list item, with three lines of text to the 
right. In MyView.onCreate(), the icons are populated using 
imageView.setImageDrawable(Drawable.createFromStream(URL)); each item on 
the list is it's own object, so each of these is done individually for 
each list item. However when viewing the list, the first few items 
display correctly, but as you scroll down the list, those images that 
were not visible initially are replaced with the same images used in the 
top few items, so 4/5 images end up reused for the entire list. The text 
for each list item is correct. What is going wrong?


Tom

--

3. Permission

4. Android emulator -dns-server usage

5. Bluetooth file transfer to Laptop is failing.

6. ScrollView is not calling onDraw()

7. How to make my app start up itself at the specified time just like the alarm clock.