android-navigation

How can I navigate from an activity to another using Navigation Component and removing the first activity from the stack?

天涯浪子 提交于 2019-12-11 04:13:26
问题 In my app I have two activities (AuthenticationActivity and MainActivity), each one with a nav graph and a big flow of fragments. I've created an action to navigate from a fragment of the AuthenticationActivity's graph to the MainActivity but it does not remove the AuthenticationActivity from the stack even if I set 'popTo' to the Authentication graph id. 回答1: finish authentication activity after navigate method: button2.setOnClickListener { view.findNavController().navigate(R.id.action

How to hide ActionBar and NavigationBar after a certain delay time?

♀尐吖头ヾ 提交于 2019-12-10 21:06:28
问题 I would hide navigation bar and action bar of my app after some second that display don't get touched, and expand current view to fullscreen. Then if user touch the screen (or better if he swipe down), make visible both again. How to? 回答1: You can use a Handler to delay certain actions. Handler h = new Handler(); h.postDelayed(new Runnable() { @Override public void run() { // DO DELAYED STUFF getActionBar().hide(); } }, delaytime); // e.g. 3000 milliseconds The actions you take inside the run

How to navigate from nested Fragment to parent fragment using Jetpack Navigation?

烈酒焚心 提交于 2019-12-10 16:48:04
问题 I have main navigation: SplashFragment -> RegistrationFragment -> RootFragment <fragment android:id="@+id/splashFragment" android:name="com.low6.low6.features.splash.SplashFragment" android:label="Splash" tools:layout="@layout/fragment_splash" > <action android:id="@+id/action_next" app:clearTask="true" app:destination="@id/registrationFragment" /> </fragment> <fragment android:id="@+id/registrationFragment" android:name="com.low6.low6.features.registration.RegistrationFragment" android:label

How does NavUtils.navigateUpFromSameTask work?

左心房为你撑大大i 提交于 2019-12-10 15:26:20
问题 please what is actuall behavior of this method? I thought that when bind this method call to my actionbar back button and also set the homepageactivity name in Manifest.xml, it should be then opened after the click in the button - regardless of the current task stack.. For example, when I open my Activity from widget, the parent Activity is not in BackStack - this is what I want to solve..I know I can somehow build my own taskstack, but I just thought, that this should be prebaked solution,

Android Navigation Architecture Component: How to pass bundle data to startDestination

非 Y 不嫁゛ 提交于 2019-12-10 14:23:54
问题 I have an activity which has a NavHostFragment . The activity receives certain values in its intent. I want to pass this data to the first fragment i.e startDestination of the navigation graph. I couldn't find any documentation regarding this. I have already gone through this question on SO but I can't seem to find the addDefaultArguments method for navController.getGraph() . Is it possible to pass bundle to startDestination ? 回答1: i also came across same issue, This is how i resolved it:

Pass data back to previous fragment using Android Navigation

元气小坏坏 提交于 2019-12-10 13:35:17
问题 I've started using Android Architecture Components (Navigation and Safe Args, View Models) along with Koin library. Currently, I've got a problem with passing arguments between two fragments - I need to pass a string value from fragment A to fragment B, modify this value in fragment B and pass it back to fragment A. I've found one possible solution to my problem - shared view models. Unfortunately, this approach has one problem because I can pass and modify values between screens, but when

Android Navigation Drawer ListView Headers

做~自己de王妃 提交于 2019-12-09 19:15:42
问题 I've made a navigation drawer in my app. Inside my navigation drawer is a ListView . It's a simple list view with text items. The Gmail android app has a ListView with headers. (source: phonedog.com) As you can see, the words: INBOX, RECENT LABELS, ALL LABELS are headers. I would like to implement exactly those type of headers into my app. Is this feature an inbuilt android thing or do I have to create something custom. If yes then how. Let me know if you need any more info. Thanks in Advance

How to add draggable icon with navigation drawer

强颜欢笑 提交于 2019-12-09 12:24:26
问题 My problem: I want to add draggable icon in navigation drawer. This icon combined with listview of navigation drawer when drawer open. see similar like this, What I have tried, I searched in StackOverflow like similar question this, Draggable drawer with a handle (instead of action bar) on top of other apps But all answer suggest to 3rd party library. My question 1.It`s possible to add draggable icon with navigation drawer? 回答1: For drag layout there is github library which is useful for it

Is navigation in iosched 13 application correct?

岁酱吖の 提交于 2019-12-05 09:01:56
Navigation with Up and Back buttons is quite complicated (at least for me) As the android documentation states, You have the ability to make the Up behavior even smarter based on your knowledge of detail view. Extending the Play Store example from above, imagine the user has navigated from the last Book viewed to the details for the Movie adaptation. In that case, Up can return to a container (Movies) which the user hasn't previously navigated through. http://developer.android.com/design/media/navigation_between_siblings_market2.png I am exploring Google IO 2013 application for best practices

Android : Return to previous fragment on back press

為{幸葍}努か 提交于 2019-12-04 16:58:00
问题 I have implemented Navigation Drawer which is a subclass of Activity. I have many fragments in my application. My question goes here Imagine there are 3 fragments : Fragment_1 : Fragment_2 : Fragment_3 When I start my application, Fragment_1 is loaded When I click on some components on Fragment_1, I'm navigated to Fragment_2 and so on.. So it's like Fragment_1 > Fragment_2 > Fragment_3 When I press back key from Fragment_2, I'm navigated back to Fragment_1 But when I press back key from