用户名:孙洪波 文章数:10 评论数:0
访问量:428:136:118:1 注册日期:2012-02-07
当我们在Launcher中点击浏览器的图标时,浏览器的窗口会打开并显示主页(HomePage)。这里我们对这一场景进行分析,研究浏览器如何启动,取得缺省主页并将它布局和显示的。
根据前边对WebView 类的学习,大概可以预期我们在主Activity的onCreate方法里从设置里面取得缺省主页的配置,创建一个WebView类,并使用setContentView将它添加到主窗口中。下面我们从浏览器的代码看看它是如何实现的。
首先,研究AndroidManifest文件,从<application>标签的内容看到该Apk实现了自己的Applicaton 类Browser:
<application android:name="Browser" android:label="@string/application_name" android:icon="@mipmap/ic_launcher_browser" android:backupAgent=".BrowserBackupAgent" android:hardwareAccelerated="true" android:taskAffinity="android.task.browser" > |
<activity android:name="BrowserActivity" android:label="@string/application_name" android:launchMode="singleTask" android:alwaysRetainTaskState="true" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:theme="@style/BrowserTheme" android:windowSoftInputMode="adjustResize" > |
。。。
<!-- We are also the main entry point of the browser. --> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.APP_BROWSER" /> </intent-filter> |
Apk的启动,首先是ApplicationBrowser类的onCreate方法,主要工作:
// create CookieSyncManager with current Context
CookieSyncManager.createInstance(this);
BrowserSettings.initialize(getApplicationContext());
Preloader.initialize(getApplicationContext());
这里涉及到三个工作:Cookie同步管理,浏览器设置和预加载。
然后是Activity的onCreate方法,与我们的研究相关的代码:
public void onCreate(Bundle icicle) { if (LOGV_ENABLED) { Log.v(LOGTAG, this + " onStart, has state: " + (icicle == null ? "false" : "true")); super.onCreate(icicle); mController = createController(); Intent intent = (icicle == null) ? getIntent() : null; mController.start(intent); |
private Controller createController() { Controller controller = new Controller(this); rsync的配置使用 阅读原文» 用户名:zuoyuezong 文章数:11 评论数:8 Rsync 默认端口873 Wirer:zuoyuezong@gmail.com 描述:rsync服务是基于C/S模式的 作用:简单的说就是同步文件用的 环境: 两台linux服务器 192.168.152.153(hostname是amoeba) 作为服务器 ; 192.168.152.150作为客户端(hostname 是localhost) 目的:同步my.cnf配置文件到192.168.152.150服务器 操作步骤:
|
没有评论:
发表评论