Skip to content
Advertisement

Tag: android

How to finish an Activity inside a dialog? I called finish(); and SecondActivity.this.finish(); but they didn’t work

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

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

Advertisement