https://www.gravatar.com/avatar/7a0c24f697ea1587001c36d00039b60f?s=240&d=mp

郁闷的时候看一看

1.只要把脸迎向阳光,你面前就不会有阴影。

2.别再自己瞎摸索,问路才不会迷路。

3.谎言像一朵盛开的鲜花,外表美丽,生命却很短暂。

4.宁愿跑起来被绊倒无数次,也不愿规规矩矩走一辈子。

5.可以选择放弃,但不能放弃选择。

[转载]Ubuntu 12.04 – install sun jdk 6-7

Ubuntu GNU/Linux 12.04 LTS (Precise Pangolin) released. I wanted to manually install the Sun JDK 6 and 7 on Ubuntu.

Installing Sun JDK 6 on Ubuntu 12.04:

  • Download the sun jdk 6 binfrom here .

  • Make the bin file executeable:

  • Extract the bin file:
  • Move extracted folder to this location:
  • Install new java source in system:
  • Choose default java:
  • java version test:
  • Verify the symlinks all point to the new java location:
  • Enable Java plugin for Mozilla Firefox (even for Chrome)

Installing Sun JDK 7 on Ubuntu 12.04:

Android之使用私有存储

首先内部存储路径为/data/data/youPackageName/,下面讲解的各路径都是基于你自己的应用的内部存储路径下。所有内部存储中保存的文件在用户卸载应用的时候会被删除。

files

  1. Context.getFilesDir(),该方法返回/data/data/youPackageName/files的File对象。

  2. Context.openFileInput()Context.openFileOutput(),只能读取和写入files下的文件,返回的是FileInputStream和FileOutputStream对象。

  3. Context.fileList(),返回files下所有的文件名,返回的是String[]对象。

  4. Context.deleteFile(String),删除files下指定名称的文件。

cache

  1. Context.getCacheDir(),该方法返回/data/data/youPackageName/cache的File对象。

custom dir

getDir(String name, int mode),返回/data/data/youPackageName/下的指定名称的文件夹File对象,如果该文件夹不存在则用指定名称创建一个新的文件夹。

通过getDir创建的文件夹包含前缀app_

Android开发中效率最高的循环代码

/* 1 ( 最快 ) */

for (int i = initializer; i >= 0; i--) { ... }

/* 2  第二 */

int limit = calculateLoopLimit();

for (int i = 0; i < limit; i++) { ... }

/* 3 */

Type[] array = getMyArray();

for (Type obj : array) { ... }

/* 4 */

for (int i = 0; i < array.length; i++) { ... }

/* 5 */

for (int i = 0; i < this.var; i++) { ... }

/* 6 */

for (int i = 0; i < obj.size(); i++) { ... }

/* 7 (最慢) */

Iterable<Type> list = getMyList();

for (Type obj : list) { ... }