0


I wrote a thread that should inform the user of being started.

@Override           
public void run(){
    Looper.prepare();
    printToast(START_PRINT + fileName + "...");
    Bundle b = mCallback.onSendFile();

Where: fileName is global String.
START_PRINT is final String

The printToast is a function that calls the method: Toast.makeText like this:

void printToast(String msg){
    Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
}

I have another toast in the end of the thread.
Now i can't understand why the i can't see the first toast and i see only the second one.
Please help!
Thanks :)

Benaya
  • 83
  • 1
  • 8
  • Can you post your full `run()` method? I'd also try creating a UI-Thread Handler and posting to that as opposed to using a Looper. – A--C Nov 25 '13 at 22:49
  • 2
    Sorry misread the question. – Gray Nov 25 '13 at 22:52
  • 2
    Same as http://stackoverflow.com/questions/3875184/cant-create-handler-inside-thread-that-has-not-called-looper-prepare/16886486#16886486 In short, you need to call toaster functions from the UI thread. – frozenkoi Nov 25 '13 at 23:17

0 Answers0