Sunday, February 16, 2014

Welcome screen is not displayed when the program starts, help ~


This is my welcome screen ACTIVITY, 5 seconds
public class LoginActivity extends Activity {

protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);

getWindow (). setFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

/ ** The title is part of View, so part of the window after all the modifications are hidden title is still valid * /
requestWindowFeature (Window.FEATURE_NO_TITLE);
setContentView (R.layout.login);
mHandler.sendEmptyMessageAtTime (GOTO_MAIN_ACTIVITY, 5000) ;/ / 3 sec skip
}

private static final int GOTO_MAIN_ACTIVITY = 0;
private Handler mHandler = new Handler () {

public void handleMessage (Message msg) {

switch (msg.what) {
case GOTO_MAIN_ACTIVITY:
Intent intent = new Intent ();
intent.setClass (getApplicationContext (), MainActivity.class);
startActivity (intent);
finish ();
break;

default:
break;
}

}

};

}

This is my welcome screen XML file

android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: orientation = "vertical">

android: id = "@ + id / iv"
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: scaleType = "fitCenter"
android: src = "@ drawable / ic_launcher" />


<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Use sendEmptyMessageDelay approach to sub it. Haha

No comments:

Post a Comment