I am displaying a FragmentDialog F
. I would like to dismiss it if the response from server is positive. I use AsyncTask to make a request after user click OK on the F
. I cannot dismiss a window immediately because I have to wait for response from server.
I see two solutions:
- Dismiss dialog and display again.
- Try to hide a
Fragment
using fragment manager by tag.
What is better solution? Is there canonical way to do it?
- Let's assume the following situation:
I have a button
B
. If user clicksB
then send a request to the server. I am going to wait for a response so I showProgressDialog P
. When resposne arrived I would like to showDialogFragment
. I have two doubts:
3a) What if user is very fast:
click B
-> click B
-> showProgressDialog P `.
I mean, user clicked twice very fast. He managed do it because he had done it before ProgressDialog appeared ( He triggered two events).
I am not sure whether a such scenario is possible. If not, please convince me.
3b) I want to commit to FragmentManager
when AsyncTask is completed to show FragmenDialog
. But, how to? I don't know state of Activity!