I'm trying to create a wallpaper application to display a range of images based on a drawable folder. How can I get this images from URL, i.e., to say get image by url instead?
public class ImageAdapter extends BaseAdapter {
private Context mContext;
public Integer[] mThumbIds = {
R.drawable.wallpaper_1,
R.drawable.wallpaper_2,
R.drawable.wallpaper_3,
R.drawable.wallpaper_4,
R.drawable.wallpaper_5,
R.drawable.wallpaper_6,
R.drawable.wallpaper_7,
R.drawable.wallpaper_8,
R.drawable.wallpaper_9,
R.drawable.wallpaper_10
};
public ImageAdapter(Context c) {
mContext = c;
}
@Override
public int getCount() {
return mThumbIds.length;
}
@Override
public Object getItem(int position) {
return mThumbIds[position];
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView = new ImageView(mContext);
imageView.setImageResource(mThumbIds[position]);
imageView.setScaleType(imageView.getScaleType().CENTER_CROP);
imageView.setLayoutParams(new GridView.LayoutParams(LayoutParams.WRAP_CONTENT, 400));
return imageView;
}
}