Android中Application類用法(整個程式的全域性變數,即單例),類似於session
阿新 • • 發佈:2019-02-01
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.test"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="8" />
<application
android:icon ="@drawable/icon"
android:label="@string/app_name"
android:name="CustomApplication">
<!-- 將我們以前一直用的預設Application設定成自定義的CustomApplication -->
<activity
android:name=".FirstActivity"
android:label="@string/app_name">
<intent-filter >
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name =".SecondActivity"
android:label="@string/app_name">
</activity>
</application>
</manifest>