Start Android activity from list of activities -
i working on 1 android app, , in have 1 menu shows list of activity name.upon clicking of item menu should start specific activity.
one way know is,
string classes[]= {"firstactivity","detailactivity"}; intent =new intent(pkg_name+classes[position]);startactivity(i);
where position=0 or 1. , need write in androidmanifest.xml file below code each activity
<activity android:name="com.example.day1.detailactivity" > <intent-filter> <action android:name="com.example.day1.detailactivity" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity>
but want
<activity android:name=".detailactivity"></activity>
simple code. dont want use intent-filter please give me alternative can use in case.
or other way round
class classes[] = [ firstactivity.class, detailactivity.class]; intent = new intent(this, classes[position]); startactivity(i);
then, when want display name of activities, use classes[position].getsimplename();
Comments
Post a Comment