Define "don't work." On Sun, Apr 24, 2011 at 1:12 AM, Simon Platten <[email protected] > 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 [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 -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- 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

