No exception thrown? Are you sure your logcat doesn't say anything?

I suspect, you might be getting OutOfMemoryException.
Have you considered scaling your image? Or, do you have to preserve
this resolution?
If you can scale your images, perhaps, you can avoid it.

On Nov 6, 9:32 pm, darrinps <[email protected]> wrote:
> I have an application that works fine with smaller images (say
> 1024x768 or so) but when you rotate the phone into a different
> orientation (say landscape to portrait) mode with a larger image on
> the screen, and then call ImageView.setImageUri() it goes into the
> BitmapFactory.class and never returns!
>
> So the app eventually times out. Never throws an exception, just never
> returns.
>
> My code looks like this
>
>         ImageView image1 = (ImageView)
> findViewById(R.id.ImageView_HeaderPlay1);
>         ImageView image2 = (ImageView)
> findViewById(R.id.ImageView_HeaderPlay2);
>
>         image1.setAdjustViewBounds(true);
>         image2.setAdjustViewBounds(true);
>
>         //Get the max size of the device
>         Display display = ((WindowManager)
> getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
>         int width  = display.getWidth();
>         int height = display.getHeight();
>         int max = width > height ? height : width;
>
>         max = max / 10;
>
>         image1.setMaxHeight(max);
>         image1.setMaxWidth(max);
>         image1.setImageURI(selectedImageUri);
>
>         image2.setMaxHeight(max);
>         image2.setMaxWidth(max);
>
>                 try
>                 {
>                         image2.setImageURI(selectedImageUri);  <-----DIES
> with this call
>
>                         TextView textView = (TextView) 
> findViewById(R.id.lblEnterText);
>
> textView.setText(getResources().getString(R.string.image_instructions));
>                 }
>                 catch(Exception e)
>                 {
>                         Log.i("ERROR", "Exception caught trying to set text: 
> " + e);
>                 }
>         }
>
> Has anyone else seen this? Sounds like a bug in the Android code more
> than something I am doing since it works fine for smaller images.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to