Android 使用异步任务在实时Firebase中提交大量值?
提交大量值(如“2000”)时是否需要使用异步任务实时Firebase数据库的值与否?移动客户端的Firebase API在读写数据时都是异步的,因此您不需要在Android 使用异步任务在实时Firebase中提交大量值?,android,firebase,firebase-realtime-database,Android,Firebase,Firebase Realtime Database,提交大量值(如“2000”)时是否需要使用异步任务实时Firebase数据库的值与否?移动客户端的Firebase API在读写数据时都是异步的,因此您不需要在AsyncTask中执行,在提交大量值(如“2000”)时是否需要使用async task 是 Firebase API使用manithread以完整的方式使用,因此,如果您有大量数据和图像,那么您的cpu将占用更多的时间,从而使您的ui冻结…因此,为了避免这种情况,您需要使用后台线程 示例 class Myuploadtask ext
AsyncTask
中执行,在提交大量值(如“2000”)时是否需要使用async task
是
Firebase API使用manithread以完整的方式使用,因此,如果您有大量数据和图像,那么您的cpu将占用更多的时间,从而使您的ui冻结…因此,为了避免这种情况,您需要使用后台线程
示例
class Myuploadtask extends AsyncTask<String,String,String>{
@Override
protected String doInBackground(String... strings) {
upload_5Images(); //call here
return null;
}
}
private void upload_5Images(){
//do you upload functions
}
类Myuploadtask扩展了AsyncTask{
@凌驾
受保护的字符串背景(字符串…字符串){
上传_5Images();//在此处调用
返回null;
}
}
私有void上传_5Images(){
//你上传功能吗
}
注意:我面临着同样的问题,比如上传大量数据时,我的progressdialog在使用后台线程时被击中
解决了。所以我的建议,如果你拥抱数据上传更好地使用
背景线程