I have following code.
public class SplashScreen extends Activity {
private int _splashTime = 5000;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
new Handler().postDelayed(new Thread(){
@Override
public void run(){
Intent mainMenu = new Intent(SplashScreen.this, MainMenu.class);
SplashScreen.this.startActivity(mainMenu);
SplashScreen.this.finish();
overridePendingTransition(R.drawable.fadein, R.drawable.fadeout);
}
}, _splashTime);
}
}
I have problem in analyze of this code. As far as know handler is running in main thread. but it has thread which is running in other thread.
MainMenu.class will be run in main thread or second thread?
if main thread is stopped for 5 seconds ANR will be raise. Why when I am stopping it with delay (_splashTime)
ANR doesn't display (even if i increase it to more than 5 seconds)