Mac Mittereder
Mac Mittereder

Reputation: 21

my Intent isn't working for android

so i am trying to switch views using Intents, I've been able to get this working before but now it just keeps closing, this is also through the menu button, heres my menu code:

public boolean onCreateOptionsMenu(android.view.Menu menu) {
    super.onCreateOptionsMenu(menu);
    MenuInflater blowUp = getMenuInflater();
    blowUp.inflate(R.menu.menu, menu);
    return true;
}
public boolean onOptionsItemSelected(MenuItem item){
    switch(item.getItemId()){
    case R.id.stats:
            Intent i = new Intent("com.mittereder.rockpaper.STATS");
            startActivity(i);
        break;
    }
    return false;
}

this is my menu that contains that item:

    <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/stats"
        android:alphabeticShortcut="s"
        android:title="Stats"/>

</menu>

then here is my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mittereder.rockpaper"
    android:versionCode="2"
    android:versionName="1.2" >

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

    <application
        android:icon="@drawable/stop"
        android:label="@string/app_name" >
        <activity
            android:name=".start"
            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=".stats"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.mittereder.rockpaper.STATS" />

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

</manifest>

I checked my code over and over and I don't know what I'm missing.

LogCat:

08-09 11:51:11.471: E/AndroidRuntime(13384): FATAL EXCEPTION: main
08-09 11:51:11.471: E/AndroidRuntime(13384): android.app.SuperNotCalledException: Activity {com.mittereder.rockpaper/com.mittereder.rockpaper.start} did not call through to super.onPause()
08-09 11:51:11.471: E/AndroidRuntime(13384):    at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3103)
08-09 11:51:11.471: E/AndroidRuntime(13384):    at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3062)
08-09 11:51:11.471: E/AndroidRuntime(13384):    at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3035)
08-09 11:51:11.471: E/AndroidRuntime(13384):    at android.app.ActivityThread.access$800(ActivityThread.java:139)
08-09 11:51:11.471: E/AndroidRuntime(13384):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1268)
08-09 11:51:11.471: E/AndroidRuntime(13384):    at android.os.Handler.dispatchMessage(Handler.java:99)
08-09 11:51:11.471: E/AndroidRuntime(13384):    at android.os.Looper.loop(Looper.java:154)
08-09 11:51:11.471: E/AndroidRuntime(13384):    at android.app.ActivityThread.main(ActivityThread.java:4945)
08-09 11:51:11.471: E/AndroidRuntime(13384):    at java.lang.reflect.Method.invokeNative(Native Method)
08-09 11:51:11.471: E/AndroidRuntime(13384):    at java.lang.reflect.Method.invoke(Method.java:511)
08-09 11:51:11.471: E/AndroidRuntime(13384):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-09 11:51:11.471: E/AndroidRuntime(13384):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-09 11:51:11.471: E/AndroidRuntime(13384):    at dalvik.system.NativeStart.main(Native Method)

Upvotes: 0

Views: 251

Answers (1)

QuinnVT
QuinnVT

Reputation: 191

Looks like your Start Activity overrides onPause and doesn't call the super class. The onPause is called on the start activity before the stat activity is launched.

Upvotes: 2

Related Questions