Friday, September 7, 2012

[android-developers] Live wallpaper. nullPointerException when detecting preview mode

Hi 
I am developing a live wallpaper and want the preview mode to display a bitmap as opposed to the regular animation in "run" mode.

I know I should use the isPreview() call and all my searches indicate that I should do this in the onCreateEngine() method which is what I did. However I get a nullPointerException. I have tried other locations and the only locations it works are located too far down to perform initialisation.

Any help is Greatly appreciated.

Thanks

JPS


@Override
public Engine onCreateEngine() {
mEng = new WallpaperEngine();

if (mEng!= null) {
if (mEng.isPreview()) { // crash here
Log.d(TAG, "preview mode");
// display preview bitmap
} else {
Log.d(TAG, "run mode");
// perform full initalization
}
}

return mEng;
}

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate