Skip to content Skip to sidebar Skip to footer

How To Use Share Image Method From Url

Currently, I am using the Picasso library to download images and save it in the device and share it with outhers, the problem is when I press the button of share it is not working

Solution 1:

Try this

        /* button to share image */
    share_image = findViewById(R.id.button_share);
    share_image.setOnClickListener(new View.OnClickListener() {
                                 @Override
                                 public void onClick(View view) {
                                     BitmapDrawable bitmapDrawable = ((BitmapDrawable) imageView.getDrawable());
                                     Bitmap bitmap = bitmapDrawable .getBitmap();
                                     String bitmapPath = Images.Media.insertImage(getContentResolver(),bitmap,"hello bro",null);
                                     Uri bitmapUri = Uri.parse(bitmapPath);
                                     Intent shareIntent=new Intent(Intent.ACTION_SEND);
                                     shareIntent.setType("image/jpeg");
                                     shareIntent.putExtra(Intent.EXTRA_STREAM, bitmapUri);
                                     startActivity(Intent.createChooser(shareIntent,"Share Image"));
                                 }
                             });

Post a Comment for "How To Use Share Image Method From Url"