Am trying to commit data to a room database ```App...
# android
s
Am trying to commit data to a room database
Copy code
AppExecutors.getInstance().diskIO().execute(new Runnable(){

    @Override
    public void run() {
        appDatabase.UIDao().insertUI(UI);
    }
});
but I’m getting an error`Attempt to invoke virtual method 'com.journaldev.firstandroidassignment.dao.UIDao com.journaldev.firstandroidassignment.database.AppDatabase.UIDao()' on a null object reference.` Any help would be much appreciated
f
Sounds to me that appDatabase is null
Also, that's Java, not Kotlin 🤔
s
Maybe you haven’t initialized
appDatabase
since the error is saying that it’s null.