0

I want to create a splash screen that will then move to the login/register screen. My code looks like this:

import android.app.Activity;
import android.content.Intent;

import android.os.Bundle;

public class AssaultTDActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        this.TimeOut();
}

public void TimeOut(){
    long start = System.currentTimeMillis();
    boolean continueloop = true;
    long timenow;

    while (continueloop = true){
        timenow = System.currentTimeMillis();
        if (timenow - start > 5000){
            continueloop = false;
            this.GoToRegister();
        }
    }
}

public void GoToRegister(){
    Intent i = new Intent(AssaultTDActivity.this, register_activity.class);
    startActivity(i);
    finish();
}

import android.app.Activity;

import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;


public class register_activity extends Activity {
     @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.register);

        }
}

and my manifest file is the following:

 <application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity android:screenOrientation="landscape"
        android:label="@string/app_name"
        android:name=".AssaultTDActivity" >
        <intent-filter >
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity class =".register_activity"  
        android:label="Log in" 
        android:screenOrientation="landscape" 
        android:name=".register_activity" >
    </activity>

</application>

So am I doing something wrong here? Also is there a command to "do events" while looping so you dot get stuck in a loop?

James Dunn
  • 8,064
  • 13
  • 53
  • 87
Leon
  • 339
  • 1
  • 7
  • 23

2 Answers2

1

Hopefully this is the issue: looks like you may have had a find/replace mistake, this line in your manifest is wrong:

<uses-Activityk android:minActivitykVersion="8" />

Change it to:

<uses-sdk android:minSdkVersion="8" />
Sam Dozor
  • 40,335
  • 6
  • 42
  • 42
0

Because you added so many activities, it will most likely be fixed if you add:

<category android:name="android.intent.category.DEFAULT" /> 

So your main activity is the default activity and then the Android Launcher wont get tripped up.

    <activity android:name=".MainActivity"
              android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
              android:screenOrientation="portrait"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.DEFAULT" />  
        </intent-filter>
    </activity>

Taken from: http://developer.android.com/reference/android/content/Intent.html

Activities will very often need to support the CATEGORY_DEFAULT so that they can be found by Context.startActivity()

TryTryAgain
  • 7,632
  • 11
  • 46
  • 82