Start Another Activity from onCreate() in MainActvity?

后端 未结 5 582
终归单人心
终归单人心 2021-01-18 03:24

The problem I am having is that the onCreate() method within my MainActivity cannot seem to start another activity.

I have code working so that when I click a button

5条回答
  •  忘掉有多难
    2021-01-18 03:31

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);    
    setContentView(R.layout.activity_main);
    
    // Fire the intent that launches the "About" screen.
    Intent i= new Intent(this, AboutActivity.class);
    startActivity(i);
    

提交回复
热议问题