I need to show a Toast message before a method using an intense processor work. The problem is that the Toast only shows after this method, even calling this method in another Thread.
How can i show the Toast before ?
EDIT: The code is too long for showing here … but i will resume it …
…
Toast.makeText(getBaseContext(),"Text", Toast.LENGTH_SHORT).show();
proccess.setRun();
//In the Proccess class that implements Runnable …
public void setRun(){
thread= new Thread(this);
thread.setPriority(Thread.NORM_PRIORITY);
thread.start();
running=true;
}
public void run() {
bytes=byteGrooveMaker();
prepare(grBytes);
}
//byteGrooveMaker() is a method in Proccess class that requires lot of processor work.
Just use an async task. On the onpreexecute you show your toast, and in the doinbackground method you execute your heavy process 🙂