AndroidImageSlider icon indicating copy to clipboard operation
AndroidImageSlider copied to clipboard

Set Picasso for Android Image Slider

Open DigiGostar opened this issue 8 years ago • 3 comments

I need to use defaultSliderView.setPicasso(picasso) for Android Image Slider but when I use the following code, don't work and only spins Progress Bar with out any error. And don't load my photo.

The First Way :

    SliderLayout sliderLayout = (SliderLayout) findViewById(R.id.slider);
    DefaultSliderView defaultSliderView = new DefaultSliderView(Context);
    Picasso picasso = Picasso.with(Context);
    picasso.load(imageUrl).resize(100, 100);
    defaultSliderView.setPicasso(picasso);
    sliderLayout.addSlider(defaultSliderView);


But this following way is responsive. And but I need to First Way. So help me to use The First Way. (because I need resize photo : Picasso.load(imageUrl).resize(100, 100) and after i need set this resized photo on slider layout)

The Second Way :

    SliderLayout sliderLayout = (SliderLayout) findViewById(R.id.slider);
    DefaultSliderView defaultSliderView = new DefaultSliderView(Context);
    defaultSliderView.image(imageUrl);
    sliderLayout.addSlider(defaultSliderView);


Libraries :

Picasso      : compile 'com.squareup.picasso:picasso:2.5.2'
Image Slider : compile 'com.daimajia.slider:library:1.1.5@aar'

DigiGostar avatar Oct 01 '17 17:10 DigiGostar

same question how to use setPicasso(picasso) correctly

dickhfchan avatar Jan 20 '18 05:01 dickhfchan

You can check this library https://github.com/OpenSooq/Pluto it has the ability to have full control over your views and layout and not depending on any image library

tamtom avatar May 05 '19 11:05 tamtom

Hi @DigiGostar

You only need to provide slider with pre-configured Picasso instance, it did picasso.load by itself. Your code shall be as follow

SliderLayout sliderLayout = (SliderLayout) findViewById(R.id.slider);
DefaultSliderView defaultSliderView = new DefaultSliderView(Context);
Picasso picasso = Picasso.with(Context);
defaultSliderView.setPicasso(picasso);
defaultSliderView.image(imageUrl);
sliderLayout.addSlider(defaultSliderView);

moekur avatar Aug 07 '19 18:08 moekur