PackageInfo packageInfo = getPackageManager().getPackageInfo("com.example.AndroidTest_01", PackageManager.COMPONENT_ENABLED_STATE_DEFAULT);
Context context=createPackageContext("com.example.AndroidTest_01",Context.CONTEXT_INCLUDE_CODE|Context.CONTEXT_IGNORE_SECURITY);
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.example.AndroidTest_01" android:versionCode="1" android:installLocation="preferExternal" android:sharedUserId="com.tiza" android:versionName="1.0"> <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="21"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission> <application android:label="@string/app_name" android:allowClearUserData="true" android:theme="@android:style/Theme.Holo.Light" android:icon="@drawable/ic_launcher"> <activity android:name="MyActivity" android:launchMode="standard" android:windowSoftInputMode="adjustResize" android:icon="@drawable/back6" android:label="主頁"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".TAct" android:icon="@drawable/logo" android:parentActivityName=".MyActivity" android:label="TAct"> </activity> <service android:name=".MService"/> </application> </manifest>