在src文件中拷入文件包:android.content.pm在包中拷入两个aidl文件 IPackageStatsObserver.aidl和PackageStats.aidl
pm=getPackageManager(); //拿到该类中所有的方法名 try { Method method=PackageManager.class.getMethod("getPackageSizeInfo", new Class[]{String.class,IPackageStatsObserver.class}); method.invoke(pm, new Object[]{"cn.itcast.mobilesafe",new IPackageStatsObserver.Stub() { public void onGetStatsCompleted(PackageStats pStats, boolean succeeded) throws RemoteException { long cacheSize=pStats.cacheSize; long codeSize=pStats.codeSize; long dataSize=pStats.dataSize; System.out.println("手机卫士的大小是多少呢"+cacheSize+codeSize+dataSize); } }}); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }