Note that there are some explanatory texts on larger screens.

plurals
  1. POexplicit Intent to start new activity automatically after a splash screen
    primarykey
    data
    text
    <p>I am still pretty new to this and I am working on my first app. The problem I am having is this.</p> <p>I have a splash screen that is working fine, but I keep getting an error when it goes to switch to a new activity. I know the problem is in the intent, but I don't know what it is or how to fix it. My code is:</p> <pre><code> splashTread = new Thread() { @Override public void run() { try { synchronized(this){ //wait 5 sec wait(_splashTime); } } catch(InterruptedException e) {} finally { finish(); //start a new activity Intent intent = new Intent(MAIN.this, Home.class); startActivity(intent); stop(); </code></pre> <p>and the cat log is:</p> <pre><code>02-12 13:01:46.009: D/AndroidRuntime(753): Shutting down VM 02-12 13:01:46.009: W/dalvikvm(753): threadid=1: thread exiting with uncaught exception (group=0x4001e560) 02-12 13:01:46.049: E/AndroidRuntime(753): FATAL EXCEPTION: main 02-12 13:01:46.049: E/AndroidRuntime(753): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.madonk.LAFEST/com.madonk.LAFEST.Home}: java.lang.ClassCastException: android.widget.LinearLayout 02-12 13:01:46.049: E/AndroidRuntime(753): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1702) 02-12 13:01:46.049: E/AndroidRuntime(753): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1722) 02-12 13:01:46.049: E/AndroidRuntime(753): at android.app.ActivityThread.access$1500(ActivityThread.java:124) 02-12 13:01:46.049: E/AndroidRuntime(753): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:974) 02-12 13:01:46.049: E/AndroidRuntime(753): at android.os.Handler.dispatchMessage(Handler.java:99) 02-12 13:01:46.049: E/AndroidRuntime(753): at android.os.Looper.loop(Looper.java:130) 02-12 13:01:46.049: E/AndroidRuntime(753): at android.app.ActivityThread.main(ActivityThread.java:3821) 02-12 13:01:46.049: E/AndroidRuntime(753): at java.lang.reflect.Method.invokeNative(Native Method) 02-12 13:01:46.049: E/AndroidRuntime(753): at java.lang.reflect.Method.invoke(Method.java:507) 02-12 13:01:46.049: E/AndroidRuntime(753): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 02-12 13:01:46.049: E/AndroidRuntime(753): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 02-12 13:01:46.049: E/AndroidRuntime(753): at dalvik.system.NativeStart.main(Native Method) 02-12 13:01:46.049: E/AndroidRuntime(753): Caused by: java.lang.ClassCastException: android.widget.LinearLayout 02-12 13:01:46.049: E/AndroidRuntime(753): at android.app.ListActivity.onContentChanged(ListActivity.java:241) 02-12 13:01:46.049: E/AndroidRuntime(753): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256) 02-12 13:01:46.049: E/AndroidRuntime(753): at android.app.Activity.setContentView(Activity.java:1716) 02-12 13:01:46.049: E/AndroidRuntime(753): at com.madonk.LAFEST.Home.onCreate(Home.java:11) 02-12 13:01:46.049: E/AndroidRuntime(753): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 02-12 13:01:46.049: E/AndroidRuntime(753): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1666) 02-12 13:01:46.049: E/AndroidRuntime(753): ... 11 more </code></pre> <p>Home Activity</p> <pre><code>package com.madonk.LAFEST; import android.app.ListActivity; import android.os.Bundle; public class Home extends ListActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload