addListenerForSingleValueEvent does not execute the code inside onDataChange()

我是研究僧i 提交于 2020-07-10 10:25:26

问题


I am just trying to do a simple program (in Android Studio). I have used addListenerForSingleValueEvent(). But the code inside onDataChange() does not execute at all.

dbref.addListenerForSingleValueEvent(new ValueEventListener() {
    @Override
    public void onDataChange(DataSnapshot snapshot) {
        Log.d("TAG", "message");
    }
    public void onCancelled(DatabaseError error) {
        Log.d("TAG", error.toString());
    }
});

Nothing is displayed in Log.

来源:https://stackoverflow.com/questions/62774908/addlistenerforsinglevalueevent-does-not-execute-the-code-inside-ondatachange

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!