I wrote my own ImageViewer, and now I want to have Install as functionality, for example, in Android's own ImageViewer. Now I can do it, since Facebook has it. I have attached a screenshot to make myself clearer. 
PS I want to give a more detailed explanation of what goes wrong. After I select "Contact Icon" in the menu, a list of my contacts will appear. When I select a contact, the power of the application closes. If I select “Desktop / Lock Screen”, it will open my phone gallery. Here is my code snippet:
Bitmap icon = mBitmap; Intent setAs = new Intent(Intent.ACTION_ATTACH_DATA); setAs.setType("image/jpg"); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); icon.compress(Bitmap.CompressFormat.JPEG, 100, bytes); File f = new File(Environment.getExternalStorageDirectory() + File.separator + "/my_tmp_file.jpg"); try { f.createNewFile(); FileOutputStream fo = new FileOutputStream(f); fo.write(bytes.toByteArray()); } catch (IOException e) { e.printStackTrace(); } setAs.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/my_tmp_file.jpg")); startActivity(Intent.createChooser(setAs, "Set Image As"));
I also added the appropriate permissions for my manifest, and I can write my image to the phone’s SD card.

source share