Monday, May 14, 2012

splash screen gets error when going to the main activity

My splash screen gets error and it is going to force close the app. in Logcat is says Permission Denied. What should i do to fix this problem. Can anyone help me with that matter, Thanks a lot



import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;

public class SplashScreen extends Activity {
protected boolean _active = true;
protected int _splashTime = 4000;

/** Called when the activity is first created. */
@Override
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();
startActivity(new Intent("com.droidnova.android.splashscreen.BodyPartsGameActivity"));
stop();
}
}
};
splashTread.start();
}

@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
_active = false;
}
return true;
}
}




No comments:

Post a Comment