When using the code on Android 1.6 platforms, the bitmaps are re-sized as
aspected, however when used on Android 2.1 its as if the function to rescale
has no effect what so ever, the wallpapers always come out the wrong size.


On Sun, Apr 24, 2011 at 9:12 AM, Simon Platten <simonaplat...@googlemail.com
> wrote:

> On Android 1.6 my wallpaper applications resize the wallpapers correctly,
> however on Android 2.1 the resizing doesn't work, its the same on the
> emulator.
>
> I've tried using both the Matrix and Bitmap.createScaledBitmap both do
> exactly the same and work find on 1.6.  Can anyone explain what is happing
> and why these routines don't work on Android 2.1?
>
> I start off by getting the device screen size using:
>
>             Display display = app.getWindowManager().
> getDefaultDisplay();
>             m_intScrWidth = display.getWidth();
>             m_intScrHeight = display.getHeight();
>
> I load the image from a resource with:
>
>             m_bmpImage = BitmapFactory.decodeResource( m_res, intResId );
>             m_intImgWidth  = m_bmpImage.getWidth();
>             m_intImgHeight = m_bmpImage.getHeight();
>             m_fltSFbyHeight = (float)m_intScrHeight / (float)m_intImgWidth;
>
> Then to scale the image:
>
>         m_intFinalWidth  = (int)((float)m_intImgWidth * m_fltSFbyHeight);
>         m_intFinalHeight = (int)((float)m_intImgHeight * m_fltSFbyHeight);
>
> Thank you,
> Simon
>

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

Reply via email to