0

我在 com.qz.launchfoneclayactivity 包中有一个活动。我需要在 com.qz.Test 包中启动一个活动。我尝试设置组件并使用 SetClass 也没有帮助...下面是我的 com.qz.launchfoneclayactivity 清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.qz.launchfoneclayactivity"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

         <activity android:name="com.x.test.StartUpActivity" />// This is the Activity name in another package
        <activity
            android:name="com.qz.launchfoneclayactivity.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>
    </application>

</manifest>

以下是我的第二个包裹清单的一部分

<?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.qz.test" 
    android:versionCode="xx" 
    android:versionName="x.x.x">
    ......................


<activity android:name=".StartUpActivity"
            android:launchMode="singleTop" 
            android:excludeFromRecents="true"
            android:configChanges="orientation|screenSize|keyboardHidden"                   
            android:theme="@android:style/Theme.Translucent.NoTitleBar" >                        
            <intent-filter>                        
                <action android:name="android.intent.action.VIEW" />                        
            </intent-filter>                              
            </activity> 
4

2 回答 2

1

尝试从您的应用程序打开 android 应用程序活动:

Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setComponent(new ComponentName("com.qz.test",
                            "com.qz.test.StartUpActivity"));
startActivity(intent);
于 2013-01-08T06:00:43.627 回答
0

如果包属于不同的应用程序,请android:exported在清单文件中标记活动。然后外部包可以使用带有完整类名的 Intent 来启动它。

Intent start = new Intent(this,<target_class_name>);
startActivity(start);
于 2013-01-08T06:15:25.580 回答