Show a ProgressDialog inside a Fragment that is injected in a Tab
-
Good Day Everyone I have a Code that saves data and send an email after that. want to show Progress Dialog when this is happening. This code is in a Fragment that is shown in a Tab. below is my code in my Activity this works nicely. i have a challenge in making this to work in a Fragment
btn_contact_save.Click += (sender, e) =>
{
var progressDialog = new ProgressDialog(Context);
progressDialog.SetTitle("Saving...");
progressDialog.Indeterminate = true;
progressDialog.Show();
progressDialog.SetCancelable(false);btn\_details\_save\_Click(view); progressDialog.Dismiss(); };
Thanks
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vimalsoft.com vuyiswa[at]vimalsoft.com
-
Good Day Everyone I have a Code that saves data and send an email after that. want to show Progress Dialog when this is happening. This code is in a Fragment that is shown in a Tab. below is my code in my Activity this works nicely. i have a challenge in making this to work in a Fragment
btn_contact_save.Click += (sender, e) =>
{
var progressDialog = new ProgressDialog(Context);
progressDialog.SetTitle("Saving...");
progressDialog.Indeterminate = true;
progressDialog.Show();
progressDialog.SetCancelable(false);btn\_details\_save\_Click(view); progressDialog.Dismiss(); };
Thanks
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vimalsoft.com vuyiswa[at]vimalsoft.com
Vimalsoft(Pty) Ltd wrote:
i have a challenge in making this to work in a Fragment
And that challenge would be what exactly?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Vimalsoft(Pty) Ltd wrote:
i have a challenge in making this to work in a Fragment
And that challenge would be what exactly?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
The Dialog does not show
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vimalsoft.com vuyiswa[at]vimalsoft.com
-
The Dialog does not show
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vimalsoft.com vuyiswa[at]vimalsoft.com
Where is the context coming from? Is an exception being thrown?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Where is the context coming from? Is an exception being thrown?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
hi There is no Exception , the Context is the Application Context (Context.Android.Support.V4.App.Fragment.Context) , i also tried to declare the context at a fragment level and initialize it on OnCreateView (Android.Content.Context) but still it does not show the dialog. Please note this dialog shows nicely in an Activity not a Fragment. Thanks
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vimalsoft.com vuyiswa[at]vimalsoft.com
-
hi There is no Exception , the Context is the Application Context (Context.Android.Support.V4.App.Fragment.Context) , i also tried to declare the context at a fragment level and initialize it on OnCreateView (Android.Content.Context) but still it does not show the dialog. Please note this dialog shows nicely in an Activity not a Fragment. Thanks
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vimalsoft.com vuyiswa[at]vimalsoft.com
Vimalsoft(Pty) Ltd wrote:
There is no Exception...
You know this, even without a
try/catch
block?Vimalsoft(Pty) Ltd wrote:
, the Context is the Application Context (Context.Android.Support.V4.App.Fragment.Context) , i also tried to declare the context at a fragment level and initialize it on OnCreateView (Android.Content.Context) but still it does not show the dialog.
Have you tried using
getActivity()
when constructing theProgressDialog
?Vimalsoft(Pty) Ltd wrote:
Please note this dialog shows nicely in an Activity not a Fragment.
Which means nothing. While a fragment runs within an activity, that does not mean they are interchangeable.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Vimalsoft(Pty) Ltd wrote:
There is no Exception...
You know this, even without a
try/catch
block?Vimalsoft(Pty) Ltd wrote:
, the Context is the Application Context (Context.Android.Support.V4.App.Fragment.Context) , i also tried to declare the context at a fragment level and initialize it on OnCreateView (Android.Content.Context) but still it does not show the dialog.
Have you tried using
getActivity()
when constructing theProgressDialog
?Vimalsoft(Pty) Ltd wrote:
Please note this dialog shows nicely in an Activity not a Fragment.
Which means nothing. While a fragment runs within an activity, that does not mean they are interchangeable.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
You know this, even without a try/catch block? i stepped through and no exception was raised. Have you tried using getActivity() when constructing the ProgressDialog? let me try that and i will get back to you.
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vimalsoft.com vuyiswa[at]vimalsoft.com