I'm making an application on Android Studio, but what should I do if I want the toast to show "Stop processing" (remove processing while processing stops) and then change the toast to "Cancel processing" after the stop time?
I'm worried about what to do if it disappears after a few seconds of displaying it in the normal way of using toast.
I would like your advice.
ThreadSample.java
class ThreadSample extensions Thread {
public void run() {
try{
Thread.sleep (10000L); // Stops threads for 10 seconds (10000ms)
} catch(InterruptedExceptione) {
}
}
}
ThreadExecutor.java
class ThreadExecutor{
public static void main(String[]args) {
Threadt=new ThreadSample();
t.start();
}
}
It may be possible if you keep forcing it to be displayed, but it is not realistic to keep showing toast.
For example, a similar question has been asked.
https://stackoverflow.com/questions/2220560/can-an-android-toast-be-longer-than-toast-length-long
If you want to keep users informed when the app is in the foreground, consider snackbars specifications.
https://material.io/components/snackbars/android
If you still need notification after the application transitions to the background, consider notification in the status bar.
https://developer.android.com/guide/topics/ui/notifiers/notifications.html
582 PHP ssh2_scp_send fails to send files as intended
619 Uncaught (inpromise) Error on Electron: An object could not be cloned
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.