All my images are stored in drawable folder. I want to see a gallery view with some of the images.
The names of the images I want are in a String array.
Can I get the gallery view to show these images.
I found the code bellow, here the images are an Integer.
Can I use a String array?
public class ImageAdapter extends BaseAdapter {
private Context context;
public ImageAdapter(Context context){
this.context = context;
}
public int getCount() {
return pics.length;
}
public Object getItem(int arg0) {
return null;
}
public long getItemId(int position) {
return 0;
}
public View getView(int arg0, View arg1, ViewGroup arg2) {
ImageView iv = new ImageView(context);
iv.setImageResource(pics);
iv.setScaleType(ImageView.ScaleType.FIT_XY);
iv.setLayoutParams(new Gallery.LayoutParams(150,120));
iv.setBackgroundResource(imageBackground);
return iv;
}
}