Android FileOutputStream

Posted by zaid on Stack Overflow See other posts from Stack Overflow or by zaid
Published on 2010-12-28T03:51:46Z Indexed on 2010/12/28 3:53 UTC
Read the original article Hit count: 367

Filed under:
|

i am attempting to save an image file using "openFileOutput" and then adding that file to my intent with EXTRA_STREAM. but logcat keeps saying that file size is 0, i have the proper permission in my manifest.

FileOutputStream fos = openFileOutput("p001.jpg", Context.MODE_WORLD_READABLE);
         File jpg = getFileStreamPath("p001.jpg");
            fos.close();
            Intent share = new Intent(android.content.Intent.ACTION_SEND);



         share.setType("image/jpeg");
            share.putExtra(Intent.EXTRA_SUBJECT, "Fail picture");
            share.putExtra(Intent.EXTRA_TEXT, "Epic fail!!!");
            share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(jpg)); 
            startActivity(Intent.createChooser(share, "Choose share method."));

© Stack Overflow or respective owner

Related posts about android

Related posts about intent