How to call a method in Java?

I would like to call this public method in my extension using Java code. I want it to be a purple method block, but I don’t know how to.

Can somebody teach me?

1 Like

First create object of this class and then name it like abs
Now to call method do like this

1 Like

I forgot how to create object of this class. Do you know?

I know it well
But what’s the name of class
I don’t know
You tell me

I think it is WallpaperManager.

Ok then do like this

WallpaperManager objectName = new WallpaperManager('pass parameters if required');


I used this.

    @SimpleFunction(description = "Reset all wallpaper to the factory default.")
    public void ClearWallpaper(){
      WallpaperManager objectName = new WallpaperManager();

It returned an error when compiling.

Started Compiling Project Wallpaper
Buildfile: /compiler/android/build.xml

[mkdir] Created dir: /compiler/android/build/pOYsW/classes
[javac] Compiling 1 source file to /compiler/android/build/pOYsW/classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] /compiler/android/src/pOYsW/com/gordonlu/wallpaper/ error: not a statement
[javac] WallpaperManager extends Object objectName = new WallpaperManager();
[javac] ^
[javac] /compiler/android/src/pOYsW/com/gordonlu/wallpaper/ error: ';' expected
[javac] WallpaperManager extends Object objectName = new WallpaperManager();
[javac] ^
[javac] 2 errors
[javac] 1 warning

Have you imported wallpaper class

Like this?


Hmmm it’s okay
Wait let me recheck the code

I don’t think it needs params.

It returns the same error.

error: WallpaperManager() is not public in WallpaperManager; cannot be accessed from outside package

Please send me whole code in pm and remove this clear wallpaper method