'Intent.ACTION_SENDTO'에 해당하는 글 1건

반응형
public static void callAction(Context context, String num) {
try {
// 전화 걸기
Uri uri = Uri.parse("tel:" + num);
Intent it = new Intent(Intent.ACTION_CALL, uri);
context.startActivity(it);
} catch (ActivityNotFoundException e) {
Toast.makeText(context, "" + e.getMessage(), Toast.LENGTH_SHORT)
.show();
}
}

public static void smsAction(Context context, String num, String body) {
try {
// SMS 발송
Uri uri = Uri.parse("smsto:" + num);
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
it.putExtra("sms_body", body);
context.startActivity(it);
} catch (ActivityNotFoundException e) {
Toast.makeText(context, "" + e.getMessage(), Toast.LENGTH_SHORT)
.show();
}
}
반응형

WRITTEN BY
아카이시

,