user1106464
user1106464

Reputation: 111

Giving an id to each acitivity of each application in Android

My problem is: I would give a unique ID to each activity for each existing (noy only active one) application on the android phone. Have you any idea how? (sorry for my English im French...)

Upvotes: 0

Views: 51

Answers (2)

Uriel Frankel
Uriel Frankel

Reputation: 14622

As Dheeraj said: "You probably meant the ComponentName". ComponentName is:

Identifier for a specific application component (Activity, Service, BroadcastReceiver, or ContentProvider) that is available. Two pieces of information, encapsulated here, are required to identify a component: the package (a String) it exists in, and the class (a String) name inside of that package.

Now, you can create an object that contains Package name(unique to the application) + class name (unique to activity). So the credit goes to Dheeraj.

Upvotes: 1

mtmurdock
mtmurdock

Reputation: 13062

If your goal is to start an Activity, then you can do this:

Intent i = new Intent(context, MyActivity.class);
startActivity(i);

Upvotes: 1

Related Questions