1

I have a bitmap file that I created using Android Query:

aq = new AQuery(HomeCategoryActivity.this);
aq.ajax(currentUrl,Bitmap.class,0,new AjaxCallback<Bitmap>(){
        @Override
        public void callback(String url, Bitmap object, AjaxStatus status) {
            if(object != null)
            {
                bmp = object;
            }
        }
    });

bmp is a globally initialized variable and it gets properly saved by the above code and NOT NULL, I checked.

Now I want to share this bitmap on other apps using this:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/jpeg");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(bmp));
startActivity(Intent.createChooser(intent, "Share Product via:"));

This won't work since the code is probably wrong. What changes should I make?

I want to share the image on Fb, insta, etc

  • if all you want to do is send bitmap from one activity to another, then check for a selected answer in below link: http://stackoverflow.com/questions/11010386/send-bitmap-using-intent-android – AADProgramming Jan 18 '15 at 15:15
  • I want to share it on social networks like fb or insta @AADTechnical – Nehara Ranathunga Jan 18 '15 at 15:17

1 Answers1

0

Save bitmap to external storage and get path of the bitmap image

then pass the Uri.parse(path)to the intent.

for more information refer to this link http://developer.android.com/training/sharing/send.html

Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("image/jpeg");
    intent.putExtra(Intent.EXTRA_STREAM, Uri.parseUri(path));
    startActivity(Intent.createChooser(intent, "Share Product via:"));
Rakesh Kalashetti
  • 1,049
  • 8
  • 8