Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Android
  4. Show a ProgressDialog inside a Fragment that is injected in a Tab

Show a ProgressDialog inside a Fragment that is injected in a Tab

Scheduled Pinned Locked Moved Android
csharpasp-netcom
7 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vimalsoft Pty Ltd
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • V Vimalsoft Pty Ltd

      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

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      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

      V 1 Reply Last reply
      0
      • D David Crow

        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

        V Offline
        V Offline
        Vimalsoft Pty Ltd
        wrote on last edited by
        #3

        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

        D 1 Reply Last reply
        0
        • V Vimalsoft Pty Ltd

          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

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          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

          V 1 Reply Last reply
          0
          • D David Crow

            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

            V Offline
            V Offline
            Vimalsoft Pty Ltd
            wrote on last edited by
            #5

            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

            D 1 Reply Last reply
            0
            • V Vimalsoft Pty Ltd

              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

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              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 the ProgressDialog?

              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

              V 1 Reply Last reply
              0
              • D David Crow

                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 the ProgressDialog?

                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

                V Offline
                V Offline
                Vimalsoft Pty Ltd
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups