How to Set Wallpaper: Difference between revisions

From wizarPOS
No edit summary
No edit summary
Line 14: Line 14:
</syntaxhighlight>
</syntaxhighlight>
== Demo Project ==
== Demo Project ==
Please get the [http://ftp.wizarpos.com/advanceSDK/SetWallpaper.zip whole demo].
Please get the [http://ftp.wizarpos.com/advanceSDK/cloudpos/SetCloudposWallpaper.zip whole demo].

Revision as of 01:46, 10 December 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.