我想从 Firestore 检索字段作为列表数组
在这个恐怖字段中是“地图”我想检索印地语文档中的所有字段作为数组,如图所示
public class HindiStory extends AppCompatActivity {
private static final String TAG = "HindiStory";
List<String> list;
FirebaseFirestore db = FirebaseFirestore.getInstance();
private DocumentReference hindiStoryref = db.collection("story").document("HINDI");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hindi_story);
}
public void hmoral(View v){
hindiStoryref.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.isSuccessful()) {
list = new ArrayList<>();
Map<String, Object> map = task.getResult().getData();
for (Map.Entry<String, Object> entry : map.entrySet()){
list.add(entry.getKey());
Log.d(TAG, entry.getKey());
}
}
}
});
}
public void hromantic(View v){
}
}
我想在单击按钮时检索
并在另一个活动中使用列表视图中的此数组数据谢谢