现在的位置: 首页 > 综合 > 正文

android判断程序是否存在

2013年10月14日 ⁄ 综合 ⁄ 共 440字 ⁄ 字号 评论关闭
		String packagename = "com.android.gcihjt";
		PackageInfo packageInfo;

	      try {
	          packageInfo = this.getPackageManager().getPackageInfo(
	                  packagename, 0);

	      } catch (NameNotFoundException e) {
	          packageInfo = null;
	          e.printStackTrace();
	      }
	      if(packageInfo ==null){
	          System.out.println("not installed");
	      }else{
	    	  	System.out.println("is installed");
	    	  	Uri uninstallUri = Uri.fromParts( "package" , packagename  ,  null );
	    	  	Intent mIntent = new Intent(Intent.ACTION_DELETE, uninstallUri);
	    	  	startActivity(mIntent);
	      }

抱歉!评论已关闭.