Skip to content Skip to sidebar Skip to footer

How To Create Toast In Android Inside Asyntask

I have did this : doInBackground(String... prams){ Toast.makeText(getApplicationContext(), 'Server too busy. Please try after sometime.',

Solution 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

Solution 2:

Post a Comment for "How To Create Toast In Android Inside Asyntask"