I need to make a "typing..." implementation, which will change back to fe "online" status, unless renewed. So, basically each time i get "typing" notification I want to set "typing" status for 2 seconds and then change it back, but if I get another "typing" notification, the countdown must reset. How can I achieve this? Thank you
Thanks to @Amy I got the answer. For those, who interested:
First, create Handler and Runnable:
composingHandler = new Handler();
composingRunnable = new Runnable() {
@Override
public void run() {
setToolbarSubTitle(getString(R.string.online));
}
};
Then in code:
setToolbarSubTitle(getString(R.string.typing));
composingHandler.removeCallbacks(composingRunnable);
composingHandler.postDelayed(composingRunnable, 2000);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.