daimajia / AndroidImageSlider

An amazing and convenient Android image slider.
MIT License
5.63k stars 1.66k forks source link

Use Bitmap as source instead of URL #130

Open adrissacf opened 9 years ago

adrissacf commented 9 years ago

Is it possible to use a bitmap as the source, since i download my images from a database and get them as a byte array which i decode to a bitmap.

adrissacf commented 9 years ago

Edited the BaseSliderView class in the library project to the following, and then you can just use a bitmap like

DefaultSliderView defaultSliderView = new DefaultSliderView(getBaseContext()); defaultSliderView.image(bmp); sliderShow.addSlider(defaultSliderView);

Updated BaseSliderView class:

package com.daimajia.slider.library.SliderTypes;

import android.content.Context; import android.graphics.Bitmap; import android.os.Bundle; import android.view.View; import android.widget.ImageView;

import com.daimajia.slider.library.R; import com.squareup.picasso.Callback; import com.squareup.picasso.Picasso; import com.squareup.picasso.RequestCreator;

import java.io.File;

/**

}

hksfho commented 9 years ago

same question for me can you use it?

meness commented 9 years ago

Can you fork this repository and make the improvement please?

positivelymade commented 8 years ago

Solution above worked!

CipherCit commented 7 years ago

I've had this:

"Cannot resolve method 'bundle(android.io.Bundle)"

Just need to add bundle method:

public BaseSliderView bundle(Bundle bundle){ mBundle = bundle; return this; }

This is a useful solution. Thank you.