1

私は2つのクラスを持っています。メイン クラスは BundleActivity で、もう 1 つのサブクラスです。BundleActivity からサブ アクティビティを開始しようとしていますが、機能せず、アプリが強制終了されます。

BundleAcitvity クラスの onClick メソッドは次のとおりです。

public void onClick(View v) {
        // TODO Auto-generated method stub

            Intent i=new Intent(this,sub.class);
            this.startActivity(i);
                            }

私のマニフェストファイル:

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

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
          <activity
            android:name=".BundleActivity"
            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=".sub"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.bundle.sub" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

    </application>

</manifest>

誰かがそれを修正するのを手伝ってくれますか?

4

1 に答える 1

0

サブアクティビティ用のクラスを作成しましたか? 私の知る限り、すべてのクラスは大文字の「Sub」で始まる必要があります。サブ アクティビティにインテント フィルターを配置する必要がなかったかのように感じます。

コンパイル前のエラーは発生していませんか? 実行時のエラー トレースは何ですか?

于 2012-08-26T11:24:25.440 に答える