How to Set Wallpaper: Difference between revisions

From wizarPOS
(Created page with "== Code snippet== <uses-permission android:name = "android.permission.SET_WALLPAPER"/> <syntaxhighlight lang="java"> public void setWallPaper() { WallpaperManager mWallM...")
 
No edit summary
Line 14: Line 14:
</syntaxhighlight>
</syntaxhighlight>
== Demo Project ==
== Demo Project ==
Please get the [ftp://sdkuser:wizsdkar@ftp.wizarpos.com/advanceSDK/SetWallpaper.zip whole demo].
Please get the [http://ftp.wizarpos.com/advanceSDK/SetWallpaper.zip whole demo].

Revision as of 06:27, 22 April 2021

Code snippet

 <uses-permission android:name = "android.permission.SET_WALLPAPER"/>
public void setWallPaper() {
    WallpaperManager mWallManager = WallpaperManager.getInstance(context);
    try {
        mWallManager.setResource(R.drawable.wallpaperCos);
        mHandler.obtainMessage(2, "set setWallPaper success...").sendToTarget();
    } catch (Exception e) {
        e.printStackTrace();
        mHandler.obtainMessage(3, "set setWallPaper fail...").sendToTarget();
    }
}

Demo Project

Please get the whole demo.