2011年4月29日

Android CTS测试的几个必要条件

1. 真机host,虚拟机下的linux可能会出现超时问题

2. devices是usr版本,设置屏幕为不关闭,并打开辅助功能的几个选项。

3.devices开机之后,停留在home界面下,且不要操作

4.运行adb start-server,但是不要运行其他相关的adb client程序

5.手机上需有T卡

6.默认语言修改为英文

posted @ 2011-04-29 14:13 SeanLin 阅读(85) 评论(0) 编辑

[JAVA]语法备忘录 for loop

For-each Loop

Purpose

The basic for loop was extended in Java 5 to make iteration over arrays and other collections more convenient. This newer for statement is called the enhanced for or for-each (because it is called this in other programming languages). I've also heard it called the for-in loop.

Use it in preference to the standard for loop if applicable (see last section below) because it's much more readable.

Series of values. The for-each loop is used to access each successive value in a collection of values.

Arrays and Collections. It's commonly used to iterate over an array or a Collections class (eg, ArrayList).

Iterable<E>. It can also iterate over anything that implements the Iterable<E> interface (must define iterator() method). Many of the Collections classes (eg, ArrayList) implement Iterable<E>, which makes the for-each loop very useful. You can also implement Iterable<E> for your own data structures.

General Form

The for-each and equivalent for statements have these forms. The two basic equivalent forms are given, depending one whether it is an array or an Iterable that is being traversed. In both cases an extra variable is required, an index for the array and an iterator for the collection.

For-each loop Equivalent for loop
for (type var : arr) {
    body-of-loop
}
for (int i = 0; i < arr.length; i++) { 
    type var = arr[i];
    body-of-loop
}
for (type var : coll) {
    body-of-loop
}
for (Iterator<type> iter = coll.iterator(); iter.hasNext(); ) {
    type var = iter.next();
    body-of-loop
}

posted @ 2011-04-29 10:19 SeanLin 阅读(72) 评论(0) 编辑