GithubHelp home page GithubHelp logo

mitchtabian / navigation-components-example Goto Github PK

View Code? Open in Web Editor NEW
216.0 2.0 109.0 1.21 MB

An example using a single activity, several fragments, animations, arguments, with Navigation Components (Kotlin)

Kotlin 100.00%
kotlin android navigation-component navigation-components navigation-component-kotlin android-jetpack android-jetpack-navigation android-jetpack-components

navigation-components-example's Introduction

navigation-components-example's People

Contributors

mitchtabian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

navigation-components-example's Issues

Clear Backstacks?

I have working on 3 fragments A, B & C. A is the main fragment. navigations maybe like this A->B->C->A->C->A->B.. so on. Now I press the device Back button onBackPressed() will b triggered. Whenever I press back button navigate to A fragment without any backstacks.

Observer is called on load of Fragment Using Navgraph

Known issue in all blogs.

I have Fragment A and Fragment B, called Fragment B and inside this i have one api call and I am observing the Livedata. I got the response from API and its working fine. I navigateUp to Fragment A and come back again to Fragment B, again the last observer trigers. Even though am removing the observer and creating new.

Fragment B:

private val viewModel : MyViewModel by activityViewModels()
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
viewModel .getData().removeObservers(viewLifecycleOwner)
viewModel .getData().observe(viewLifecycleOwner, Observer {
navController.navigateUp() // this calls again and again
})
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.