Android 获取apk文件信息、获取其他APP资源

http://blog.csdn.net/wen0006/article/details/5797400

protected void runAppFromApkFileOnSdCard()  
    {  
        final PackageManager pm = this.getPackageManager();  
        PackageInfo packageInfo = pm.getPackageArchiveInfo(fullPath, 0);  
        Toast.makeText(getApplicationContext(), packageInfo.packageName, Toast.LENGTH_LONG).show();  
//        Intent intent           = pm.getLaunchIntentForPackage(packageInfo.packageName);  
//        if( intent == null ){  
//            File file   = new File(fullPath);  
//            intent      = new Intent();  
//            intent.setAction(Intent.ACTION_VIEW);  
//            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);  
//            intent.setDataAndType(Uri.fromFile(file),  
//            "application/vnd.android.package-archive");  
//        }  
//        startActivity(intent);  
    }  
 PackageManager manager = getPackageManager();  
        try {  
            resources = manager.getResourcesForApplication(packName);  
        } catch (NameNotFoundException e) {  
            // TODO Auto-generated catch block  
            e.printStackTrace();  
        }  
        int rid = resources.getIdentifier("wallpaper", "drawable", packName);  
  
        Uri build = CONTENT_URI.buildUpon().appendPath(packName)  
                .appendEncodedPath("res").appendPath(String.valueOf(rid)).build();  
        txt.setText(build.toString());  
  
        Bitmap b = BitmapFactory.decodeResource(resources, rid, null);  
        imageView1.setImageBitmap(b);  
String[] skinPkgs = getPackageManager().getPackagesForUid(Process.myUid());  
获取所有同一个  android:sharedUserId="com.hujl.mainskin"  的资源包  ,可以实现多套 skin 的切换 。

你可能感兴趣的:(Android 获取apk文件信息、获取其他APP资源)