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. Why "onFocusChangeListner" does NOT work

I set focuse change listner for DatePicker, but after I leave the
DatePicker, select option in RadioGroup, it seems DatePicker still have the
focus and the listner never be invoked. why?
here are some code:

DatePicker dpk = (DatePicker) findViewById(R.id.DatePicker01);
dpk.setOnFocusChangeListener(focusChangeListner);

.....
View.OnFocusChangeListener focusChangeListner = new
View.OnFocusChangeListener(){

        public void   onFocusChange(View v,boolean hasFocus){
            Log.d("PregnancyWidget", "OnFocusChangeListner invoked!");
             ....some logic
        }
};

I can not see "onFocusChangeListner invoked" in DDMS log. Please help me!

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

2. Can I get user's gmail address or handset SN to verify them?

Hello, everyone.
      Here is the scenario: I plan to develop a application which can share
ideas with others, this means user need submit their idea to my server
through client apk. I don't like ask user to registration. Actually, Every
gphone user have unique gmail address, unique IMEI, handset SN,phone
number,etc. I think these information can be used to replace registration,
everytime when they submit their idea, client apk will send these unique
info with ideas together, so server side know which ideas belong to one
user.  Is there some way can get user's gmail address or machine SN, or
something else to verify user?

Thanks in advance.

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

3. Sending/Receiving Java Objects to Server

4. Starting an Activity BEHIND the current Activity

5. Problem with creating AVD with 1.6 SDK

6. detect onTouch for widget

7. Can I get user's gmail address or handset SN to verify them?