Android 从另一个包调用活动

Android 从另一个包调用活动,android,view,android-activity,Android,View,Android Activity,我在com.qz.launchFoneClayaActivity包中有一个活动。我需要在com.qz.Test包中启动一个活动。我尝试设置组件并使用SetClass,但没有任何帮助…下面是我的com.qz.launchFoneClayaActivity清单 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"

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

<?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> 

......................

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

Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setComponent(new ComponentName("com.qz.test",
                            "com.qz.test.StartUpActivity"));
startActivity(intent);

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

Intent start = new Intent(this,<target_class_name>);
startActivity(start);
Intent start=新的Intent(这个,);
起始触觉;

你想用该活动启动你的应用程序,还是只从另一个活动启动该活动?除了这些xml文件外,你还可以显示你的代码,在其中尝试从另一个活动启动该活动。我做了这个Intent oIntent=new Intent(Intent.ACTION\u MAIN);setComponent(新组件名(“com.qz.test”、“com.qz.test.StartUpActivity”);但是,当我在startActivity(ointent)之后调试时,我没有在oncreate of StartUpActivity中获得dubbger。@user1340801:因为您没有在StartUpActivity中添加,所以请在StartUpActivity manifast文件@ρ∑ѕρєK中添加此文件后再试一次:我甚至尝试过如下。。Intent OINT=新的意图(Intent.ACTION\u视图);setComponent(newComponentName(“com.qz.Foneclay”、“com.qz.Foneclay.StartUpActivity”);NoPE我没有得到任何错误…这个激活正在执行……考虑发射活动是一个简单的Hello World…然后IM在电话屏幕上获得Hello World,但是我没有在启动的OnCube中得到activity@user1340801:平均activity正在启动,但您是说activity onCreate未执行?