2012-11-15 3 views
0

내가 멍청하다.다른 의도의 실행 프로그램에 대한 활동 의도 - 필터 작업 이름

"com.exampleone.a"및 "com.exampletwo.b"라고하는 다른 패키지의 두 가지 활동이 있습니다. 그들은 같은 프로젝트하에 있습니다.

인해 효율성 이유로 하나의 매니페스트 XML로

는, 나는 다른 활동에 의도 필터, 즉 패키지와 "com.exampleone"같은

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
      package="com.exampleone" 
      ....../> 

를 선언 선택했습니다 내가 ... 사용하는 내가, 내가 사용하는 거라고 com.exampletwo.b을 가고 싶어 내 프로그램에 그래서

<intent-filter> 
    <action android:name="com.exampletwo.b" /> 
    <category android:name="android.intent.category.DEFAULT" /> 
</intent-filter> 

...

Intent myIntent = new Intent("com.exampletwo.b"); 
startActivity(myIntent); 

필자는 (예, 인생) 그런데 결국 "com.exampletwo.b"활동을 실행 프로그램으로 사용해야한다고 결정했습니다. 그래서 나는 (그것이 '찾을 수 없음 런처 활동'오류를 제공) 작동하지 않는 ... ... 실행기로 변경하고

<intent-filter> 
    <action android:name="com.exampletwo.b" /> 
    <category android:name="android.intent.category.LAUNCHER" /> 
</intent-filter> 

을 시도했다. 그리고

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

... 나는 문제가이 활동을 언급이 것 때문에 (프로젝트 전반에 걸쳐 내가 사용하고 있습니다

"com.exampletwo.b ... 등의 조치 이름을 바꿀 수 없습니다 "내 의도에 대해).

런처를 작동시킬 수있는 방법이 있습니까? 이름을 바꾸지 않고도 가능합니까?

나는 더미 런처 활동을 생성하여이 작업을 수행 할 수 있다고 생각했지만,이 작업을 수행하는 더 쉬운 방법이 있습니까?

답변

0

왜 활동을 시작하지 않으시겠습니까? 시작하려는 다른 활동을 선택할 수 있습니다. LauncherActivity, FromOnePackageAct, FromTwoPackageAct와 같은 것입니다. 다음 LauncherActivity에서 다른 이동할 수 있습니다

public class LauncherActivity... 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    Intent intent = new Intent(this, FromOnePackageAct.class);//here´s the trick 
    from.startActivity(intent); 
// from.finish(); this is optional 

희망이

:-) 당신에게 아이디어를 제공 할 수 있습니다
관련 문제