I recently came across this fact:
Some devices that running on Android Pie overwrite previous one.
Toast toast1 = Toast.makeText(getApplicationContext(), "a", Toast.LENGTH_SHORT); toast1.show(); Toast toast2 = Toast.makeText(getApplicationContext(), "b", Toast.LENGTH_SHORT); toast2.show();
I don’t think Pie processes Toast message sequentially. It just shows last toast’s message only. (checked on my API 28
emulator)
with RxJava2 , Let’s do like this:
Toast[] toasts = {toast1, toast2}; Disposable disposable = Observable.interval(0, 3000, TimeUnit.MILLISECONDS) .map(Long::intValue) .map(i->toasts[i]) .take(toasts.length) .subscribe(Toast::show);
0개의 댓글