• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps What's wrong with my code?

bckc

Lurker
Hi guys,

Can someone please tell me what I've done wrong here?:

Manifest snippet:
Code:
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".Splash"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.bradley.appname.Splash" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
      <activity
            android:name=".mainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.bradley.appname.MainActivity" />

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

My java snippet:
Code:
        Thread timer = new Thread(){
            
            public void run(){
                
                try{
                    sleep(4000);        
                }catch(InterruptedException e){
                    e.printStackTrace();
                }finally{
                    Intent openMain = new Intent("com.bradley.appname.MainActivity");

                    startActivity(openMain);
                }
                
            }
        };
        timer.start();

When the splashscreen starts it waits 4 seconds then says "app name has been forced to close"

Bckc
 
In this cases you just need to look at the LOGCAT and see what went wrong...

In you case, Android can't find MainActivity, this is the correct syntax.

Intent openMain = new Intent(context, MainActivity.class);
 
Back
Top Bottom