CodeSolution

Please wait...

Creating Splash Screen Page Using Two Activities?

@Flash-Screen   @ Handler   @ post-Delayed-Method   @ Full-Screen-Activity   

First Create New Project:)

  • After That Create New Activity In Your Project.
  • After That, We Have To Use MainActivity.java code And Create This Code.
  • First Create Handler Object.
Handler handler=New Handler();
  • After We Have To Use post Delayed Method.
handler.postDelayed(new Runnable()
  • After That, we Have To Set The Time.
handler.postDelayed(new Runnable() {
            @Override
            public void run()
            {
                Intent intent=new Intent(MainActivity.this,HomePage.class);
                startActivity(intent);
            }
        },1000);
  • After That, We Have To Use Intent Method For Moving One Activity To Second Activity
public void run()
            {
                Intent intent=new Intent(MainActivity.this,HomePage.class);
                startActivity(intent);
            }
        },1000);
  • After That If You Want To Use Full-Screen Activity So You Can Use This Code In MainActivity.java Code.
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activit?y_main);

The MainActivity.java  All codes Are.

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_main);
        Handler handler=new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run()
            {
                Intent intent=new Intent(MainActivity.this,HomePage.class);
                startActivity(intent);
            }
        },1000);
     }
}

Comments 0

Reply