My RecyclerView does not call onCreateViewHolder, onBindViewHolder even MenuViewHolder constructor, therefore nothing appears in RecyclerView. I put logs for debugging, and no log is shown. What might be the problem? My adapter: My custom row XML: and my Fragment: Answer Your getItemCount method returns 0. So…
Tag: android
Android Null Pointer Exception for onclick listener
The following code is giving me null pointer exception even though I can’t find anything wrong with the code. Tried commenting it out and it seems to be working. But still not able to find out what is wrong with the code? tried my own trouble shooting of commenting out the code and such and right now th…
Why show java.lang.ClassCastException: android.text.SpannableString cannot be cast to java.lang.String?
When copying String from any browser page, pasteData works properly. However when copying SpannedString from a message sent item editor(field), the application crashes and shows this error message: My code: where the ClipboardManager instance defined as clipBoard, below: All I’m trying to do is use past…
RealmObject AND Parcelable
I’m new to Realm for Android so I’m not sure I’m approaching this the right way. I have a class which looks like this: The problem is the Parcelable interface contains methods like describeContents() writeToParcel() and RealmObjects aren’t supposed to have methods other than getters an…
contains() method not working as expected
I am building a voice assistant for android, here this method retrieves contact names one by one and compares it to to SpeechToText input. I am successfully getting the contact names, but when I am comparing it with my input text, nothing is happening. Here is the code Here for example I sending “call k…
JDK error when trying to start Android Studio
I have just switched from Windows7 to Windows8.1 and I’m having trouble making Android Studio work now. I have installed Android Studio and the JDK. First I tried it out with the latest versions Android Studio v.0.8.14 and JDK 1.8, but I could not get it to work. I then tried to use the versions I used …
Fragments inside LinearLayout – Android
I’m new with fragments and I try to use these. My xml from activity is: And I want to change the fragment inside of LinearLayout, my class of mainActivity is: And my PlaceHolderFunctions are: Why doesn’t work when I press the button? What do I doing bad? Srry for my english and thanks in advance! …
Hide keyboard when navigating from a fragment to another
I have a Fragment that contains an Edit Text. When the Edit Text is pressed, the keyboard is being shown. When pressed the Save button in the upper corner, the application returns to the previous fragment, but the keyboard persists. I would like the keyboard to be hidden when navigating to the previous fragme…
Cannot start this animator on a detached view! reveal effect
I’m trying to create the reveal effect in my application but without success. What i want is reveal a cardview when i open a fragment. What i tried so far is: and in the onCreateView i started the method: this is the cardview: and the logcat: Checking, seems that getWidth() and getHeight() returns 0. Bu…
Android 5.0 – Add header/footer to a RecyclerView
I spent a moment trying to figure out a way to add a header to a RecyclerView, unsuccessfully. This is what I got so far: The LayoutManager seems to be the object handling the disposition of the RecyclerView items. As I couldn’t find any addHeaderView(View view) method, I decided to go with the LayoutMa…