アダプターを使用してギャラリーに入れたい画像があり、キャンバスを使用して描画されます。多くのチュートリアルを見て、コードを作成しましたが、どこが間違っているのかわかりません
Gallery g;
ImageAdapter imageAdapter;
Gallery g = (Gallery) findViewById(R.id.gBitmap);
imageAdapter = new ImageAdapter(this);
g.setAdapter(imageAdapter);
//selected Bitmap from gallery
g.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent,
View v, int position, long id) {
applyBitmap(position);
}
});
}
public class ImageAdapter extends BaseAdapter {
int mGalleryItemBackground;
private Context mContext;
private Integer[] mImageIds = {
R.drawable.first,
R.drawable.second,
R.drawable.fifth,
R.drawable.third,
R.drawable.fourth,
public ImageAdapter(Context c) {
mContext = c;
}
public int getCount() {
return mImageIds.length;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position,
View convertView, ViewGroup parent) {
return iv;
}
}
public static void Bitmap(int position) {
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inScaled = true;
opt.inPurgeable = true;
opt.inInputShareable = true;
Bitmap brightBitmap = BitmapFactory.decodeResource(null, position, opt);
iv.setImageBitmap(brightBitmap);
}
mImageIds
呼び出された関数を使用するには、選択したものを取得する必要がありますBitmap