how to hide BottomNavigationView on android-navigation lib

You could do something like this in your activity’s onCreate. When ever an item in the nav bar is selected it will show or hide the nav based on the fragment id’s. private fun setupNav() { val navController = findNavController(R.id.nav_host_fragment) findViewById<BottomNavigationView>(R.id.bottomNav) .setupWithNavController(navController) navController.addOnDestinationChangedListener { _, destination, _ -> when (destination.id) { R.id.mainFragment -> showBottomNav() R.id.mineFragment … Read more

Android Jetpack Navigation with ViewPager and TabLayout

Experimented with different approaches to handle TabLayout with Jetpack Navigation. But hit issues like having a full history of switching between tabs multiple times etc. Browsing known Google Android Issues before raising a request for a demo, I found this existing issue. Its status is Closed marked as Intended Behavior with the following explanation: Navigation … Read more

Android Navigation Component back button not working

if you are using setupActionBarWithNavController in Navigation Component such as: setupActionBarWithNavController(findNavController(R.id.fragment)) then also override and config this methods in your main activity: override fun onSupportNavigateUp(): Boolean { val navController = findNavController(R.id.fragment) return navController.navigateUp() || super.onSupportNavigateUp() } My MainActivity.kt class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) setupActionBarWithNavController(findNavController(R.id.fragment)) } override fun onSupportNavigateUp(): … Read more

How to resume activity instead of restart when going “up” from action bar

Should’ve added as an answer instead of a comment.. but here you go so you can accept if you want so others can see if necessary. https://stackoverflow.com/a/16147110/3286163 Basically, to summarize the android will always recreate the activity unless you specify it not to with android:launchMode=”singleTop” Note: it will not work if the returning activity is … Read more

Navigation Drawer item background colour for selected item

To solve this problem: 1- You don’t need android:listSelector under your ListView. 2- Open (or Create) styles.xml under (res/values). <!– Base application theme. –> <style name=”AppTheme” parent=”Theme.AppCompat.Light.DarkActionBar”> <!– Customize your theme here. –> <item name=”android:activatedBackgroundIndicator”>@drawable/drawer_list_selector</item> </style> 3- Under res/drawable folder create drawer_list_selector.xml file <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:state_pressed=”true” android:drawable=”@drawable/light_gray_color” /> <item android:state_activated=”true” android:drawable=”@drawable/red_color” /> <item android:drawable=”@android:color/transparent” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)