我写了一个工具类想将fragment
里面的Process.getElapsedCpuTime()
转移到工具类里面,但是这时候发现,这个方法移到工具类就报红了。
明明是一个静态的方法,它是怎么做到的?
package android.os;
public class Process {
/**
* Returns elapsed milliseconds of the time this process has run.
* @return Returns the number of milliseconds this process has return.
*/
public static final native long getElapsedCpuTime();
}
如果直接是写出来的话 AS会正确导包,而如果是复制进去的话,AS会引用 java.lang.Process AS导包的问题。