0
Je suis en mesure de changer le fond d'écran de l'appareil, mais je veux un utilisateur à l'option gibe lorsque vous cliquez sur le bouton fond d'écran, soit il veut définir l'image comme écran d'accueil ou pour WhatsApp.Définir comme papier peint
ici est ma méthode de travail pour la mise en fond d'écran:
fullImageView = (ImageView) findViewById(R.id.imgFullscreen);
public void setAsWallpaper(Bitmap bitmap) {
try {
WallpaperManager wm = WallpaperManager.getInstance(_context);
wm.setBitmap(bitmap);
Toast.makeText(_context,
_context.getString(R.string.toast_wallpaper_set),
Toast.LENGTH_SHORT).show();
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(_context,
_context.getString(R.string.toast_wallpaper_set_failed),
Toast.LENGTH_SHORT).show();
}
}
et ce code de clic méthode:
public void onClick(View v) {
Bitmap bitmap = ((BitmapDrawable) fullImageView.getDrawable())
.getBitmap();
switch (v.getId()) {
// button Download Wallpaper tapped
case R.id.llDownloadWallpaper:
utils.saveImageToSDCard(bitmap);
break;
// button Set As Wallpaper tapped
case R.id.llSetWallpaper:
utils.setAsWallpaper(bitmap);
break;
default:
break;
}
}
Code de travail serait très utile.
Ai-je besoin de remplacer mon code existant de cette ..Je suis nouveau android –
oui, si vous voulez faire apparaître un pop-up et sélectionnez ce que vous voulez faire avec le chemin, comme comme fond d'écran, ou définir comme profil whatsapp, etc. –