小编Ayu*_*waj的帖子

我们是否需要使用后台线程来使用firebase检索数据?

我有一个Android应用程序,我正在将数据检索到Fragment中.我相信Firebase可以管理其异步调用.但我仍然怀疑我们是否需要在后台线程中编写Firebase代码?

如果我们需要将它写入后台线程,那么请告诉您哪些操作需要更多时间.例如:

mDatabase = FirebaseDatabase.getInstance().getReference().child("Blog");
Run Code Online (Sandbox Code Playgroud)

我认为在主UI线程上执行此操作可能会充满风险,因为设置数据库之间的连接可能需要花费很长时间.

multithreading android firebase firebase-realtime-database

12
推荐指数
1
解决办法
5593
查看次数

使用字符数组反转字符串

我编写了一个程序来反转字符串,其中字符串是一个字符数组.该计划是:

#include<iostream>
void rev(char *str)
{
  char *end;
  end = str;// end will now point to the same address of str
  // now we need to incremet the end pointer upto it encounter null
  if(str)// this checks if the string is present or not
  {
    while(*end)
      ++end;
    --end;// set one character back, since last character is null
    // swap characters from start of string with the end of the string
    // until the pointers meet in middle.
    while(str < end) …
Run Code Online (Sandbox Code Playgroud)

c++ arrays string pointers

0
推荐指数
1
解决办法
363
查看次数