List of usage examples for android.content Context setWallpaper
@Deprecated public abstract void setWallpaper(InputStream data) throws IOException;
From source file:com.wms.opensource.images3android.manager.MenuManager.java
public static void displayImageProcessOptionsMenu(final Context context, final Image image, final Bitmap bitmap, final ReviewImageManager manager) { IconContextMenu cm = new IconContextMenu(context, R.menu.image_process_options_menu); cm.setOnIconContextItemSelectedListener(new IconContextItemSelectedListener() { @SuppressWarnings("deprecation") @Override//from w ww. j a v a 2 s.c o m public void onIconContextItemSelected(MenuItem item, Object info) { if (item.getItemId() == R.id.action_hint) { // Position 0 is the indication for selecting a template, so we do nothing } else if (item.getItemId() == R.id.action_save_to_gallery) { MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, image.getId(), ""); Toast.makeText(context, context.getString(R.string.saveToGallaryCompleted), Toast.LENGTH_LONG) .show(); } else if (item.getItemId() == R.id.action_set_as_wall_paper) { try { context.setWallpaper(bitmap); Toast.makeText(context, context.getString(R.string.setWallPaperCompleted), Toast.LENGTH_LONG).show(); } catch (IOException e) { } } else if (item.getItemId() == R.id.action_delete) { manager.dismiss(); // Delete image DeleteImageTask task = new DeleteImageTask(context, image.getBaseUrl(), image.getImagePlantId(), image.getId()); task.execute(); } } }); cm.show(); }