The above code opens the Chooser dialog and shows all my option when when I click on any, they either throw an error (gmail), give a message saying "file not available" (picasa), or in SMS's case, opens a new message but no picture is shown.
Most of the examples I saw for sending an image using the chooser dialog are sending from a file or stored content somewhere (putExtra(EXTRA_STREAM, Uri)). Does anyone know the correct way to send when all we have is a Bitmap?
Ok, so I gave in and tried saving the image to the sdcar first anf then creating a file URI using the following code
Code:
// Omitted Class ...
public Uri getThumbFileUri() {
if (getThumbBm() == null) return null;
File F = new File("file:///sdcard/MyProject/Images/Thumbs/" + PicId + ".jpg");
Uri U = Uri.fromFile(F);
return U;
}
Code:
// New Chooser Code ...
MapImage Img = (MapImage) ((Button) v).getTag();
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("image/jpeg");
i.putExtra(Intent.EXTRA_STREAM, Img.getThumbFileUri());
MyMv.getContext().startActivity(Intent.createChooser(i,"Send Image To:"));
I still get the Chooser dialog with all the same options of my previous post but when I select a send method I now get different errors
Gmail: Opens a new email showing an attachment of the file I am trying to attach with the same KB size, but when I check the email from them receiver, there is no attachment.
Messager: Shows an error "You cannot add this picture to your message"
I tried it and it worked so I guess it gets me somewhere. However, I do not want to insert the image into the user's pictures, so is there a way to remove it once done?
Ok, I figured it out. Your GRANT_READ.. permission got me thinking. I use the Java.Io to save my cached images to the SdCard and I'm passing the Uri to that file to the Intent. I guess it sandboxed my sdcard files so the intent was unable to read them, even if I gave it the GRANT_READ..
When I converted to using Context.openFileInput() to write the the file everything worked as expected.
Still, out of curiosity, it would be nice to know how to save files to the SdCard so that other Intents are able to read them.
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:"));
Want to send pictures one by one via mms to a fix no
package com.example.Mms;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Mms extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent i = new Intent(Intent.ACTION_SEND) ;
String imageUri = null;
i.putExtra(Intent.EXTRA_STREAM,imageUri) ;
i.setType("image/jpeg") ;
startActivity(Intent.createChooser(i,"Send Image To:")) ;
}
}
I want to write a program which send pictures from one folder,one by one via mms to one fix no..
I have searched this program from Internet.When em running it through emulator it is opening a text box..I wrote text and added a no..and press the send button..but it is not showing a picture send via MMS
Please help me out..Thanks
Have you found anyway to do this without saving the picture into the phone ? I'd like to send an image file that my app gets from my server and then be able to send it.
now i am working on one android application which needs
1) to play an audio song to callee when call is lifted.
2) call has to be disconnected after audio playing completed.
please help me Experts if you have any suggestions for me ...