sms2000
03-14-2011, 04:32 AM
Hi everyone!
I'm new to this forum and a newbie in Android development.
I have a couple of questions regarding Activities.
AFAIK the common method to activate an activity is like this:
Intent intent = new Intent(this, NewActivity.class);
startActivity(intent);
But if I have say 100 different activities and need to programmically decide which to run I'd prefer to have some more generic code like:
String act_str = String.format ("Activity%03d", 123);
Class act_class = ConvertStringToActivityClass (act_str);
Intent intent = new Intent(this, act_class);
startActivity(intent);
How can I implement such a function "ConvertStringToActivityClass" ?
And one more question if you please.
How can I enumerate all the activities specified in the Manifest file (with parameters preferably)?
Thank in advance.
I'm new to this forum and a newbie in Android development.
I have a couple of questions regarding Activities.
AFAIK the common method to activate an activity is like this:
Intent intent = new Intent(this, NewActivity.class);
startActivity(intent);
But if I have say 100 different activities and need to programmically decide which to run I'd prefer to have some more generic code like:
String act_str = String.format ("Activity%03d", 123);
Class act_class = ConvertStringToActivityClass (act_str);
Intent intent = new Intent(this, act_class);
startActivity(intent);
How can I implement such a function "ConvertStringToActivityClass" ?
And one more question if you please.
How can I enumerate all the activities specified in the Manifest file (with parameters preferably)?
Thank in advance.