4

I want to make Android Live Wallpaper. I want to use LibGDx. I found this information: http://www.badlogicgames.com/wordpress/?p=2652

Unfortunately, ahter copy code to my wallpaper, eclipse show error.

Does anyone knows how to make wallpaper using LibGDx?

Eclipse shows following information: "MyApplicationListener cannot resolved to a type"? There are 3 quick fixes available: 1. create classs MyApplicationListener 2. change to "ApplicationListener" (com.badlogic.gdx) 3. Fix project setup

After choose 2 fix, eclipse shows another error: "Cannot instantiate the type ApplicationListener"

I solved my problem with HaMMeReD's help.

My code in android project:

public class MainActivity extends AndroidLiveWallpaperService {

    @Override
    public ApplicationListener createListener(boolean isPreview) {
        // TODO Auto-generated method stub
        return new SexyWomen();// here should be wrote name of class form main LibGDx project
    }

    @Override
    public AndroidApplicationConfiguration createConfig() {
        // TODO Auto-generated method stub
        return new AndroidApplicationConfiguration();
    }

    @Override
    public void offsetChange(ApplicationListener listener, float xOffset, float yOffset, float xOffsetStep, float yOffsetStep,
            int xPixelOffset, int yPixelOffset) {
        // TODO Auto-generated method stub
        Gdx.app.log("LiveWallpaper", "offset changed: " + xOffset + ", " + yOffset);

    }

}
Mathew Thompson
  • 55,877
  • 15
  • 127
  • 148
Tomeksss
  • 303
  • 2
  • 4
  • 11
  • 1
    Mentioning that an error occurs while failing to post the exact error message is a good way to make yourself unpopular here. – Chris Stratton Dec 03 '12 at 21:51

1 Answers1

3

Put your code back the way it was.

Choose option 3 for quick fix.

It should include your Main Gdx project on your build path and fix that error.

Manually goto Java-Build-Path/Projects tab and add your Gdx project.

Your backend project needs to have access to your main gdx project in order to find that class.

HaMMeReD
  • 2,440
  • 22
  • 29