public void SetLockImg(){ Bitmap bitmap = BitmapFactory.decodeResource(getResources(), mLockScreenImage); String string = "/data/shared/lockbg.png"; File file = new File(string); BufferedOutputStream bos = null; if(file.exists()) { file.delete(); if(bitmap==null) { return; } } try { file.createNewFile(); file.setReadable(true, false); file.setWritable(true, false); file.setExecutable(true,false); bos = new BufferedOutputStream(new FileOutputStream(file)); bitmap.compress(Bitmap.CompressFormat.PNG,100, bos); bos.flush(); bos.close(); } catch (IOException e) { e.printStackTrace(); } }
public void SetDeskImg(){ Bitmap bitmap = null; bitmap = BitmapFactory.decodeResource(getResources(),mWallpaperImage); if(bitmap != null) try { setWallpaper(bitmap); } catch (IOException e) { e.printStackTrace(); } }