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
For
String activity="com.namespace.MainActivity";
This will do:
private void openActivity(String activity, Context context) {
try {
Class cls = Class.forName(activity);
Intent intent = new Intent(context, cls);
context.startActivity(intent);
} catch (ClassNotFoundException e) {
Log.e(TAG,"Class was not found"+ e.getLocalizedMessage());
}catch (Exception e){
Log.e(TAG,"Error occurred"+ e.getLocalizedMessage());
}
}