-2

In onCreate() I'm showing a ProgressDialog and then calling AsyncTask which is non
Activity. In this situation the screen goes black up to 30 seconds. How can I
resolve black ui issue?

this from Activity

showdialog("Your call is being connected with available agent...Please wait!"); 
response = new GetAvailableLink(ConferenceActivity.this).execute()
                .get();
codeMagic
  • 44,549
  • 13
  • 77
  • 93
alam
  • 9
  • 2
  • 2
    To get help you will need to post the `AsyncTask` code and how you are calling it. There's a good chance you are calling `.get()` which will block the UI. But can't say anymore without seeing your code. – codeMagic Feb 14 '15 at 14:42
  • will you please help me how can i send you the code to you – alam Feb 14 '15 at 15:15
  • 1
    You don't need to send it to me. Use the "edit" button below the tags in your post and copy/paste only **the most relevant** parts into your question. – codeMagic Feb 14 '15 at 15:16

1 Answers1

2

Just as I said in a comment, it is from calling .get() on your AsyncTask which is a blocking call so your UI won't proceed and it eliminates the point of the task being asynchronous.

You need to remove .get(). Show your ProgressDialog in onPreExecute() and dismiss it in onPostExecute().

This answer and a linked answer in it should help

Community
  • 1
  • 1
codeMagic
  • 44,549
  • 13
  • 77
  • 93