2012년 3월 12일 월요일

액티비티 액션


액티비티 액션
Intent클래스의 정의설명
MAIN_ACTIONandroid.intent.action.MAIN시작점이 되는 액티비티 지정
VIEW_ACTIONandroid.intent.action.View데이터를 유저에게 보여주는 액션
EDIT_ACTIONandroid.intent.action.EDIT데이터를 변경하는 액션
DELETE_ACTIONandroid.intent.action.DELETE데이터를 삭제하는 액션
DEFAULT_ACTIONandroid.intent.action.VIEWVIEW_ACTION과 동일
PICK_ACTIONandroid.intent.action.PICK데이터에서 하나를 선택하여 정보를 돌려주는 액션
GET_CONTENT_ACTIONandroid.intent.action.GET_CONTENT데이터에서 하나를 선택하여 정보를 돌려주는 액션
유저가 신규작성한 데이터를 반환하는 것도 가능
RUN_ACTIONandroid.intent.action.RUN데이터 실행 액션
INSERT_ACTIONandroid.intent.action.INSERT빈 아이템 작성
CALL_ACTIONandroid.intent.action.CALL전화거는 액션
DIAL_ACTIONandroid.intent.action.DIAL전화거는 액션
SENDTO_ACTIONandroid.intent.action.SENDTO데이타를 중심으로 메세지를 보내는 액션
ANSWER_ACTIONandroid.intent.action.ANSWER전화착신 핸들에 관한 액션

브로드캐스트액션
Intentクラスの定数 
BATTERY_CHANGED_ACTIONandroid.intent.action.BATTERY_CHANGED배터리잔량 충전도가 변화했을때의 통지
BOOT_COMPLETED_ACTIONandroid.intent.action.BOOT_COMPLETED시스템기동완료 통지
DATE_CHANGE_ACTIONandroid.intent.action.DATE_CHANGED날짜변경 통지
PACKAGE_ADDED_ACTIONandroid.intent.action.PACKAGE_ADDED어플리케이션 패키지추가시 통지
PACKAGE_REMOVED_ACTIONandroid.intent.action.PACKAGE_REMOVED어플리케이션 패키지제거시 통지
TIMEZONE_CHANGED_ACTIONandroid.intent.action.TIMEZONE_CHANGED타임존 변경시의 통지
TIME_CHANGED_ACTIONandroid.intent.action.TIME_SET시각지정 시의 통지
TIME_TICK_ACTIONandroid.intent.action.TIME_TICK매분 통지


Android Intent
  • 구성
Component가 Data와 Type로 지정된 대상에 대해 Category와 Action으로 지정된 행위를 한다. 추가적인 정보는 Extras로 제공 한다.
Category
  • 인텐트의 분류로 여러 값을 가질 수 있음
  • Category가 있고 Action이 없을 경우 모든 Action이 매핑됨
CATEGORY_DEFAULT = "android.intent.category.DEFAULT";
CATEGORY_BROWSABLE = "android.intent.category.BROWSABLE";
CATEGORY_ALTERNATIVE = "android.intent.category.ALTERNATIVE";
CATEGORY_SELECTED_ALTERNATIVE = "android.intent.category.SELECTED_ALTERNATIVE";
CATEGORY_TAB = "android.intent.category.TAB";
CATEGORY_LAUNCHER = "android.intent.category.LAUNCHER";
CATEGORY_INFO = "android.intent.category.INFO";
CATEGORY_HOME = "android.intent.category.HOME";
CATEGORY_PREFERENCE = "android.intent.category.PREFERENCE";
CATEGORY_DEVELOPMENT_PREFERENCE = "android.intent.category.DEVELOPMENT_PREFERENCE";
CATEGORY_EMBED = "android.intent.category.EMBED";
CATEGORY_MONKEY = "android.intent.category.MONKEY";
CATEGORY_TEST = "android.intent.category.TEST";
CATEGORY_UNIT_TEST = "android.intent.category.UNIT_TEST";
CATEGORY_SAMPLE_CODE = "android.intent.category.SAMPLE_CODE";
CATEGORY_OPENABLE = "android.intent.category.OPENABLE";
CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST = "android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST";
CATEGORY_CAR_DOCK = "android.intent.category.CAR_DOCK";
CATEGORY_DESK_DOCK = "android.intent.category.DESK_DOCK";
Action
  • 인텐트의 액션
  • Category가 없고 Action이 있을 경우, Category가 없는 Action만 매핑됨
ACTION_MAIN = "android.intent.action.MAIN";
ACTION_VIEW = "android.intent.action.VIEW";
ACTION_DEFAULT = "android.intent.action.VIEW";
ACTION_ATTACH_DATA = "android.intent.action.ATTACH_DATA";
ACTION_EDIT = "android.intent.action.EDIT";
ACTION_INSERT_OR_EDIT = "android.intent.action.INSERT_OR_EDIT";
ACTION_PICK = "android.intent.action.PICK";
ACTION_CREATE_SHORTCUT = "android.intent.action.CREATE_SHORTCUT";
ACTION_CHOOSER = "android.intent.action.CHOOSER";
ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT";
ACTION_DIAL = "android.intent.action.DIAL";
ACTION_CALL = "android.intent.action.CALL";
ACTION_SENDTO = "android.intent.action.SENDTO";
ACTION_SEND = "android.intent.action.SEND";
ACTION_SEND_MULTIPLE = "android.intent.action.SEND_MULTIPLE";
ACTION_ANSWER = "android.intent.action.ANSWER";
ACTION_INSERT = "android.intent.action.INSERT";
ACTION_DELETE = "android.intent.action.DELETE";
ACTION_RUN = "android.intent.action.RUN";
ACTION_SYNC = "android.intent.action.SYNC";
ACTION_PICK_ACTIVITY = "android.intent.action.PICK_ACTIVITY";
ACTION_SEARCH = "android.intent.action.SEARCH";
ACTION_SYSTEM_TUTORIAL = "android.intent.action.SYSTEM_TUTORIAL";
ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH";
ACTION_ALL_APPS = "android.intent.action.ALL_APPS";
ACTION_SET_WALLPAPER = "android.intent.action.SET_WALLPAPER";
ACTION_BUG_REPORT = "android.intent.action.BUG_REPORT";
ACTION_FACTORY_TEST = "android.intent.action.FACTORY_TEST";
ACTION_CALL_BUTTON = "android.intent.action.CALL_BUTTON";
ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND";
ACTION_SEARCH_LONG_PRESS = "android.intent.action.SEARCH_LONG_PRESS";
ACTION_POWER_USAGE_SUMMARY = "android.intent.action.POWER_USAGE_SUMMARY";
ACTION_SCREEN_OFF = "android.intent.action.SCREEN_OFF";
ACTION_SCREEN_ON = "android.intent.action.SCREEN_ON";
ACTION_USER_PRESENT = "android.intent.action.USER_PRESENT";
ACTION_TIME_TICK = "android.intent.action.TIME_TICK";
ACTION_TIME_CHANGED = "android.intent.action.TIME_SET";
ACTION_DATE_CHANGED = "android.intent.action.DATE_CHANGED";
ACTION_TIMEZONE_CHANGED = "android.intent.action.TIMEZONE_CHANGED";
ACTION_BOOT_COMPLETED = "android.intent.action.BOOT_COMPLETED";
ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS";
ACTION_PACKAGE_INSTALL = "android.intent.action.PACKAGE_INSTALL";
ACTION_PACKAGE_ADDED = "android.intent.action.PACKAGE_ADDED";
ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED";
ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED";
ACTION_PACKAGE_CHANGED = "android.intent.action.PACKAGE_CHANGED";
ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED";
ACTION_PACKAGE_DATA_CLEARED = "android.intent.action.PACKAGE_DATA_CLEARED";
ACTION_UID_REMOVED = "android.intent.action.UID_REMOVED";
ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED";
ACTION_CONFIGURATION_CHANGED = "android.intent.action.CONFIGURATION_CHANGED";
ACTION_LOCALE_CHANGED = "android.intent.action.LOCALE_CHANGED";
ACTION_BATTERY_CHANGED = "android.intent.action.BATTERY_CHANGED";
ACTION_BATTERY_LOW = "android.intent.action.BATTERY_LOW";
ACTION_BATTERY_OKAY = "android.intent.action.BATTERY_OKAY";
ACTION_POWER_CONNECTED = "android.intent.action.ACTION_POWER_CONNECTED";
ACTION_POWER_DISCONNECTED = "android.intent.action.ACTION_POWER_DISCONNECTED";
ACTION_SHUTDOWN = "android.intent.action.ACTION_SHUTDOWN";
ACTION_DEVICE_STORAGE_LOW = "android.intent.action.DEVICE_STORAGE_LOW";
ACTION_DEVICE_STORAGE_OK = "android.intent.action.DEVICE_STORAGE_OK";
ACTION_MANAGE_PACKAGE_STORAGE = "android.intent.action.MANAGE_PACKAGE_STORAGE";
ACTION_UMS_CONNECTED = "android.intent.action.UMS_CONNECTED";
ACTION_UMS_DISCONNECTED = "android.intent.action.UMS_DISCONNECTED";
ACTION_MEDIA_REMOVED = "android.intent.action.MEDIA_REMOVED";
ACTION_MEDIA_UNMOUNTED = "android.intent.action.MEDIA_UNMOUNTED";
ACTION_MEDIA_CHECKING = "android.intent.action.MEDIA_CHECKING";
ACTION_MEDIA_NOFS = "android.intent.action.MEDIA_NOFS";
ACTION_MEDIA_MOUNTED = "android.intent.action.MEDIA_MOUNTED";
ACTION_MEDIA_SHARED = "android.intent.action.MEDIA_SHARED";
ACTION_MEDIA_BAD_REMOVAL = "android.intent.action.MEDIA_BAD_REMOVAL";
ACTION_MEDIA_UNMOUNTABLE = "android.intent.action.MEDIA_UNMOUNTABLE";
ACTION_MEDIA_EJECT = "android.intent.action.MEDIA_EJECT";
ACTION_MEDIA_SCANNER_STARTED = "android.intent.action.MEDIA_SCANNER_STARTED";
ACTION_MEDIA_SCANNER_FINISHED = "android.intent.action.MEDIA_SCANNER_FINISHED";
ACTION_MEDIA_SCANNER_SCAN_FILE = "android.intent.action.MEDIA_SCANNER_SCAN_FILE";
ACTION_MEDIA_BUTTON = "android.intent.action.MEDIA_BUTTON";
ACTION_CAMERA_BUTTON = "android.intent.action.CAMERA_BUTTON";
ACTION_GTALK_SERVICE_CONNECTED = "android.intent.action.GTALK_CONNECTED";
ACTION_GTALK_SERVICE_DISCONNECTED = "android.intent.action.GTALK_DISCONNECTED";
ACTION_INPUT_METHOD_CHANGED = "android.intent.action.INPUT_METHOD_CHANGED";
ACTION_AIRPLANE_MODE_CHANGED = "android.intent.action.AIRPLANE_MODE";
ACTION_PROVIDER_CHANGED = "android.intent.action.PROVIDER_CHANGED";
ACTION_HEADSET_PLUG = "android.intent.action.HEADSET_PLUG";
ACTION_NEW_OUTGOING_CALL = "android.intent.action.NEW_OUTGOING_CALL";
ACTION_REBOOT = "android.intent.action.REBOOT";
ACTION_DOCK_EVENT = "android.intent.action.DOCK_EVENT";
Data
  • 작업 요청 URI
  • 종류 1 : scheme, authority, path
  • 예) weather://com.msi.manning/loc?zip=12345
  • 종류 2 : MIME 형식, Content Provider와 연계됨
  • 예) content://com.google.provider.NotePad/notes
  • Scheme가 있고 Type이 없으면, 모든 Type이 매핑됨
  • Scheme가 없고 Type이 있으면, 모든 Scheme가 매핑됨
  • Scheme가 없고 Type이 없으면, 매핑되지 않음
Type
  • MIME 타입
Component 
Extras
  • 추가 데이터, Bundle
  • 인텐트 선언
  • 명시적 선언 : new Intent(Context packageContext, Class cls)
  • 묵시적 선언 : new Intent(String action, Uri uri)
  • 인텐트 핸들러
Activity
  • android.content.Context.startActivity(Intent intent)
Service
  • android.content.Context.startService(Intent intent)
  • android.content.Context.bindService(Intent intent, ServiceConnection serviceconnection, int i)
BroadcastReceiver
  • android.content.Context.sendBroadcast(Intent intent)
  • android.content.Context.sendStickyBroadcast(Intent intent)
  • android.content.Context.sendOrderedBroadcast(Intent intent, String receiverPermission)
  • android.content.BroadcastReceiver.onReceive(Context context, Intent intent)
  • IntentFilter
  • AndroidManifest.xml
Intent intent = new Intent(Constants.INTENT_ACTION_VIEW_LIST);
startActivity(intent);

<activity android:name="ReviewList"> 또는 <service> 또는 <receiver>
    <intent-filter>
        <category android:name="android.intent.category.DEFAULT" />
        <action   android:name="com.msi.manning.restaurant.VIEW_LIST" />
        <data     android:scheme="weather" android:host="com.msi.manning" />
    </intent-filter>
</activity>

댓글 없음:

댓글 쓰기