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. Issue navigating to a Fragment

Issue navigating to a Fragment

Scheduled Pinned Locked Moved Android
csharpasp-netcomdocker
1 Posts 1 Posters 0 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 All i have a Navigation Drawer which is defined like this

    and when one of my drawer item is selected i have this code

    // Create a new fragment and a transaction.
    FragmentTransaction fragmentTx = this.FragmentManager.BeginTransaction();
    Fragment1 aDifferentDetailsFrag = new Fragment1();
    // The fragment will have the ID of Resource.Id.fragment_container.
    fragmentTx.Add(Resource.Id.content_frame, aDifferentDetailsFrag);

                        // Commit the transaction.
                        fragmentTx.Commit();
                        Toast.MakeText(this, "Home:", ToastLength.Long).Show();
    

    and Fragment1 is defined like this

    and the cs is defined like this

    public class Fragment1 : Fragment
    {

        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
    
            // Create your fragment here
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            return inflater.Inflate(Resource.Layout.Fragment1, null, false); 
        }
    }
    

    when i run this , i only get a toast message, the Fragment1 does not show which has a button that is having text "home" 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

    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