定时执行一次run()中的代码:也可以用Timer实现
handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
int orientation=getResources().getConfiguration().orientation;
// 在此处执行需要定时执行的任务
/* Log.e("orientation",""+orientation);*/
handler.postDelayed(this,1000);
}
}, 1000);
移动传感器 | Sensors and location | Android Developers (google.cn)
Android 开发设置 | Android 开源项目 | Android Open Source Project (google.cn)