I have a function for opening a new activity, but I wan’t to use a string for that. My function is shown below. I think my question is clear if you see that.
public boolean showScreen(String screen) {
Intent intent = new Intent(this, screen.class);
startActivity(intent);
return true;
}
EDIT:// The error is gone if I use try and catch. My system works fine now.
You should use Class.forName(String s) to get the Class for the specific string.
Code:
Hope this helps!