Cannot create an instance of class com.example.retrotest.ui.AlbumsViewModel

All we need is a simple explanation of the problem, which is provided below. Got a error when I try to launch the app with the emulator. Try to look up the AlbumListFragment errors at line: 40 and 41. I can’t understand what I have done wrong. Have implemented this code severals times without errors. … Read more

Dynamic switching of fragments

All we need is a simple explanation of the problem, which is provided below. My Activity contains two buttons (Next and Back) and a fragment. When the Activity starts, it gets an array of resources. Such as {"Fish", "Bird", "Animal"}; Or this {"Fish", "Bird", "Animal", "Bird", "Bird"}; etc. Depending on the contents of the array, … Read more

BottomSheetListener throws null pointer exception even after initializing it below in onAttach

All we need is a simple explanation of the problem, which is provided below. I’m creating a modal bottom sheet which will get the filtering criteria from the user. I want to use it with Fragment (HomeFragment), and get the button selected from the BottomSheet inside my HomeFragment by passing the string values inside the … Read more

Why can't i send my ArrayList to another fragment?

All we need is a simple explanation of the problem, which is provided below. There are 2 fragments: A and B. From fragment A i want to send ArrayList (data) to fragment B. action() – a method in which data transfer and transition to fragment B should occur (using navigate()). The program builds without errors, … Read more

How to open an activity from a fragment using imagebutton?

All we need is a simple explanation of the problem, which is provided below. I have a Navigation drawer that has four different fragments. On the Home Fragment Dashboard, I have eight different image buttons that I want to open a new activity I.E. when you click the Image Button TM’s I want it to … Read more

How to Use recyclerview adapter layout objects in fragment?

All we need is a simple explanation of the problem, which is provided below. i have a fragment and a simple recyclerview. recyclerview have to item , a textview and a button for each item. i want when user clicked on plus button , the textview(counter) get increase or change , how i shoud do … Read more

How to get the currently displaying fragment in Nav Controller

All we need is a simple explanation of the problem, which is provided below. I use a singe activity and embed multiple fragments into it. Now I would like to know within the single activity class, which Fragment is currently being displayed. How can I do this? I had a look at the solution from … Read more

Visibilty gone layout of custom dialog from another function

All we need is a simple explanation of the problem, which is provided below. I have a custom dialog in kotlin fragment which have 2 button and a progress bar in fuction submitSpk() class RincianPembelianFragment : androidx.fragment.app.Fragment(), BlockingStep { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { val v = inflater.inflate(R.layout.fragment_spk_rincian_bayar, container, false) … Read more

Pass data between fragments and view pager2

All we need is a simple explanation of the problem, which is provided below. I have a main fragment and two fragments in view pager (About/Reviews). I call api to load data when navigation bar selected. I want to data model I have called api can be used between three fragments. I don’t want to … Read more