从firebase数据库中检索数据并在Android中的导航抽屉标题中显示

时间:2016-11-14 11:27:08

标签: android firebase firebase-realtime-database

如何从firebase数据库中检索用户配置文件信息并将其显示在导航抽屉标题中?

     @Override
       public void onDataChange(DataSnapshot dataSnapshot) {
        Map<String, String> map = dataSnapshot.getValue(Map.class);
           String firstname = map.get("firstname");
           String lastname = map.get("lastname");
           String phone = map.get("phone");

           Log.v("E_VALUE", "firstname : " + firstname);
           Log.v("E_VALUE", "lastname : " + lastname);
           Log.v("E_VALUE", "phone : " + phone);
       }

       @Override
       public void onCancelled(DatabaseError databaseError) {

       }
   });

}

0 个答案:

没有答案