1 Reply Latest reply on Aug 14, 2016 12:22 AM by Madhu Lakshmipathy

    Android App: Open own ServiceFragment through NavigationDrawer?

    thrustmaster_1641326

      HI,

         

      i would like to edit the Cysmart Android App and especially the Navigation Drawer, so i can choose from there a BLE Service, which i've created. 

         

      I've edited so far the NavigationDrawer with my own structure. On my navigation there is a parent-item which has three child-items. Also i've created a ServiceFragment which works great so far. My goal is now to implement it in that way, that when i choose e.g. the first child-item on the NavigationDrawer, that it opens the ServiceFragment that i've created.

         

      My created service is a Fragment and not an Activity. Therefore i have to open the Fragment from a Fragment (NavigationDrawer). I've tried some solutions with the FragmentManager, but i can't find a solution for this, as the App always crashes. 

         

      What does work is, when i try opening the existing AboutFragment with this (Code is in NavigationDrawerFragment):

         


      private void selectChildView(String childText) {

         

      if (childText.equalsIgnoreCase(getResources(). getString(R.string.navigation_drawer_testmenu))) {

         

      AboutFragment aboutFragment = new AboutFragment();

         

      displayView(aboutFragment);

         

      mDrawerLayout.closeDrawer(mFragmentContainerView);

         

      }}

         

       

         

      But when i try this with my own ServiceFragment that i've created, it crashes. Even when i'm connected to my BLE Usb Dongle. 

         

       

         

      So does anyone have any solution ideas? How and what do i have to implement to achieve my goal?

         

      I really would appreciate any help. Thank you very much in advance!

         

      Best regards