Home > Mobile >  The Activity in the memory and normal Java class instances are the same?
The Activity in the memory and normal Java class instances are the same?

Time:12-03

Activity without new methods, whether to start the Activity after the system automatically out a new instance of the Activity?

It in the memory and common Java class instances are the same?

CodePudding user response:

He is through reflection created, essentially the same as new

CodePudding user response:

See ActivityThread performLaunchActivity method, in which generate the activity code is
 activity=mInstrumentation. NewActivity (cl, component getClassName (), r.i ntent); 

Generate the Activity point in can see
 
Public Activity newActivity (this cl, String className,
Intent Intent)
Throws InstantiationException IllegalAccessException,
ClassNotFoundException {
Return (Activity) cl. LoadClass (className). NewInstance ();
}
  • Related