I have the String names of the classes in an ArrayList.
If i try to call the Intent like this:
Intent intent = new Intent(context, MultipleChoice.class);
context.startActivity(intent);
It works without problems, but when i wanna do it like this, i get a ClassFoundException.
In config.getTests(config.getPage())) i get "MultipleChoice" returned.
try {
Intent intent = new Intent(context, Class.forName(config.getTests(config.getPage())));
context.startActivity(intent);
context.finish();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Why is it like this?
I think
config.getTests(....)should class name with package, for examplecom.xyz.MultipleChoice. You may try hardcoding this inClass.forName(..)first. If it works, then you can find a way to get it fromconfig.getTest(....)