I had a fully functional app, if you could call a hello world fully functional.
Had 3 tabs, each did something, and a splash would come up before it.
I think I made the mistake of trying to use google api to get some gps stuff going on and somehow managed to bork my project and the backup versions. so right now I’m just trying to peice it all back together before I email it to my lecturer.
QUESTION: When setting run configuration to launch the splash, I get a load of errors as the splash finishes. I’m a complete novice so I don’t know what part of whats left of my code is wrong. I suspect its either the manifest or the splash code intent pointer thingy.
logcat
10-24 05:28:08.297: D/dalvikvm(612): GC_EXTERNAL_ALLOC freed 673 objects / 52920 bytes in 136ms
10-24 05:28:13.185: W/dalvikvm(612): threadid=7: thread exiting with uncaught exception (group=0x4001d800)
10-24 05:28:13.195: E/AndroidRuntime(612): FATAL EXCEPTION: Thread-8
10-24 05:28:13.195: E/AndroidRuntime(612): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.b00517566.helloworldfinal/com.b00517566.helloworld.HelloWorldfinalActivity}; have you declared this activity in your AndroidManifest.xml?
10-24 05:28:13.195: E/AndroidRuntime(612): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
10-24 05:28:13.195: E/AndroidRuntime(612): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
10-24 05:28:13.195: E/AndroidRuntime(612): at android.app.Activity.startActivityForResult(Activity.java:2817)
10-24 05:28:13.195: E/AndroidRuntime(612): at android.app.Activity.startActivity(Activity.java:2923)
10-24 05:28:13.195: E/AndroidRuntime(612): at com.b00517566.helloworldfinal.splash$1.run(splash.java:37)
manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.b00517566.helloworldfinal"
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:label="@string/app_name"
android:name=".HelloWorldFinalActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="splash"> <intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter></activity>
<activity android:name="ButtonTab">
<intent-filter></intent-filter>
</activity>
<activity android:name="MiscTab">
<intent-filter></intent-filter>
</activity>
<activity android:name="RadioBtnsTab">
<intent-filter></intent-filter>
</activity>
</application>
</manifest>
splash
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
// thread for displaying the SplashScreen
Thread splashTread = new Thread() {
@Override
public void run() {
try {
int waited = 0;
while(_active && (waited < _splashTime)) {
sleep(100);
if(_active) {
waited += 100;
}
}
} catch(InterruptedException e) {
// do nothing
} finally {
finish();
Intent i = new Intent();
i.setClassName("com.b00517566.helloworldfinal",
"com.b00517566.helloworld.HelloWorldfinalActivity");
startActivity(i);
//startActivity(new Intent("com528.b00517566.helloworld"));
// stop();
}
}
};
splashTread.start();
}
The error says that it cannot find “HelloWorldfinalActivity” and your manifest defines “HelloWorldFinalActivity” – lowercase f in the first case, uppercase F in the second.
Your activity names in the manifest should be the same as the class names that you give your activity with a ‘.’ before them. For instance, if you have a HelloWorldFinalActivity.class then the name in the manifest should be “.HelloWorldFinalActivity”.
Also, there’s a more straightforward way to start an activity:
Replace CurrentActivityName with the name of the class this this code is in.