2013-10-17 2 views
0

나는 어떤 프로젝트를 LibProj이라는 라이브러리로 보유하고 있습니다. 그것은 많은 프로젝트를 가지고 있습니다. MainProj 프로젝트에서 사용하고 싶지만 활동을 찾을 수 없습니다. 오류가 발생했습니다.매니페스트에서 라이브러리 활동 선언을 찾을 수 없음

나는이 단계들을 수행했다.

다음 중 하나가 아래에 나와 있습니다.

Intent intent = new Intent(android.content.Intent.ACTION_VIEW); 
intent.setComponent(new ComponentName("packagename//ex-com.hello", 
            "classname//ex-com.hello.ExampleActivity")); 
startActivity(intent); 

두 번째는 내 MainProj 프로젝트의 매니페스트에 모든 활동 '선언을 추가하는 것입니다.

<application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name="com.example.doocat.MainActivity" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

     <activity 
       android:name=".activity.main.IntroActivity" 
       android:label="@string/app_name" 
       android:screenOrientation="portrait" 
       android:theme="@android:style/Theme.NoTitleBar.Fullscreen" > 
     </activity> 

     <activity 
       android:name=".activity.main.LoginActivity" 
       android:screenOrientation="portrait" 
       android:label="@string/app_name" /> 
     <activity 

등 ... 이러한 방법

모두 작동하지 않습니다. 내가 잘못하고있는 것 또는 해결책은 무엇입니까?

답변

1

내가 전화를해야하는 활동 식별 할 수 의도 필터

com.lib.Example작업 이름을 준 .. MainProject 매니페스트 파일에서 귀하의 도서관 활동을 등록합니다.

<activity 
     android:name="YOUR_LIBRARY_ACTIVITY_PACKAGE. ExampleActivity" 
     android:screenOrientation="portrait"> 
      <intent-filter> 
       <action android:name="com.lib.Example" /> 

       <category android:name="android.intent.category.DEFAULT" /> 
      </intent-filter> 
</activity> 

지금이 도움말을

Intent intent = new Intent("com.lib.Example"); 
try { 
startActivity(intent); 
} catch (ActivityNotFoundException e) { 

} 

희망 당신 MainProject에서 당신을이 활동을 호출합니다.

+0

대단히 감사합니다. 도움이되었습니다. –

+0

@ Sounds Great .. 해피 코딩 .. –

+0

감사합니다. 패키지를 추가하지 않았습니다.)) –

관련 문제