Monday, May 1, 2017

Making of 8 or Bust ---- a Mathematical Puzzle

Splash Screen

Android games in the native platform are built using Java using Android SDK. I used IDE Android Studio for developing 8 Or Bust. Android Studio on the creation of a project create a default app folder and build tool used is Gradle. 
Now, the first screen of almost all apps is a splash screen which is shown for few seconds and then the main screen appears.
 public class MainActivity extends BaseActivity {
         private static final int splash_time = 30;
            protected void onCreate(Bundle savedInstanceState) {
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |               

           public void onWindowFocusChanged(boolean hasFocus) {

            if (!hasFocus || animationStarted) {

             new SplashTask().execute();


          public void onNewIntent(Intent intent) {

         public void onStop() {


        private class SplashTask extends AsyncTask {
            protected Void doInBackground(Void... params) {
                try {

                   Thread.sleep(splash_time); /// show splash screen for 
                } catch (InterruptedException e) {
                return null;

            protected void onPostExecute(Void result) {
                startNextActivity(); // then move over to next screen 


         private void startNextActivity() {
             BaseUtility.startNextActivity(this, LoginActivity.class);


     public static void startNextActivity(Activity activity,Class className){
         Intent intent = new Intent(activity,className);
         activity.overridePendingTransition(android.R.anim.slide_in_left,                   android.R.anim.slide_out_right);

This splash screen after showing for 30ms loads the next Screen -- Login.

No comments:

Post a Comment