Share

No Title

Public

23 February 2021

Views: 12

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);

TextView Logout = getView().findViewById(R.id.Logout);
ImageSlider imageSlider = getView().findViewById(R.id.slider);

DatabaseReference dbRef;
List<SlideModel> slideModels = new ArrayList<>();

dbRef = FirebaseDatabase.getInstance().getReference("Admin").child("Images");

dbRef.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
int i=1;
for(DataSnapshot dataSnapshot:snapshot.getChildren())
{
String URL = dataSnapshot.getValue().toString();
slideModels.add(new SlideModel(URL+i));
i++;
}
imageSlider.setImageList(slideModels,true);
}

@Override
public void onCancelled(@NonNull DatabaseError error) {

}

});

Advertisement

Disable Third Party Ads