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. FragmentTabHost in VS2013 - xamarin C#

FragmentTabHost in VS2013 - xamarin C#

Scheduled Pinned Locked Moved Android
csharpandroidmobilelinqhelp
14 Posts 2 Posters 2 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.
  • J jojoba20

    first of all thanks for ur attention. i have it in "activity_main.axml" :

    And the mTabHost isnot nulll in

    mTabHost = FindViewById(Resource.Id.tabhostN );

    Or Possible to give me and C# xamarin example for doing the same i have done? any further question?

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #4

    Did you actually check the value of this variable at run time? It matters not what you write in your source code, the only way to be sure it works is to check it at the time of error. If it is not that variable that causes the error then it must be one of the others. I also notice that you have this code within a try/catch block, but you eat the exception. This is really bad practice and leads to situations just such as this. Exceptions provide useful information, so make proper use of them.

    J 1 Reply Last reply
    0
    • L Lost User

      Did you actually check the value of this variable at run time? It matters not what you write in your source code, the only way to be sure it works is to check it at the time of error. If it is not that variable that causes the error then it must be one of the others. I also notice that you have this code within a try/catch block, but you eat the exception. This is really bad practice and leads to situations just such as this. Exceptions provide useful information, so make proper use of them.

      J Offline
      J Offline
      jojoba20
      wrote on last edited by
      #5

      i have used this for sample for that the catch is not complete. at runtime the mtabHost is not null. i have breakepoint in

      mTabHost.AddTab(spec);

      and the error occured in here. thanks in advanced!

      L 1 Reply Last reply
      0
      • J jojoba20

        i have used this for sample for that the catch is not complete. at runtime the mtabHost is not null. i have breakepoint in

        mTabHost.AddTab(spec);

        and the error occured in here. thanks in advanced!

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #6

        Then you need to establish what value is causing the exception. We cannot guess it from the information you have provided.

        J 1 Reply Last reply
        0
        • L Lost User

          Then you need to establish what value is causing the exception. We cannot guess it from the information you have provided.

          J Offline
          J Offline
          jojoba20
          wrote on last edited by
          #7

          may i give ur the whole project for downloading? thanks in advanced!

          L 1 Reply Last reply
          0
          • J jojoba20

            may i give ur the whole project for downloading? thanks in advanced!

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #8

            Sorry, no. You need to do the debugging and provide the required information.

            J 1 Reply Last reply
            0
            • L Lost User

              Sorry, no. You need to do the debugging and provide the required information.

              J Offline
              J Offline
              jojoba20
              wrote on last edited by
              #9

              thanks but i have done that but cannot help! do y have any sample ?

              L 1 Reply Last reply
              0
              • J jojoba20

                thanks but i have done that but cannot help! do y have any sample ?

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #10

                Sorry, I don't use Xamarin, and that is not really the solution; if you find another sample and that one does not work, what then? If you aspire to be a developer then you really need to practice diagnosing problems, even if you need help solving them.

                J 1 Reply Last reply
                0
                • L Lost User

                  Sorry, I don't use Xamarin, and that is not really the solution; if you find another sample and that one does not work, what then? If you aspire to be a developer then you really need to practice diagnosing problems, even if you need help solving them.

                  J Offline
                  J Offline
                  jojoba20
                  wrote on last edited by
                  #11

                  thanks for ur advice But the error is exact there and i dont know how to solve that~

                  L 1 Reply Last reply
                  0
                  • J jojoba20

                    thanks for ur advice But the error is exact there and i dont know how to solve that~

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #12

                    I have tried to explain how: you use your debugger to step through the code and look to see what variable is not being set up correctly. You can only solve it by collecting all the information around the time of error.

                    J 1 Reply Last reply
                    0
                    • L Lost User

                      I have tried to explain how: you use your debugger to step through the code and look to see what variable is not being set up correctly. You can only solve it by collecting all the information around the time of error.

                      J Offline
                      J Offline
                      jojoba20
                      wrote on last edited by
                      #13

                      Thanks i have done that! I should change :

                      mTabHost.AddTab(spec);

                      To :

                      mTabHost.Setup(this, SupportFragmentManager, Resource.Id.tabFrameLayout);
                      mTabHost.AddTab(spec, Java.Lang.Class.FromType(typeof(Fragment1)), null);

                      end of story That is all!

                      L 1 Reply Last reply
                      0
                      • J jojoba20

                        Thanks i have done that! I should change :

                        mTabHost.AddTab(spec);

                        To :

                        mTabHost.Setup(this, SupportFragmentManager, Resource.Id.tabFrameLayout);
                        mTabHost.AddTab(spec, Java.Lang.Class.FromType(typeof(Fragment1)), null);

                        end of story That is all!

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #14

                        Yes, it always helps to read the documentation.

                        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