I want to open a dialog fragment from A fragment, and pass data to A fragment when the dialog fragment ends. To do this, I defined an interface in the dialog fragment and implemented it in the A fragment. The result was that the listener was null. This is because onAttach() used context and context meant acti…
Tag: android
Retrieve subcollection data from Firestore in Android
I keep failed to retrieve the data from subcollection “Diary” when trying on click on a RecyclerView. What I want is when I on click on a RecyclerView, it will display that data stored in the “Diary”. What’s the problem with my codes? RecyclerView Java codes: Stored data Java cod…
AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant)
iOS developer here thrown to the wolves of an Android project. I am getting a few error codes that all say something similar to ThemeUtils: View class androidx.appcompat.widget.AppCompatTextView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant). as soon as the following…
How to get random qestion from firebase firestore database
i m making a quiz app, in which i have categories, when i choose a category, qestions start coming from firebase firestore database , in each category i have 10 qestion in database , i want that all qestions load from firebase data base and comes in random order each time , but my problem here is all qestions…
Android FCM notification is not received when app is close or Killed
I implemented FCM Push Notifications. The main problem is when app is closed, notifications not arrive when this happen on device. I tried a lot of thigs for that works; when notification sent the server response with “success”, but I never received. Manifest.xml Answer Try adding enabled=”t…
When you change attributes in an xml file, which constructor of custom view is called?
I am creating my own custom view. Here is the code for MyCustomView.java And my main_layout.xml file: My question is: If I change the attributes of the custom view in the .xml file, will the 2nd or 3rd constructor of MyCustomView.java file be called? Answer As described by @Zain answer the two-argument constr…
Issue on implementing ViewPager2 with FragmentStateAdapter
I am from ViewPager with FragmentPagerAdapter which has a very straight forward implementation like this. Parent Fragment Android recommends moving away from ViewPager and deprecating the beloved FragmentPagerAdapter, now I am trying to work with ViewPager2 with FragmentStateAdapter but having a lot of confus…
video streaming on Fragment of an android app
i want to stream a video from the firebase storage, in a fragment of my android app. but what even i try my video doesn’t launch or the app crash when i request the fragment. being a beginner, i have followed a tuto so i used exoplayer. this is my fragment code: in addiction with : And the xml file
Class ‘kotlin.reflect.KClass’ is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
After I converted my java code to Kotlin. There is an issue in this code ViewModelContactUs::class.java in this code part java is in red and does not work and says Returns a Java Class instance corresponding to the given KClass instance. Answer I removed this version below from my app/build/gradle file ext.ko…
What is the difference between getLayoutPosition() and getAdapterPosition()?
What is the difference between getAdapterPosition() and getLayoutPosition? https://proandroiddev.com/difference-between-position-getadapterposition-and-getlayoutposition-in-recyclerview-80279a2711d1. I have read this article, but don’t really understand the part about getLayoutPosition() Please explain …