Skip to content Skip to sidebar Skip to footer

Why Doesn't This Code Attach An Image To Mms Message?

The code is pretty basic share_button.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Uri image = Uri.parse('android.re

Solution 1:

The intent is transfered to an external application.

The android:resource scheme is only valid locally.

That means that you have to copy the image from your resources to an external directory and link this new file in your Intent

Solution 2:

Solution 3:

What does your Uri.parse() return? Null maybe?

Try this:

Resourcesresources= context.getResources(); 
Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + 
resources.getResourcePackageName(imageToSend) + '/' + 
resources.getResourceTypeName(imageToSend) + '/' + 
resources.getResourceEntryName(imageToSend) ); 

Post a Comment for "Why Doesn't This Code Attach An Image To Mms Message?"