How to navigate from one screen to another screen

前端 未结 16 1456
失恋的感觉
失恋的感觉 2020-11-29 04:31

How to navigate from one Activity screen to another Activity screen? In the first screen I\'m having one button if I click the button it has to move to another Activity scre

16条回答
  •  执笔经年
    2020-11-29 05:01

    Button navigate;
    navigate = findViewById(R.id.button);
    navigate.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(getApplicationContext(),"Navigate another Activity",Toast.LENGTH_LONG).show();
                    Intent intent = new Intent(MainActivity.this,MainActivity2.class);
                    startActivity(intent);
                }
            });
    

提交回复
热议问题