Android : Share drawable resource with other apps

前端 未结 3 1981
有刺的猬
有刺的猬 2021-01-25 02:36

In my activity I have an ImageView. I want ,when user click on it, a dialog opens (like intent dialogs) that show list of apps which can open image than user can choose a app an

3条回答
  •  野性不改
    2021-01-25 03:07

    Create a chooser by using the following code. You can add it in the part where you say imageview.setonclicklistener(). 
    Intent intent = new Intent();
    // Show only images, no videos or anything else
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    // Always show the chooser (if there are multiple options available)
    startActivityForResult(Intent.createChooser(intent, "Select Picture"), 1);
    

提交回复
热议问题