Android
2010. 12. 7. 17:00
반응형
암시적인 Intent를 사용하여 다른 Activity를 호출할 수 있다.
암시적인 Intent란 실행 주체를 서술하지 않고, 목적에 맞게 Activity를 실행하는 것이다.
암시적인 Intent를 사용하기 위해서는 액션과 데이터가 필요하다.
-- 전화를 거는 Activity 호출 --
// 전화를 걸기 위한 목적으로 intent생성, 전화번호를 데이터로 넘겨준다.
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:010-1111-2222"));
startActivity(intent) // intent 실행
암시적인 intent를 사용하기 위해서는 permission이 필요하다
Manifest.xml에 추가한다.
<uses-permission anroid:name="anroid.permission.CALL_PHONE"/>
-- Web Activity 호출 --
// Web을 열기위해서 intent생성, web사이트를를 데이터로 넘겨준다.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.co.kr"));
startActivity(intent) // intent 실행
<uses-permission android:name="android.permission.INTERNET"/>
(intent 목록 참조 사이트)
http://developer.android.com/guide/appendix/g-app-intents.html
암시적인 Intent란 실행 주체를 서술하지 않고, 목적에 맞게 Activity를 실행하는 것이다.
암시적인 Intent를 사용하기 위해서는 액션과 데이터가 필요하다.
-- 전화를 거는 Activity 호출 --
// 전화를 걸기 위한 목적으로 intent생성, 전화번호를 데이터로 넘겨준다.
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:010-1111-2222"));
startActivity(intent) // intent 실행
암시적인 intent를 사용하기 위해서는 permission이 필요하다
Manifest.xml에 추가한다.
<uses-permission anroid:name="anroid.permission.CALL_PHONE"/>
-- Web Activity 호출 --
// Web을 열기위해서 intent생성, web사이트를를 데이터로 넘겨준다.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.co.kr"));
startActivity(intent) // intent 실행
<uses-permission android:name="android.permission.INTERNET"/>
(intent 목록 참조 사이트)
http://developer.android.com/guide/appendix/g-app-intents.html
반응형
'Android' 카테고리의 다른 글
안드로이드(Android)의 측정 단위 (0) | 2010.12.16 |
---|---|
Intent의 특징을 나타내는 6가지 구성요소 (0) | 2010.12.08 |
안드로이드 설치 방법 (0) | 2010.12.08 |
Intent list (0) | 2010.12.07 |
다른 Activity 호출 (명시적 Intent) (0) | 2010.12.07 |