Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Issues starting the correct activity?

Ok guys I'm super new at this, so bear with me...I'm basically reading a book on Android development, and following a tutorial in it.

This app has 7 activities (1 called QuizActivity that extends Activity, and 6 others that extend QuizActivity - 1 of which is QuizSplashActivity, the one I want to launch on startup)

However, I'm super confused as to why the default activity doesn't seem to be launching. My manifest has the correct tags for QuizSplashActivity, and QuizSplashActivity points to the correct .xml layout file I created. When I run the program, however, the console says:

[2013-03-11 17:19:47 - BeenThereDoneThat] Starting activity com.example.beentheredonethat.QuizActivity on device emulator-5554

[2013-03-11 17:19:48 - BeenThereDoneThat] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.beentheredonethat/.QuizActivity }

Here is the application section of the manifest:

 <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="QuizSplashActivity"
            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="QuizActivity"></activity>
        <activity android:name="QuizGameActivity"></activity>
        <activity android:name="QuizHelpActivity"></activity>
        <activity android:name="QuizMenuActivity"></activity>
        <activity android:name="QuizScoresActivity"></activity>
        <activity android:name="QuizSettingsActivity"></activity>
    </application>

And here is my QuizSplashActivity, that I want to show on startup:

package com.example.beentheredonethat;

import android.os.Bundle;
import android.view.Menu;


public class QuizSplashActivity extends QuizActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_quiz, menu);
        return true;
    }


}

Any ideas as to why this is doing this? Any help would be greatly appreciated. Thanks!

like image 603
Dave Avatar asked Nov 13 '22 09:11

Dave


1 Answers

I think that problem is your in manifest in declaring Activities. You are missing dot before Activity name:

android:name=".QuizSplashActivity"

and compilator can't find your Activity. Try to fix it and it should works. Also try to clean your project, restart Eclipse and try to start app again.

like image 93
Simon Dorociak Avatar answered Nov 15 '22 12:11

Simon Dorociak