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
Edited: added variable activity class.
You would set the variables on the intent as extras in the intent. You can easily pass the class name into your intent. So you could say:
Class activityClass = Login.class; // This could be passed in as a variable.
Intent i;
i = new Intent(Favorites.this, activityClass); --> login.class with var
i.putExtra("var1", "Login");
i.putExtra("var2", "Signup");
i.putExtra("var2", "more");
startActivity(i);
Here is an example
You can also put the variables in a bundle and pass the entire bundle as extras as follows:
Class activityClass = Login.class;
Intent i;
i = new Intent(Favorites.this, activityClass); --> login.class with var
Bundle bundle = new Bundle();
bundle.putString("var1", "Login");
bundle.putString("var2", "Signup");
bundle.putString("var2", "more");
i.putExtras(bundle);
startActivity(i);