This code works for "adress" and "sms_body" but not for "image"
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Uri uri=Uri.parse("file://"+Environment.getExternalStorageDirectory()+"/q.png");
Intent i = new Intent(Intent.ACTION_SEND);
i.putExtra("address","1234567890");
i.putExtra("sms_body","This is the text mms");
i.putExtra(Intent.EXTRA_STREAM,"file:/"+uri);
i.setType("image/png");
startActivity(i);
}
}
Someone knows why ?
I solved my problem. The solution is to use :
i.putExtra(Intent.EXTRA_STREAM,Uri.fromFile(file));
Instead of :
i.putExtra(Intent.EXTRA_STREAM,uri);
I thank all those who wanted to help me :)