Android应用法式的入口点是?ActivityThread?OnCreate?

4天前 (03-17 17:59)阅读1回复0
zaibaike
zaibaike
  • 管理员
  • 注册排名1
  • 经验值221730
  • 级别管理员
  • 主题44346
  • 回复0
楼主

我晓得呵呵是来论著辩手的,但却是要深切详尽申明呵呵:

你老友的尺度谜底是对的

畴前始末都说Activity的生齿数是onCreate体例。

只不外android上两个应用范畴的出口处,若是是ActivityThread。

和一般的java类那样,出口处是两个main体例。

public static void main(String[] args) { SamplingProfilerIntegration.start(); // CloseGuard defaults to true and can be quite spammy. We // disable it here, but selectively enable it later (via // StrictMode) on debug builds, but using DropBox, not logs. CloseGuard.setEnabled(false); Environment.initForCurrentUser(); // Set the reporter for event logging in libcore EventLogger.setReporter(new EventLoggingReporter()); Security.addProvider(new AndroidKeyStoreProvider()); Process.setArgV0("<pre-initialized>"); Looper.prepareMainLooper(); ActivityThread thread = new ActivityThread(); thread.attach(false); if (sMainThreadHandler == null) { sMainThreadHandler = thread.getHandler(); } AsyncTask.init(); if (false) { Looper.myLooper().setMessageLogging(new LogPrinter(Log.DEBUG, "ActivityThread")); } Looper.loop(); throw new RuntimeException("Main thread loop unexpectedly exited"); }

0
回帖

Android应用法式的入口点是?ActivityThread?OnCreate? 期待您的回复!

取消