On Android, how do you switch activities programmatically?

前端 未结 8 929
盖世英雄少女心
盖世英雄少女心 2020-12-01 06:29

It seems like every example I can find of switching between activities involves creating an Intent and passing in the context of a View via an OnClickListener associated wit

8条回答
  •  余生分开走
    2020-12-01 06:47

    This should do it for you:

    Intent myIntent = new Intent(this, MyActivityName.class);
    startActivity(myIntent);
    

    You can call that from anywhere in your current activity.

提交回复
热议问题