In the first case, finish() works properly, but it doesn’t work inside the dialog. This code is from second Activity, in the first case when I call finish() it finishes and return back to MainActivity but in the second case inside the dialog when I call finish(); the app crashes. I can do something like startActivity(new Intent(getBaseContext(), MainActivity.class)); inside the
Tag: android
Why does my Android studio App crash when I spam click at the beginning of an activity?
The app works fine if I wait a bit after clicking play, but if I want click on anything clickable right away, the app crashes. Here is the error message: Here is my GameView class: Answer The call stack tells you that in the method Joystick.getIsPressed you are trying to convert a Boolean object to a boolean by invoking booleanValue()
Use same GPS location code on multiple fragments
I want to make an application that will include five different fragments. In each fragment I need the GPS location of the device but the purpose will be different. In order not to implement FusedLocationProviderClient five times for each fragment, I was thinking of doing this once in MainActivity and sending the results to the displayed fragment. Being a beginner
Firebase Database gives null values
This is my Firebase Database snippet I am trying to get the name of the expense and the expense amount and set it into a RecyclerView. This is my adapter for the RecyclerView: This is my POJO class for Expense Model This is my code snippet The log shows that every value in the expense class has been set to
How can I do an Android retrofit 2 recyclerview interface?
Here is my code. My adapter: And my interface: This is where I am failing. Here is my failing home fragment page. Where is the problem? Answer Instead of this, write something like HomeFragment.this. I assume that HomeFragment implements IOtobusSaatleriInterface.
how can i get all the data in document firestore?
current i am working to my school project using android studio, it is an attendance system where I store my data to Firestore and the user are able to download/export the data to become Excel file. What I am trying to do is how can I get the all data in a single document of a Collection in firestore here’s
how to make a cardview with a icon in the center with the text below it?
I want to make 2 rows and 3 columns card view with text below it (not inside the card view) and an image in the center of the card view. Answer try this Just Copy and Paste your xml layout
How to get Each value from Firebase?
How can I get each value from Firebase and set it to my variable (Lat&Long) My Code : and The log result said Answer Since you’re using Java, here is the code that can help you read the value of Lat, as well the value of Long: As you can see, there is no need for any loop. You can
Android NullPointer Attempt to invoke virtual method ‘boolean java.util.ArrayList.add(java.lang.Object)’ on a null object reference
I’m getting this error: java.lang.NullPointerException: Attempt to invoke virtual method ‘boolean java.util.ArrayList.add(java.lang.Object)’ on a null object reference and just to make it clear is that I know others with the same issue have asked the same question and I have read the solutions which are usually that you have to instantiate your ArrayList which however I am obviously doing but
Java – getCardBackgroundColor – color for CardView
Can you help me with my code? I am changing the color of the item based on the information from the database, and now I wanted to transfer the color to the CardView, but I don’t know what the notation should look like, because this code tells me that the Color.RED write is wrong. Will you help me? Answer You