I have a strange issue. My app is using http to connect to a server. It works fine in many devices. However, in Xiaomi devices which has Android 9, it gives me this error: In the AndroidManifest.xml I have this: My network_security_config.xml file: Also, I have all the permission to connect to the internet. I…
Java Bubble Sort String ArrayList Object
Can someone find why this isn’t being sorted I can’t seem to find what I have wrong? The output that is being displayed is how I input them after each other thus the sort method isn’t working… Answer There are three errors: 1. It does i++ instead of i+1. i++ means: return i then increm…
What is active thread group in Java?
There is method java.lang.ThreadGroup.activeGroupCount() returns an estimate of the number of active groups in a thread group. In response to this question, the active thread is defined. But what does active thread group mean? Answer As you noted, the terminology “active thread group” appears in t…
Unable to create a folder by executing a shell script using java
I was trying to execute shell scripts using java code. The following is a sample code to demonstrate the issue : The shell script file test1.sh that I am trying to execute : I am getting echo message and was able to print in the java console indicating that the shell script is executed successfully. But no di…
Getting the current User information from Firebase Realtime Database
I developed a login app in Java where the user can login using their emailaddress and password. This works fine so far, but I have the problem that my UserModel.java is null when I get to my home activity. This also makes sense to me since Firebase Auth only checks the email and password and does not select t…
No static method metafactory
I have an issue with my app that when I log in, the app crashes and I get the error: I have tried to mess with the gradle and change variables. The issue seems to stem from this package: It then gives to another reference to: Here is my gradle: How can I find the method to fix the error?
How do I load SVG String into ImageView
I have an SVG string <svg xmlns=”http://www.w3.org/2000/svg” viewBox=”0 0 60 30″ width=”1200″ height=”600″><clipPath id=”a”><path d=”M30 15h30v15zv15h-30zh-30v-15zv-15h30z”/></clipPath><path d=”M0 0v30h60v…
MVVM – get context in a Model class
I’m using MVVM to build my Android app and I need to connect the Model to a DB. Instead of Room I’m using the SQLiteOpenHelper and to make a connection to the DB I need the context. But since this is a non activity class I’m struggling to get it. My current solution looks as follows but I ke…
How do I verify that the snapshot is ongoing for a particular index in elastic search?
I have a business need to drop and re-create indices with new mappings. I have been doing that successfully until I encountered the following problem: Cannot delete indices that are being snapshotted. Try again after snapshot finishes or cancel the currently running snapshot. How do I check if the snapshot is…
Shorthand class constructor member initialisation
Writing simple constructors in Java is pretty verbose. For each field that needs to be initialised you need to write the variable name four times, e.g. like so: Is there a shorthand for that like e.g. in Kotlin? This question was asked before here: Shorthand class constructor field initialisation But that was…