On Friday, September 7, 2012 9:19:42 AM UTC+2, JPS wrote:
>
> 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;
> }
>
>
Hi Calin

here is the crash log

09-07 09:58:33.441: E/AndroidRuntime(2101): FATAL EXCEPTION: main
09-07 09:58:33.441: E/AndroidRuntime(2101): java.lang.NullPointerException
09-07 09:58:33.441: E/AndroidRuntime(2101): at 
android.service.wallpaper.WallpaperService$Engine.isPreview(WallpaperService.java:332)
09-07 09:58:33.441: E/AndroidRuntime(2101): at 
com.aajo.appia.LiveWallpaper.onCreateEngine(LiveWallpaper.java:205)
09-07 09:58:33.441: E/AndroidRuntime(2101): at 
android.service.wallpaper.WallpaperService$IWallpaperEngineWrapper.executeMessage(WallpaperService.java:872)
09-07 09:58:33.441: E/AndroidRuntime(2101): at 
com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)
09-07 09:58:33.441: E/AndroidRuntime(2101): at 
android.os.Handler.dispatchMessage(Handler.java:99)
09-07 09:58:33.441: E/AndroidRuntime(2101): at 
android.os.Looper.loop(Looper.java:130)
09-07 09:58:33.441: E/AndroidRuntime(2101): at 
android.app.ActivityThread.main(ActivityThread.java:3683)
09-07 09:58:33.441: E/AndroidRuntime(2101): at 
java.lang.reflect.Method.invokeNative(Native Method)
09-07 09:58:33.441: E/AndroidRuntime(2101): at 
java.lang.reflect.Method.invoke(Method.java:507)
09-07 09:58:33.441: E/AndroidRuntime(2101): at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-07 09:58:33.441: E/AndroidRuntime(2101): at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-07 09:58:33.441: E/AndroidRuntime(2101): at 
dalvik.system.NativeStart.main(Native Method)
 
Is this what you needed? 

-- 
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