'Loading images from firestore in image slider
I'm trying to load the images in an image slider from firestore. The image urls are there in firestore. I'm using the following library https://github.com/denzcoskun/ImageSlideshow for image slider, but it shows error instead of images.
This is the java code:
public class preview_product extends AppCompatActivity
{
private String position;
private FirebaseFirestore db = FirebaseFirestore.getInstance();
private ImageSlider imageSlider;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_product_preview);
imageSlider = findViewById(R.id.image_slider);
final List<SlideModel> displayImages = new ArrayList<>();
Bundle intent = getIntent().getExtras();
position = intent.get("key").toString();
db.collection("Store").document("name").collection("prod").document(position).collection("details").document("product_id").get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>()
{
@Override
public void onSuccess(@NonNull DocumentSnapshot documentSnapshot)
{
List<String> Urls = (List<String>) documentSnapshot.get("Images");
displayImages.add(new SlideModel(Urls.toString(), ScaleTypes.FIT));
imageSlider.setImageList(displayImages,ScaleTypes.FIT);
imageSlider.startSliding(3000);
}
});
}
}
Solution 1:[1]
I guess you've copied the link of the webpage-showing the image ,instead of the link of actual image. Try opening the image in a new tab, and then copy the link from the address-bar.
Maybe, this is what you've copied !
This is what you should try coping instead !
Hope this helps!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |