Created
May 16, 2013 13:32
-
-
Save shaobin0604/5591750 to your computer and use it in GitHub Desktop.
load not installed package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_main); | |
| mAppName = (TextView) findViewById(R.id.app_name); | |
| mAppIcon = (ImageView) findViewById(R.id.app_icon); | |
| PackageManager packageManager = getPackageManager(); | |
| String archiveFilePath = "/mnt/sdcard/1/codoonfitness.apk"; | |
| PackageInfo packageArchiveInfo = packageManager.getPackageArchiveInfo(archiveFilePath, PackageManager.GET_ACTIVITIES); | |
| ApplicationInfo applicationInfo = packageArchiveInfo.applicationInfo; | |
| System.out.println("sourceDir: " + applicationInfo.sourceDir); | |
| System.out.println("publicSourceDir: " + applicationInfo.publicSourceDir); | |
| applicationInfo.sourceDir = archiveFilePath; | |
| applicationInfo.publicSourceDir = archiveFilePath; | |
| String appName = packageManager.getApplicationLabel(applicationInfo).toString(); | |
| mAppName.setText(appName); | |
| mAppIcon.setImageDrawable(packageManager.getApplicationIcon(applicationInfo)); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
issue 9195