how to use variable while calling new activity in intent?

后端 未结 7 1530
失恋的感觉
失恋的感觉 2021-01-22 01:08

i have following code to call new activity

now i want to use variable to call new activity

String var1,var2,var3; var1=\"Login\"; var2=\"Signup\"; var3=\"more

相关标签:
7条回答
  • 2021-01-22 02:03

    You can start an intent using a variable, like this

    Intent intent = new Intent();
    String packageName = "my.package"; 
    String className = "com.package.MyActivity";
    intent.setClassName(packageName, className);
    startActivity(intent);
    
    0 讨论(0)
提交回复
热议问题