将程序装到sdcard上

 

在androidmainfest.xml中加入属性android:installLocation,它的值可以有3个选项

  • internalOnly: Install the application on internal storage only. This will result in storage errors if the device runs low on internal storage.(非sdcard)
  • preferExternal: The android system tries to install the application on external storage. If that is full, the application is installed on internal storage.(在sdcard未满的情况下装在sdcard)
  • auto: Let the Android system decide the best install location for the application. The default system policy is to install the application on internal storage first. If the system is running low on storage, the application is then installed on external storage.(自主选择,内部存储有限,内部存储低的时候使用外部存储)

这个属性的api level为8,2.2的手机才可以将程序装入sdcard,这样可以尽可能的多装程序,此外,只有再程序的sdk2.2的情况下才可以编译通过,找了半天没找到代码中的对应的java code,看来我的2.1一定要升级了。

 

参考: http://devicefms.ro/installmove-to-sd-card-on-froyo.html

你可能感兴趣的:(java,android,api,application,System,存储)