In Android development, find the activity that corresponds to the current interface, with the following steps:
- Create a new baseactivity to inherit from activity, and then rewrite the OnCreate () method in Baseactivity, using the GetClass (). Getsimplename () to get the class name of the current instance and print it through log. The code is as follows:
Public class extends Activity { protectedvoid onCreate (Bundle savedinstancestate) { Super. OnCreate (savedinstancestate); LOG.D ("Baseactivity", GetClass (). Getsimplename ());} }
- Change all activity in the project to inherit from Baseactivity, so that when the program enters any interface during the run (that is, when the OnCreate () method is executed), the current activity name is printed in Logcat. This allows us to know the relationship between the interface and the activity.
"First line of Android" Reading notes: Find the activity that corresponds to the current interface