I try to create live wallpaper with libgdx framework. Here's my source code: repository

When I run this, black screen with name of the app appears (probably empty android layout). Main game is not called. I think that it is because starting a service not an activity. However how could I start an activity when AndroidTestWallpaper isn't subclass of Activity class? I used this tutorial but I don't think it's complete, in this form my IDE (Intellij IDEA) doesn't let me to run the app because no main Activity class is found.

So what is the proper way to implement and run live wallpaper in libgdx? How should I edit my code?

EDIT: So I made it work now - I run the app and I can see some graphics but how to make live wallpaper from it?

EDIT 2: I've finally made it work, you can find new version in repository from first post but I still have one problem - when I start the Wallpaper, following exception occurs:

01-05 20:31:53.102: ERROR/AndroidRuntime(3681): FATAL EXCEPTION: main
        java.lang.RuntimeException: Unable to resume activity {com.reinto.wallpaper.test/com.reinto.wallpaper.test.AndroidStarter}: java.lang.NullPointerException
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2823)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2862)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
        at android.app.ActivityThread.access$600(ActivityThread.java:139)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:156)
        at android.app.ActivityThread.main(ActivityThread.java:4977)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
        at dalvik.system.NativeStart.main(Native Method)
        Caused by: java.lang.NullPointerException
        at com.badlogic.gdx.backends.android.AndroidApplication.onResume(AndroidApplication.java:247)
        at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1236)
        at android.app.Activity.performResume(Activity.java:4620)
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2807)
        ... 12 more

But I can continue with selecting the wallpaper and I can make my wallpaper active. However this error is bothering.

EDIT 3: It's finally working. Solution of previous exception is that AndroidStart should extend Activity class not AndroidApplication.


closed as too localized by Tetrad Mar 12 '13 at 21:54

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ Solution of EDIT 2: AndroidStarter should extends Activity class (not AndroidApplication) \$\endgroup\$ – milano Jan 6 '13 at 19:34
  • \$\begingroup\$ Thanks milano it works perfectly, i would just ask you if you managed to get to work this part ? intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, new ComponentName(this, LiveWallpaper.class)); \$\endgroup\$ – Matjaz Trcek Feb 12 '13 at 16:06
  • \$\begingroup\$ I suppose so..my code works fine for me.. \$\endgroup\$ – milano Feb 13 '13 at 14:33

Browse other questions tagged or ask your own question.