button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setBackgroundImage(); } }); } private void setBackgroundImage() { Bitmap bitmap = ((BitmapDrawable)imageView.getDrawable()).getBitmap(); WallpaperManager manager = WallpaperManager.getInstance(getApplicationContext()); try { manager.setBitmap(bitmap); Toast.makeText(getApplicationContext(), "Set Wallpaper Successfully ", Toast.LENGTH_SHORT).show(); } catch (IOException e) { Toast.makeText(this, "Wallpaper not load yet!", Toast.LENGTH_SHORT).show(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)