正在调用上次onChildAdded时的Firebase

时间:2017-03-15 08:35:42

标签: android firebase firebase-realtime-database

我需要显示一个加载微调器。为此,我需要知道什么时候Firebase加载了所有的孩子。下面的函数只是随机调用一次,我不知道它是最后一次。查询记录数量也可以解决这个问题。

@Override
public void onChildAdded(DataSnapshot dataSnapshot, String previousChildKey) {
}

1 个答案:

答案 0 :(得分:1)

即时通讯使用此代码,效果很好。 您应该在myApp.service('fileUpload', ['$http', function ($http) { this.uploadFileToUrl = function(file,txt, uploadUrl){ var fd = new FormData(); fd.append('file', file); fd.append("txt",txt); $http.post(uploadUrl, fd, { transformRequest: angular.identity, headers: {'Content-Type': undefined} }) .success(function(d){ console.log(d) }) .error(function(){ }); } }]); 上使用//var myApp = angular.module('myApp', []); myApp.controller('myCtrl', ['$scope','fileUpload', function($scope, fileUpload){ $scope.uploadFile = function(){ var file = $scope.myFile; var txt = $scope.txtName; console.log('file is ' ); console.dir(file); var uploadUrl = "/uploads"; fileUpload.uploadFileToUrl(file,txt, uploadUrl); }; }]);

addListenerForSingleValueEvent是一个TextView,告诉用户如果没有孩子就没有帖子。 query是我的自定义progressBar。

有关详细信息,请参阅this回答

noViewTxtView
相关问题