在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

更多相关文章

  1. Android如何自定义视图属性总结
  2. Android 程序退出确认功能开发
  3. android : 控件在代码中设置属性-setWidth(int pixels)或setHeig
  4. 开发Android应用程序来使用硬件访问服务
  5. Android 在程序中重启APP的方法
  6. Android之Handler的几个例子程序,对比学习
  7. Android View measure (五) 支持margin属性,从一个异常说起

随机推荐

  1. Android传感器概述(二)
  2. Android(安卓)-- Parcelable 序列化操作
  3. Android(安卓)UI编程进阶——使用Surface
  4. Android学习小Demo(5)结合Matrix跟Porperty
  5. Android全屏截图的方法,返回Bitmap并且保
  6. Data Binding Guide——google官方文档翻
  7. Android(安卓)内存优化篇 - 使用profile
  8. Android(安卓)基础知识点
  9. 论Android应用进程长存的可行性
  10. Android桌面悬浮窗进阶,QQ手机管家小火箭