How to share image of imageview?

后端 未结 6 1883
余生分开走
余生分开走 2021-01-14 16:47

I have ImageView and I want to share its image.

Following is my code,

btshare.setOnClickListener(new OnClickListener() {

        @Override
                 


        
6条回答
  •  臣服心动
    2021-01-14 17:32

    Try below code to share your image:

        Intent share = new Intent(Intent.ACTION_SEND);
        share.setType("image/*");
        share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(root.getAbsolutePath() + "/DCIM/Camera/image.jpg"));
        startActivity(Intent.createChooser(share,"Share via"));
    

    Add these permissions to AndroidMenifest.xml

      
    
    
    

提交回复
热议问题