Mega Code Archive

 
Categories / Android / Network
 

Start SMS Intent

import android.content.Context; import android.content.Intent; import android.text.Html; class UIHelper {   public static void startSMSIntent(final Context ctx, final String subject, final String source, final String url) {     final StringBuilder body = new StringBuilder();     if (subject != null && !"".equals(subject.trim()))       body.append(subject);          body.append("\n\nRead on:\n ").append(url);     final Intent sendIntent = new Intent(Intent.ACTION_VIEW);          sendIntent.putExtra("sms_body", body.toString());     sendIntent.setType("vnd.android-dir/mms-sms");     ctx.startActivity(sendIntent);   } }