개발/안드로이드
Android - intent 다른 앱의 액티비티 띄우기!
웅'jk
2023. 2. 7. 17:06
1. 연락처로 이동
void selectContact(){
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
startActivity(intent);
}
2. 웹브라우저
void openWebPage(String url){
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);
}
3.SMS 앱
// SMS 보내기위한 액티비티 띄우기
void composeSMS(String phone){
Uri uri = Uri.parse("smsto:"+phone);
Intent intent = new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);
}
4. 이메일
void composeEmail(String[] address,String subject){
Uri uri = Uri.parse("mailto:");
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(uri);
intent.putExtra(Intent.EXTRA_EMAIL,address);
intent.putExtra(Intent.EXTRA_SUBJECT,subject);
startActivity(intent);
}