Code example for FragmentActivity

Methods: getResources

0
        } 
         
        @Override 
        protected Boolean doInBackground(Integer... params) {
            try { 
                Bitmap b = BitmapFactory.decodeResource(getResources(),
                        sWallpapers.get(params[0]), mOptions);
                 
                WallpaperManager wallpaperManager = WallpaperManager.getInstance(mContext);
                try { 
                    wallpaperManager.setBitmap(b);
                } catch (IOException e) {
                    // If we crash, we will probably have a null bitmap 
                    // return before recycling to avoid exception 
                    throw new NullPointerException();
                } 
                 
                // Help GC 
                b.recycle();
                 
                return true;