Issue
I have to start activity that makes use of some Variables as the Class Names. Is there a Solution out?
public void something(int position) {
someVar = "MyActivity"+position;
startActivity(new Intent(Main.this,someVar.class));
}
Solution
If there aren't too many activities, you can always do this:
Class myclass;
Switch(position){
case 1:
myclass = Activity1.class;
break;
case 2:
myclass = Activity2.class;
break;
case 3:
myclass = Activity3.class;
break;
}
startActivity(new Intent(Main.this,myclass));
Answered By - frankelot
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.