如題,我寫的代碼如下,目前代碼不能重復周期執行。
請牛人出來幫忙解決。
mRunnable = new Runnable(){
@Override
public void run() {
if(count == 0){
setImage();
count = 1;
}
else{
weather = mContentResolver.getType(mUri);
setWeather(weather);
count = 0;
}
}
};
mHandler = new Handler();
mHandler.postDelayed(mRunnable, 3000);
m_Handler = new Handler();
mRunnable = new Runnable(){
@Override
public void run() {
if(count == 0){
// do something
count = 1;
}
else if (count==1){
// do something
count = 0;
}
m_Handler.postDelayed(mRunnable, 3000);// 將這個移動到run method中
}
};
mRunnable.run(); // missing