Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/218.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Firebaseui未检索所有数据_Android_Listview_Firebase_Firebase Realtime Database_Firebaseui - Fatal编程技术网

Android Firebaseui未检索所有数据

Android Firebaseui未检索所有数据,android,listview,firebase,firebase-realtime-database,firebaseui,Android,Listview,Firebase,Firebase Realtime Database,Firebaseui,我正在我的应用程序上做一个功能,用户可以在其中发布注释。我用firebase来做这件事。但是,我使用FirebaseUI将firebase中的数据绑定到listview。我正在使用FirebaseListAdapter函数从firebase获取数据,并将其填充到listview中 我意识到它并没有检索所有应该检索的数据。它只返回一个项目。我不确定是什么问题,因为我正确地遵循了教程 下面是假定使用FirebaseUI函数填充listview的函数: public void setNoteList

我正在我的应用程序上做一个功能,用户可以在其中发布注释。我用firebase来做这件事。但是,我使用FirebaseUI将firebase中的数据绑定到listview。我正在使用FirebaseListAdapter函数从firebase获取数据,并将其填充到listview中

我意识到它并没有检索所有应该检索的数据。它只返回一个项目。我不确定是什么问题,因为我正确地遵循了教程

下面是假定使用FirebaseUI函数填充listview的函数:

 public void setNoteListData(String locationKey){
    String accessPoint = FirebaseHelper.LocationNotesUrl + locationKey;
    firebaseNoteRef  = new Firebase(accessPoint);

    noteAdapter = new FirebaseListAdapter<Note>(MainActivity.this, Note.class, R.layout.view_notelist, firebaseNoteRef) {
        @Override
        protected void populateView(View vi, Note note, int position) {

            Log.v("Discoverify", "Position: " + position );

            ((TextView) vi.findViewById(R.id.note_username)).setText(note.getUsername());
           new DownloadImageTask(((ImageView)vi.findViewById(R.id.note_avatar))).execute(note.getProfileImage());
            ((TextView)vi.findViewById(R.id.note_text)).setText(note.getNoteText());

        }
    };
    noteList.setAdapter(noteAdapter);
    UtilsDiscoverify.setListViewHeightBasedOnChildren(noteList);
}
Firebase引用应检索“459e0617-2355-495f-a939-76f49db991ae-07032016030827”的所有对象,但它仅返回第一个对象

这是Android日志作为文本:

04-21 08:46:39.014 21496-21496/com.example.rescobar.discoverify V/Discoverify: Postiion: 0 & text: What a really great house you have Reggie :3
04-21 08:46:39.015 21496-21496/com.example.rescobar.discoverify V/Discoverify: Postiion: 0 & text: What a really great house you have Reggie :3
04-21 08:56:09.821 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 12.941ms
04-21 09:00:23.127 21496-21511/com.example.rescobar.discoverify I/art: Debugger is no longer active
04-21 09:02:04.221 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 18.559ms
04-21 09:08:09.609 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 18.788ms
04-21 09:15:00.657 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 6.901ms
04-21 09:16:24.960 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 15.641ms
04-21 09:16:36.471 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 11.794ms
04-21 09:18:08.206 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 9.804ms
04-21 09:21:17.701 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 7.376ms
04-21 09:25:07.235 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 7.770ms
04-21 09:26:19.006 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 69.351ms
04-21 09:29:05.828 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 13.015ms
04-21 09:30:21.640 21496-21496/com.example.rescobar.discoverify V/Discoverify: Postiion: 0 & text: What a really great house you have Reggie :3
04-21 09:30:21.650 21496-21496/com.example.rescobar.discoverify V/Discoverify: Postiion: 0 & text: What a really great house you have Reggie :3
04-21 09:30:21.654 21496-21543/com.example.rescobar.discoverify I/OpenGLRenderer: Initialized EGL, version 1.4
04-21 09:30:21.727 21496-21496/com.example.rescobar.discoverify V/Discoverify: Postiion: 0 & text: What a really great house you have Reggie :3

检查FirebaseHelper.LocationNotesUrl+locationKey是否实际提供了该项的位置。查看它记录“位置0”的次数是否与FirebaseHelper中的数据相同您在问题中包含了一个指向JSON树图片的链接。请将其替换为实际的JSON作为文本,您可以通过单击Firebase数据库中的导出按钮轻松获得该文本。将JSON作为文本使其具有可搜索性,允许我们轻松使用它来测试您的实际数据,并在我们的答案中使用它,一般来说,这是一件好事。对于logcat btw来说也是如此。文本在一周中的任何一天都胜过所述文本的图片。我添加了JSON结构和Android日志作为文本,但是,很难找到Android日志。请检查FirebaseHelper.LocationNotesUrl+locationKey是否实际提供了该项的位置。查看它是否记录了FirebaseHelper中数据的“位置0”。您在问题中包含了指向JSON树图片的链接。请将其替换为实际的JSON作为文本,您可以通过单击Firebase数据库中的导出按钮轻松获得该文本。将JSON作为文本使其具有可搜索性,允许我们轻松使用它来测试您的实际数据,并在我们的答案中使用它,一般来说,这是一件好事。对于logcat btw来说也是如此。文本在一周中的任何一天都胜过所述文本的图片。我添加了JSON结构和Android日志作为文本,但是,很难伪造Android日志。
04-21 08:46:39.014 21496-21496/com.example.rescobar.discoverify V/Discoverify: Postiion: 0 & text: What a really great house you have Reggie :3
04-21 08:46:39.015 21496-21496/com.example.rescobar.discoverify V/Discoverify: Postiion: 0 & text: What a really great house you have Reggie :3
04-21 08:56:09.821 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 12.941ms
04-21 09:00:23.127 21496-21511/com.example.rescobar.discoverify I/art: Debugger is no longer active
04-21 09:02:04.221 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 18.559ms
04-21 09:08:09.609 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 18.788ms
04-21 09:15:00.657 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 6.901ms
04-21 09:16:24.960 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 15.641ms
04-21 09:16:36.471 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 11.794ms
04-21 09:18:08.206 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 9.804ms
04-21 09:21:17.701 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 7.376ms
04-21 09:25:07.235 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 7.770ms
04-21 09:26:19.006 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 69.351ms
04-21 09:29:05.828 21496-21511/com.example.rescobar.discoverify W/art: Suspending all threads took: 13.015ms
04-21 09:30:21.640 21496-21496/com.example.rescobar.discoverify V/Discoverify: Postiion: 0 & text: What a really great house you have Reggie :3
04-21 09:30:21.650 21496-21496/com.example.rescobar.discoverify V/Discoverify: Postiion: 0 & text: What a really great house you have Reggie :3
04-21 09:30:21.654 21496-21543/com.example.rescobar.discoverify I/OpenGLRenderer: Initialized EGL, version 1.4
04-21 09:30:21.727 21496-21496/com.example.rescobar.discoverify V/Discoverify: Postiion: 0 & text: What a really great house you have Reggie :3