apk安装包信息

String archiveFilePath="sdcard/DangDang.apk";//安装包路径  
        PackageManager pm = getPackageManager();    
        PackageInfo info = pm.getPackageArchiveInfo(archiveFilePath, PackageManager.GET_ACTIVITIES);    
        if(info != null){    
            ApplicationInfo appInfo = info.applicationInfo;    
            String appName = pm.getApplicationLabel(appInfo).toString();    
            String packageName = appInfo.packageName;  //得到安装包名称  
            String version=info.versionName;       //得到版本信息       
//            Toast.makeText(TestActivity.this, , Toast.LENGTH_LONG).show();  
            Drawable icon = pm.getApplicationIcon(appInfo);//得到图标信息  
            TextView tv = (TextView)findViewById(R.id.tv); 
            tv.setText("appName:"+appName+"---packageName:"+packageName);
            //显示图标  
            ImageView tu=(ImageView)findViewById(R.id.imageView1);
            tu.setBackgroundDrawable(icon);

上一篇:FusionChart实现金字塔分布图


下一篇:分享个刚写好的 android 的 ListView 动态加载类,功能全而代码少。