Error In Firebaselistadapter.startlistening()
Hi I've got a problem with my Firebase. When I debug my app i've got error java.lang.NullPointerException: Attempt to invoke virtual method 'void com.firebase.ui.database.Firebas
Solution 1:
You have this:
@OverrideprotectedvoidonStart() {
super.onStart();
adapter.startListening();
}
Now onStart()
is an activity lifecycle, and here you are starting to listen for values.
The activity life cycle is like this:
onCreate()>onStart()>onResume()
Those three methods are called so your activity appears infront of you. And since you are using adapter
inside onStart()
, then the initialization of the adapter needs to be in the method before it which is onCreate()
. So this adapter = new FirebaseListAdapter<ChatMessage>(options) {...}
has to be inside onCreate()
.
Post a Comment for "Error In Firebaselistadapter.startlistening()"