android-architecture-navigation

Kotlin - fragment lifecycle navigation issues; why does child fragment become current destination?

匆匆过客 提交于 2021-01-29 09:17:25
问题 Kotlin/Android novice. Please bear with me. My app has the following navigation scheme: BottomNavigationView with navigationController where fragment One, Two and Three are "top destinations", from which I look to navigate further down in the navigation hierarchy. I implemented the scheme following this video tutorial. MY ISSUE Fragment Three is a QR-code scanner. Upon successful scan I aim to navigate to fragment X. However, when I reach the point of navigation, fragment X has become

Android BottomNavigationView leave blank space after being removed/hidden

你离开我真会死。 提交于 2021-01-29 07:42:56
问题 When user in not authenticate, it goes to Login fragment, if he's authenticate it goes to home fragment. When unauthenticated user open the app, the bottomNavView should be hidden, it is but it leaves a blank space. class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val navigationController = findNavController(R.id.nav_host_fragment) val bottomNavigationView = findViewById

java.lang.IllegalArgumentException: navigation destination {actionId} is unknown to this NavController when Activity is recreated?

有些话、适合烂在心里 提交于 2021-01-29 05:06:23
问题 I am coming from reading all the answers in IllegalArgumentException: navigation destination xxx is unknown to this NavController with no luck. I am getting this when the activity is recreated from either a manual recreate() call or coming back from a process death. I have an Activity that changes its Fragments using Navigation . Fragment A has a FAB that navigates to Fragment B when clicked. floatingActionButton = view.findViewById<FloatingActionButton>(R.id.floating_action_button).apply {

Android Google Search Bar with Drawer

眉间皱痕 提交于 2021-01-28 19:39:47
问题 My app is currently implemented with the Single activity approach (Using navigation architecture component with one main activity and several fragments). I am currently using a toolbar with a drawer. My app currently look like this: However in the modern google apps (Google photos, gmail etc..), Google has implemented a new way of navigating using a search field with an implemented drawer in it as shown below: I want to replace this toolbar with a search bar and the drawer menu exactly like

how to open multiple instances of a fragment in navigation component?

两盒软妹~` 提交于 2021-01-28 08:01:55
问题 I working on a social media App. when user click on a post, a new fragment open and some related post showing under it. if user click on a related post, new instance of that fragment must open and show clicked post and related posts under it. this page also have this behavior. each page must add to back stack. for using navigation component, in this case destination fragment is current fragment with different argument. can do this in navigation component? 回答1: we can open multiple instace of

RecyclerView with StaggeredGridLayoutManager in ViewPager, arranges items automatically when going back to fragment

◇◆丶佛笑我妖孽 提交于 2021-01-28 04:55:22
问题 I am using Navigation component in my App, using google Advanced Sample(here). my problem is when going back to a fragment, t he scrolling position does not lost but it rearranges items and moves highest visible items so that top of those item align to top of recyclerview. please see this: before going to next fragment: and after back to fragment: this problem is matter because some times clicked item goes down and not seen until scroll down. how to prevent this behavior? please consider:

is it normal if my image from camera in ImageView disappear after segue to another fragment using navigation component?

☆樱花仙子☆ 提交于 2021-01-25 01:58:19
问题 I try to capture an image using camera then the image result will be placed on my ImageView in a fragmentA like the code below, so it it NOT fetching an image path from Server then place it in ImageView using Glide Library, I take an image from camera. val image_uri = Uri.fromFile(photoFile) photoImageView.setImageURI(image_uri) and then, I move to next destination using this code (from fragmentA to fragmentB) val toFragmentB = AFragmentDirections.actionGlobalBFragment() findNavController()

is it normal if my image from camera in ImageView disappear after segue to another fragment using navigation component?

非 Y 不嫁゛ 提交于 2021-01-25 01:55:49
问题 I try to capture an image using camera then the image result will be placed on my ImageView in a fragmentA like the code below, so it it NOT fetching an image path from Server then place it in ImageView using Glide Library, I take an image from camera. val image_uri = Uri.fromFile(photoFile) photoImageView.setImageURI(image_uri) and then, I move to next destination using this code (from fragmentA to fragmentB) val toFragmentB = AFragmentDirections.actionGlobalBFragment() findNavController()

is it normal if my image from camera in ImageView disappear after segue to another fragment using navigation component?

空扰寡人 提交于 2021-01-25 01:48:15
问题 I try to capture an image using camera then the image result will be placed on my ImageView in a fragmentA like the code below, so it it NOT fetching an image path from Server then place it in ImageView using Glide Library, I take an image from camera. val image_uri = Uri.fromFile(photoFile) photoImageView.setImageURI(image_uri) and then, I move to next destination using this code (from fragmentA to fragmentB) val toFragmentB = AFragmentDirections.actionGlobalBFragment() findNavController()

is it normal if my image from camera in ImageView disappear after segue to another fragment using navigation component?

拥有回忆 提交于 2021-01-25 01:47:25
问题 I try to capture an image using camera then the image result will be placed on my ImageView in a fragmentA like the code below, so it it NOT fetching an image path from Server then place it in ImageView using Glide Library, I take an image from camera. val image_uri = Uri.fromFile(photoFile) photoImageView.setImageURI(image_uri) and then, I move to next destination using this code (from fragmentA to fragmentB) val toFragmentB = AFragmentDirections.actionGlobalBFragment() findNavController()