2016-07-21 4 views
1

:차이의 차이점은 무엇

<intent-filter> 
    <action android:name="android.intent.action.MAIN" /> 
    <category android:name="android.intent.category.HOME"/> 
</intent-filter> 

과 :

<intent-filter> 
    <action android:name="android.intent.action.MAIN" /> 
    <category android:name="android.intent.category.HOME"/> 
    <category android:name="android.intent.category.DEFAULT"/> 
</intent-filter> 
+0

가능한 복제본 http://stackoverflow.com/questions/5727828/what-is-the-purpose-of-android-intent-category-default – Bobby

답변

1

여기에 대답

What is the meaning of android.intent.action.MAIN?

를 참조하십시오

android.intent.action.MAIN은이 활동이 애플리케이션의 시작점임을 의미합니다. 즉, 애플리케이션을 실행하면이 활동이 생성됩니다. 가 데이터를 수신 할

또한 docs

ACTION_MAIN with category CATEGORY_HOME -- Launch the home screen. 

에서

, 주 진입 점으로 here

활동 작업 시작에서는 기대하지 않습니다.

android.intent.category.DEFAULT는 주로 암시 적 인 텐트에 사용됩니다. 귀하의 활동이 암묵적인 의도에 의해 시작되기를 희망하는 경우, 그 필터에이 카테터를 포함시켜야합니다. 특정 카테고리가 지정되지 않은 상태에서 암시 적 인 텐트에 의해 활동이 시작될 수있는 경우 해당 인 텐트 필터에이 카테고리가 포함되어야합니다.

해당 문서를 참조하십시오 ..

  1. http://developer.android.com/reference/android/content/Intent.html
  2. http://developer.android.com/guide/topics/manifest/action-element.html

및 @CommonsWare의 또 다른보기 .... 또한 대답에 .... 그것을

를 참조하십시오 따라서 ACTION_MAIN은 응용 프로그램의 진입 점으로 간주됩니다.

일반적으로 에는 CATEGORY_LAUNCHER과 결합되어 홈 화면의 실행 프로그램이나 실행기로 간주되는 활동을 나타냅니다. 이러한 "실행 프로그램"은 queryIntentActivities()을 사용하여 PackageManager을 쿼리하여 그러한 활동을 찾아 사용자에게 표시 할 수 있습니다.

그러나 ACTION_MAIN은 다른 특수한 목적으로 다른 범주와 함께 사용할 수 있습니다. 예를 들어 CATEGORY_CAR_DOCKACTION_MAIN은 사용자가 제조업체가 제공 한 차량 도크에 전화기를 떨어 뜨릴 때 표시 할 후보로 간주되어야하는 활동을 나타냅니다.

Intent 이미 카테고리에 배치되지 않은 경우 IntentstartActivity() 함께 사용

, 그것은 CATEGORY_DEFAULT에 배치된다. 따라서 <activity><intent-filter>일부는<category>으로 지정해야합니다. 다른 경우는 <category android:name="android.intent.category.DEFAULT" />을 사용해야합니다.

관련 문제