android-jetpack

Navigation Architecture component- How to refresh a fragment?

落花浮王杯 提交于 2020-12-08 05:57:06
问题 I have a ListFragment that has a recyclerview and onClick on any items opens the DetailsFragment. The details fragment contains another recyclerview on the bottom that shows "MORE ITEMS". Now onClick on any of these items should open the DetailsFragment for that particular item. Basically the fragment needs to be refreshed. In the past, I would just replace fragment using fragmentManager. How do I go about refreshing the fragment? How can I create an action that points to the same fragment?

How to change Bottom Navigation Text appearance in right side of the icon

て烟熏妆下的殇ゞ 提交于 2020-12-06 13:52:48
问题 I want to create a Bottom Navigation Bar in which text should be aligned right side of the icon. default implementation displays the text below the icon. XML: <com.google.android.material.bottomnavigation.BottomNavigationView android:id="@+id/bottom_nav_bar" style="@style/Widget.MaterialComponents.BottomNavigationView.Colored" android:layout_width="match_parent" android:layout_height="wrap_content" app:itemIconTint="@color/selector_icon_tint_bottom_nav" app:itemTextColor="@color/selector_icon

Navigation Component: pass safeArgs from activity to a fragment

北城余情 提交于 2020-11-27 05:05:51
问题 I have two graphs, so the first graph move from one fragment to an activity passing safeArgs to the activity. val action = MyFragmentDirections.actionMyActivity(arg1, arg2) Navigation.findNavController(view).navigate(action) Now in the second, I want to pass these arguments from MyActivity to a fragment which belongs to this activity. I can get the args: val args = MyActivity.fromBundle(intent.extras) The problem is there is not a Directions file for this activity, so I can't pass the

Navigation Component: pass safeArgs from activity to a fragment

こ雲淡風輕ζ 提交于 2020-11-27 05:02:53
问题 I have two graphs, so the first graph move from one fragment to an activity passing safeArgs to the activity. val action = MyFragmentDirections.actionMyActivity(arg1, arg2) Navigation.findNavController(view).navigate(action) Now in the second, I want to pass these arguments from MyActivity to a fragment which belongs to this activity. I can get the args: val args = MyActivity.fromBundle(intent.extras) The problem is there is not a Directions file for this activity, so I can't pass the

Android Navigation Url Deep Link Back to Previous App

为君一笑 提交于 2020-11-25 03:42:48
问题 My app has just two destinations, FirstFragment and SecondFragment . I created an url Deep Link for the SecondFragment and it works fine. What I want is, after I enter the SecondFragment from the Deep Link, I want to go back to the previous app when I press the Back button. But now it always go back to the FirstFragment . I have set my MainActivity to singleTask on launchMode and tried the following but doesn't work: override fun onNewIntent(intent: Intent?) { super.onNewIntent(intent) intent

Android Navigation Url Deep Link Back to Previous App

主宰稳场 提交于 2020-11-25 03:42:17
问题 My app has just two destinations, FirstFragment and SecondFragment . I created an url Deep Link for the SecondFragment and it works fine. What I want is, after I enter the SecondFragment from the Deep Link, I want to go back to the previous app when I press the Back button. But now it always go back to the FirstFragment . I have set my MainActivity to singleTask on launchMode and tried the following but doesn't work: override fun onNewIntent(intent: Intent?) { super.onNewIntent(intent) intent