Reputation: 2574
Recently I have come across the following syntax in Android:
Intent i = new Intent(getApplicationContext(), SomeActivityClass.class);
Could someone please explain what happens when SomeActivityClass.class
is called?
Upvotes: 1
Views: 196
Reputation: 137272
class
is a static class field of each class, of type Class<?>
which represents the type of that specific class. It is often used for instantiating a class by reflection (as in the intent case).
i.e. - after:
Class<?> clazz = SomeActivityClass.class;
clazz
will refer to an object of type Class<?>
that represents the SomeActivityClass
class.
Links:
Upvotes: 5
Reputation: 8764
When the Intent
is invoked, it starts the SomeActivityClass
Activity
the same as any other Activity
. ie, calls onCreate()
, then onStart()
, etc.
Refer to the flowchart diagram in the Activity
documentation here...
Or see the Activity documentation here... http://developer.android.com/reference/android/app/Activity.html
Upvotes: 1