2

I have did this :

doInBackground(String... prams){
    Toast.makeText(getApplicationContext(),
                            "Server too busy. Please try after sometime.",
                            Toast.LENGTH_LONG).show();}

Getting error . please help.

2 Answers2

1

You cannot update UI inside doInBackground.Do this to show toast

getActivity().runOnUiThread(new Runnable() {

            @Override
            public void run() {
                Toast.makeText(getApplicationContext(),
                        "Server too busy. Please try after sometime.",
                        Toast.LENGTH_LONG).show();

            }
        });

It will solve your problem

Sanwal Singh
  • 1,765
  • 3
  • 17
  • 35
1

You can't show toast in

doInBackground(String... prams){}

enter image description here

Quang Doan
  • 632
  • 4
  • 12