-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainActivity.java
46 lines (36 loc) · 1.47 KB
/
MainActivity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.example.game;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.os.Bundle;
import android.view.WindowManager;
public class MainActivity extends AppCompatActivity {
private static int SPLASH_SCREEN_TIME_OUT=2000;
//After completion of 2000 ms, the next activity will get started.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
//This method is used so that your splash activity
//can cover the entire screen.
setContentView(R.layout.activity_main);
//this will bind your MainActivity.class file with activity_main.
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(MainActivity.this, Home.class);
//Intent is used to switch from one activity to another.
startActivity(i);
//invoke the SecondActivity.
finish();
//the current activity will get finished.
}
}, SPLASH_SCREEN_TIME_OUT);
}
}