Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/370.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/185.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
Java 以片段形式显示用户信息_Java_Android_Firebase_Google Cloud Firestore - Fatal编程技术网

Java 以片段形式显示用户信息

Java 以片段形式显示用户信息,java,android,firebase,google-cloud-firestore,Java,Android,Firebase,Google Cloud Firestore,我正在使用Android Studio 3.5 我用fragment构建了底部导航,然后我试图显示从Firebase商店检索到的用户信息,如(姓名-电子邮件-图像等)。。当到达: documentReference.addSnapshotListener(这是新的EventListener(){ @凌驾 public void onEvent(@Nullable DocumentSnapshot DocumentSnapshot, @可为空的FireBaseFireStore异常(e){ t_n

我正在使用Android Studio 3.5

我用fragment构建了底部导航,然后我试图显示从Firebase商店检索到的用户信息,如(姓名-电子邮件-图像等)。。当到达:

documentReference.addSnapshotListener(这是新的EventListener(){
@凌驾
public void onEvent(@Nullable DocumentSnapshot DocumentSnapshot,
@可为空的FireBaseFireStore异常(e){
t_name.setText(documentSnapshot.getString(“name”);
t_email.setText(documentSnapshot.getString(“电子邮件”);
}
});
它给了我一条红线在代码下。。。当单击Alt+Enter时,它会在应用程序无法工作的强制转换之前(此)给出解决放置强制转换(Executor)的结果

我不知道怎么解决它

注意:这是一个不在活动中的片段

如果我想显示从Firebase检索的图像。。。我怎么做

谢谢

帐户片段
公共类accountFragment扩展了片段{
弗斯;
FirebaseFirestore商店;
字符串用户标识;
TextView注销帐户、t_名称、t_电子邮件、t_国家/地区;
公共帐户片段(){
}
@凌驾
创建视图上的公共视图(布局、充气机、视图组容器、,
Bundle savedInstanceState){
//为该碎片膨胀布局
视图v=充气机。充气(R.layout.fragment\u账户,容器,假);
fAuth=FirebaseAuth.getInstance();
fStore=FirebaseFirestore.getInstance();
userID=fAuth.getCurrentUser().getUid();
t_国家=v.findViewById(R.id.t_国家);
t_email=v.findviewbyd(R.id.t_email);
t_name=v.findviewbyd(R.id.t_name);
DocumentReference=fStore.collection(“eng.users”).document(userID);
documentReference.addSnapshotListener(此,新的EventListener(){
@凌驾
public void onEvent(@Nullable DocumentSnapshot DocumentSnapshot,
@可为空的FireBaseFireStore异常(e){
t_name.setText(documentSnapshot.getString(“name”);
t_email.setText(documentSnapshot.getString(“电子邮件”);
t_country.setText(documentSnapshot.getString(“国家”);
}
});
}
Activity_account.xml

问题已解决

documentReference.addSnapshotListener (this, ...
使用


你在一个片段中

欢迎来到Stack Overflow mohamed!对于未来的问题,请仅使用
android studio
标记来回答有关android studio IDE本身的问题。对于一般的android编程问题,请使用
android
标记。
documentReference.addSnapshotListener (getActivity(), ...