如何在RecyclerView或Logcat上获取此Firebase存储中的所有图像?

问题描述 投票:-1回答:1

这是Firebase Storage的屏幕截图:

这是我的Java代码:

 public View onCreateView(@NonNull LayoutInflater inflater,
                         ViewGroup container, Bundle savedInstanceState) {

    View root = inflater.inflate(R.layout.fragment_tools, container, false);

    recycler_view = root.findViewById(R.id.recycler_view);
    recycler_view.setHasFixedSize(true);

    FirebaseStorage storage = FirebaseStorage.getInstance();
    StorageReference storageReference = storage.getReference("Quotes");
    Log.e("STORAGE REF : " , String.valueOf(storageReference));


    String arr[] = new String[]{};
    for (int i =0;i<= Integer.parseInt(storageReference.getPath());i++){
    }

    ((MainActivity) getActivity()).getSupportActionBar().setTitle("Quran Quotes");

    final ProgressDialog pd = new ProgressDialog(getActivity());
    pd.setMessage("Loading");
    pd.show();
    final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
    recycler_view.setLayoutManager(linearLayoutManager); // set LayoutManager to RecyclerView
    quotesModelList = new ArrayList<>();

我在Logcat中获得了存储参考:

 E/STORAGE REF :: gs://mosque-614df.appspot.com/Quotes
android firebase android-recyclerview firebase-storage
1个回答
0
投票

首先[将任何图像上传到firebase-store时必须将图像下载URL存储到firebase数据库中。(当将任何图像上传至firebase-store时,成功上传图像时将获得图像下载URL。 。)

因此要在recyclerView中显示图像列表,只需调用firebase数据库的引用,您将立即获得所有图像。

© www.soinside.com 2019 - 2024. All rights reserved.