这是我的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
首先[将任何图像上传到firebase-store时必须将图像下载URL存储到firebase数据库中。(当将任何图像上传至firebase-store时,成功上传图像时将获得图像下载URL。 。)
因此要在recyclerView中显示图像列表,只需调用firebase数据库的引用,您将立即获得所有图像。