package sg.vinova.vss.group5.non.activity; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; public class Feature extends Activity { public static void dial(Context context, String phoneNumber) { String uriString = "tel:" + phoneNumber.trim(); Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse(uriString)); context.startActivity(intent); } public static void sendSMS(Context context, String phoneNumber) { Uri smsUri = Uri.parse("smsto:" + phoneNumber.trim()); Intent intent = new Intent(Intent.ACTION_SENDTO, smsUri); intent.putExtra("sms_body", ""); // intent.putExtra("sms_body", "Noi dung tin nhan"); context.startActivity(intent); } public static void sendEmail(Context context, String emailAddress) { Intent i = new Intent(Intent.ACTION_SEND); //i.setType("text/plain"); // Use this line for testing in the emulator i.setType("message/rfc822"); // Use from live device (recommended) i.putExtra(Intent.EXTRA_EMAIL , new String[]{emailAddress}); i.putExtra(Intent.EXTRA_SUBJECT, ""); i.putExtra(Intent.EXTRA_TEXT , ""); try { context.startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { //Toast.makeText(MyActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } } }