Mega Code Archive

 
Categories / Android / Core Class
 

Start MMS Intent

import android.content.Context; import android.content.Intent; import android.text.Html; class UIHelper {     public static void startMMSIntent(final Context ctx, final String subject, final String description, final String source, final String url) {     final Intent i = new Intent(Intent.ACTION_SEND);     final StringBuilder body = new StringBuilder();     body.append("\n\nRead on:\n ").     append(url);     final int spaceLeft = 250 - description.length()+3;     String toAppend = subject + "\n~ " + description;     if (toAppend != null && toAppend.length() > spaceLeft)       toAppend = toAppend.substring(0, spaceLeft)+ "...";     body.insert(0, toAppend);     i.putExtra(Intent.EXTRA_TITLE, subject);     i.putExtra(Intent.EXTRA_SUBJECT, source);     //i.putExtra(, this.title);     i.putExtra("sms_body", body.toString());     i.setType("image/png");     ctx.startActivity(Intent.createChooser(i, "Select MMS application"));   } }