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?
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?
First create object of this class and then name it like abs
Now to call method do like this
yourObjectName.clearWallpaper();
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');
objectName.clearWallpaper();
I used this.
@SimpleFunction(description = "Reset all wallpaper to the factory default.")
public void ClearWallpaper(){
WallpaperManager objectName = new WallpaperManager();
objectName.clearWallpaper();
}
}
It returned an error when compiling.
Started Compiling Project Wallpaper
Buildfile: /compiler/android/build.xml
javac:
[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/Wallpaper.java:39: error: not a statement
[javac] WallpaperManager extends Object objectName = new WallpaperManager();
[javac] ^
[javac] /compiler/android/src/pOYsW/com/gordonlu/wallpaper/Wallpaper.java:39: error: ';' expected
[javac] WallpaperManager extends Object objectName = new WallpaperManager();
[javac] ^
[javac] 2 errors
[javac] 1 warning
Have you imported wallpaper class
Like this?
import android.app.WallpaperManager;
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
Hmm
Please send me whole code in pm and remove this clear wallpaper method