In a specific part of my code in need to run 3 actions in a a timed space, right now i am using this method:
Handler mHander = new Handler();
public void startChainActions(){
// do first action
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
//do action 2
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
//do action 3
}
}
}, 1500);
}
}
}, 5000);
}
public void cleanResources(){
mHandler.removeCallbacksAndMessages(null);
mHandler==null
}
When using this method i often see this message on my logcat:
W/art﹕ Suspending all threads took: 12.272ms
which leads me to believe it is slowing down performance. is there a better way to time actions after each other?