Code example for WallpaperManager

Methods: setResource

0
        } 
 
        mIsWallpaperSet = true;
        try { 
            WallpaperManager wpm = (WallpaperManager)getSystemService(WALLPAPER_SERVICE);
            wpm.setResource(mImages.get(position));
            setResult(RESULT_OK);
            finish();
        } catch (IOException e) {
            Log.e(TAG, "Failed to set wallpaper: " + e);
        } 
    } 
 
    public void onNothingSelected(AdapterView<?> parent) {
    } 
 
    private class ImageAdapter extends BaseAdapter {
        private final LayoutInflater mLayoutInflater;
 
        ImageAdapter(WallpaperChooser context) {
            mLayoutInflater = context.getLayoutInflater();