i'm developing an android app but can't seem to get the splash screen to start before the main activity yet on all my other app's this has been no problem
What could be the problem here? There's no problem in the code.
package com.example.soundboardapp;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
public class splash extends Activity {
private long ms = 0;
private long splashTime = 2000;
private boolean splashActive = true;
private boolean paused = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.splash);
Thread mythread = new Thread() {
public void run() {
try {
while (splashActive && ms < splashTime) {
if (!paused)
ms = ms + 100;
sleep(100);
}
} catch (Exception e) {
} finally {
Intent intent = new Intent(splash.this, MainActivity.class);
finish();
startActivity(intent);
}
}
};
mythread.start();
}
}
Theres a splash activity to correspond to the code.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/intro22"
>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center" >
</LinearLayout>
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="184dp" />
</RelativeLayout>
What could be the problem?