Empty spaces in recyclerView when trying to hide cards with null properties Hi, i’m new here. So this is my first question. I am trying to use the google Books API for a task and when I implement everything, I see many books without image, title or author, that for obvious reasons I do not want them to appear in
Tag: android-studio
./gradlew The operation couldn’t be completed. Unable to locate a Java Runtime
When I run ./gradlew from project folder I get: The same with java: I installed JDK in Android studio, seems it’s installed in ~/Library/Android/sdk/sources/android-28 Setting export JAVA_HOME=/Users/mrgloom/Library/Android/sdk/sources/android-28/ or export JAVA_HOME=/Users/mrgloom/Library/Android/sdk produce error like: How to specify java path for gradlew ? Answer Using JDK shipped with Android Studio and setting export JAVA_HOME=/Applications/Android Studio.app/Contents/jre/Contents/Home helped me.
I cannot set a onclick listener for image button
Error: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ‘void android.widget.ImageButton.setOnClickListener(android.view.View$OnClickListener)’ on a null object reference Answer 1)You forgot about setContentView(R.layout.YOURLAYOUT) after super.onCreate 2)Make sure, that your XML file have the same ImageView ID
I want to get the value with round but not getting proper result
I want to get the result with round the value please see the attached image. What is wrong with it. The result should be : 18.59 I have used float instead of double. MRE: Observed output: 18.58 Answer The problem The problem is not in the rounding. The problem is in the value that you are rounding. You think the
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. Error
I want to publish a library with Jitpackio. When I publish the library I get the following error; Gradle Version : 7.0.2 My Gradle JDK Version Can you help me? Answer The problem was that JitPack.io was running with JDK1.8 on its own. Add a jitpack.yml file to the project file with this content: When I did that the problem
ConstraintLayout braking after displaying Android Studio
I am currently working on an android app, and I’m having an issue with displaying XML layout In Android Studio, everything looks fine, but in the VM it doesn’t look too good. This is how it looks in Android Studio: And here is how it looks like when it’s displayed in VM: I should probably mention that it is supposed
Show/hide Searchview using onOptionsItemSelected
I want to make my Searchview to be visible only when I open product option from the drawer, to do that I am trying using onOptionsItemSelected method to listen which options is being used. The problem is I am always get a NullPointerException everytime I tried to get my SearchView id from onOptionsItemSelected. I knew how to hide the SearchView
How to get perfect UTC Time in java/android?
I am trying to get UTC time in my application but unfortunately every time I am getting my current emulator Date and Time Instead of UTC. Tried, Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(“UTC”)); ZonedDateTime utcTime = ZonedDateTime.now(ZoneOffset.UTC); DateTime now = DateTime.now(DateTimeZone.UTC); My code: Any help highly appreciated. Answer Try this code:
BottomNavigation, FragmentManager has not been attached to a host
I have moved BottomNavigation codes from MainActivity to A class I have created for the BottomNaviction to make the code more organizing. When I moved the codes I got this error java.lang.RuntimeException: Unable to start activity ComponentInfo{com.moataz.mox/com.moataz.mox.ui.view.activity.MainActivity}: java.lang.IllegalStateException: FragmentManager has not been attached to a host. Short error message FragmentManager has not been attached to a host. And The error
How do I save the state of CheckedTextView checkbox so it stays checked after exiting?
So I kinda screwed up while making the checkedtextviews, didn’t realise i needed to save the state, I don’t know how exactly to do it. Any advice would be greatly appreciated. Answer I’m not familiar saving data yet, I know that there is a lot of ways of doing that so i’ll give one example: Before that here is a