• 6

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I am currently working on MVVMCross Xamarin Android project. So far I have achieved normal navigation and bottom bar navigation. I want to open dynamic fragments inside each bottom bar tabs. e.g I have bottom bars menus Recent, Favorite and NearBy. Clicking on each tab it create fragments. Inside each fragment I want to provide facility to dynamically create fragments on click.

I want to achieve here is, it should keep stack of navigation tab wise. Let say I created 5,3,4 fragments respectively for Recent, Favorite and Nearby and currently I am on favorite tab and clicking on back should first navigate back to all 3 tabs. Like wise it should follow navigation for other tabs.

Exact same feature and functionality available in this github link [https://github.com/ncapdevi/FragNav][1]. This is one is for Android but I need advice how can I achieve same functionality with Xamarin, MVVMCross and C#.

Any help greatly appreciated.

First your link is dead,and then i think you need to understand the back stack of fragments and show hidden features to implement that.FragmentTransaction

general train of thought, you have RecentFragment, FavoriteFragment and NearByFragment three root fragments, when you click the relative tab ,you can use show and hide method of fragment like this :

 FragmentTransaction fTransaction = FragmentManager.BeginTransaction();
            //judge which tab is clicked
            switch (tab.Id)
                case Recent:                
                    if (recentFragment== null)
                        recentFragment= new RecentFragment ();
                        fTransaction.Add(Resource.Id.ly_content, recentFragment);
                case Favorite:
                    if (favoriteFragment== null)
                        favoriteFragment= new FavoriteFragment();
                        fTransaction.Add(Resource.Id.ly_content, favoriteFragment);
                case NearBy:
                    if (nearByFragment== null)
                        nearByFragment= new NearByFragment();
                        fTransaction.Add(Resource.Id.ly_content, nearByFragment);

and then in each root fragment to implement the back stack use addToBackStack :

FragmentManager fragmentManager = FragmentManager;
        FragmentTransaction fragmentTransaction = fragmentManager.BeginTransaction();

at last you could try to encapsulating a controller

  • 1
Reply Report
    • Hi Leo, your idea seems fine but to achieve exact functionality what I did is I converted complete github.com/ncapdevi/FragNav controller code in C#. It took lot of efforts but finally it works as expected. Still I have to check how to include MVVM Cross view models.