I found the JoshKraker way to do this:
Saving the file first to the phone:
FileOutputStream Os = getAppContext().openFileOutput("Img" + _PicId +
".jpg", Context.MODE_WORLD_READABLE);
Bm.compress(Bitmap.CompressFormat.JPEG, 100, Os);
Os.close();
Then getting the Uri to send to the Chooser intent:
File F = getAppContext().getFileStreamPath("Img" +
_PicId + ".jpg");
Uri U = Uri.fromFile(F);
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("image/jpg");
i.putExtra(Intent.EXTRA_STREAM, U);
getContext().startActivity(Intent.createChooser
(i,"Send Image To:"));
But I'd like to do this without having to save the bitmap.. I get my
image from my server and I want users to be able to share it with
somebody else.
On Jul 30, 2010, at 9:41 AM, Pedro Teixeira wrote:
Hi,
I have a bitmap "picPrev" which I got from my online server. I want to
turn it into a file so I can send it.
I was exploring this method:
try {
FileOutputStream fos = super.openFileOutput("output.jpg",
MODE_WORLD_READABLE);
picPrev.compress(CompressFormat.JPEG, 75, fos);
fos.flush();
fos.close();
} catch (Exception e) {
Log.e("MyLog", e.toString());
}
But the FileOutputStream fos = super.openFileOutput("output.jpg",
MODE_WORLD_READABLE); command is not working...
Is there anyway to convert a bitmap to stream ?
Or any other way to create a New File from a Bitmap ?
I also have the opportunity to use the URL on which the file is
placed. Maybe an HTTP connection to a php file that will return a
header with the file location? Can "new File" use that location url?
Please give me some feedback on this. I could really use some help.
Thank you very much
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Pedro Teixeira
www.pedroteixeira.org
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en