android应用程序的入口点 [英] entrypoint of android application

查看:111
本文介绍了android应用程序的入口点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发Android应用程序时,我们总是从主活动的onCreate()方法开始.显然,在调用onCreate()之前应完成一些初始化.我的问题是:Android应用程序的切入点(或main方法)是什么? Dalvik VM从一开始就调用什么(即,当它完成自己的初始化,并将控制权转移到应用程序时)?我在哪里可以找到此main的代码?

When we develop an Android application, we always start from the onCreate() method of the main activity. It is obvious that there are some initializations that should be done before calling onCreate(). My question is: what is the entrypoint point (or the main method) of an Android application? What does the Dalvik VM invoke in the very beginning (i.e., when it finishes initialization of its own, and is about to transfer control to the application)? Where can I find the code of this main?

推荐答案

第一个入口"点是金斯敦指出的应用程序类.

The first "entry" point is the application class as Kingston pointed out.

但是,最简单的方法是在调试onCreate时检查堆栈.

However, the easiest thing to get the very first starting point is to check the stack when debugging onCreate.

您可以检查Instrumentation,听起来有点像您想要的.

You may check Instrumentation, this sound somewhat like what you want.

http://developer.android.com/reference/android/app /Instrumentation.html

MainActivity.onCreate(Bundle) line: 12  
Instrumentation.callActivityOnCreate(Activity, Bundle) line: 1047   
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2627  
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2679   
ActivityThread.access$2300(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 125 
ActivityThread$H.handleMessage(Message) line: 2033  
ActivityThread$H(Handler).dispatchMessage(Message) line: 99 
Looper.loop() line: 123 
ActivityThread.main(String[]) line: 4627    
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
Method.invoke(Object, Object...) line: 521  
ZygoteInit$MethodAndArgsCaller.run() line: 868  
ZygoteInit.main(String[]) line: 626 
NativeStart.main(String[]) line: not available [native method]  

这篇关于android应用程序的入口点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆