Issue I’m wondering how to pass runtime parameters to a ViewModel’s constructor while using Hilt for DI? Prior to using Hilt, I have a ViewModel that looks like this: class ItemViewModel(private val itemId: Long) : ViewModel() { private val repo
Continue readingTag: android-fragments
getParent() on Fragment View returns null in onResume() after rotation
Issue I have the following code in onResume() in a custom fragment that extends ListFragment, which tries to find its parent: @Override public void onResume() { super.onResume(); System.out.println("resume"); View view = getView(); System.out.println("view is " + (view != null ?
Continue readingFragment's onOptionsItemSelected doesn't get called
Issue My fragment replaces the parent Activity options with a specific option item but when I click on the item, only activity’s onOptionItemSelected gets called eventhough I’ve overridden the method inside Fragment. Am I missing something? Fragment’s methods: @Override public
Continue readingRecycler View Not Showing
Issue I have been making an app that uses a recycler view in a navigation drawer. Why the contents of the recycler view are not showing up. The view is definitely there as I can see the scroll shadows. I
Continue readingRecycler View Not Showing
Issue I have been making an app that uses a recycler view in a navigation drawer. Why the contents of the recycler view are not showing up. The view is definitely there as I can see the scroll shadows. I
Continue readingRuntimeException: API key not found. Check that geo.API_KEY is in the AndroidManifest.xml
Issue I am attempting to compile a simple map display on my my phone, but the app keeps closing. It seems that all my ducks are in a row, but I’m just stumped. This is my first time working with
Continue readingClicking on item of Navigation Drawer doesn’t open fragments
Issue I want to use the default Navigation Drawer Activity of Android Studio (v. 3.5). After creating this default activity (New Project –> Navigation Drawer Activity) I started this templet. If I click on one of the icons of the
Continue readingHow to clear navigation Stack after navigating to another fragment in Android
Issue I am using The new Navigation Architecture Component in android and I am stuck in clearing the navigation stack after moving to a new fragment. Example: I am in the loginFragment and I want this fragment to be cleared
Continue readingViewPager menu icon delay when swiping
Issue When swiping between tabs on my application, the menu icons have a distinct delay before they appear. If I click tabs, rather than swiping, they update immediately. I have different menu.xml files for each fragment, and inflate them inside
Continue readinggetParent() on Fragment View returns null in onResume() after rotation
Issue I have the following code in onResume() in a custom fragment that extends ListFragment, which tries to find its parent: @Override public void onResume() { super.onResume(); System.out.println("resume"); View view = getView(); System.out.println("view is " + (view != null ?
Continue reading