私は次のコードを持っています:
final Gallery g = (Gallery) findViewById(R.id.gallery);
g.setAdapter(new ImageAdapter(this));
g.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView parent, View v, int position, long id) {
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Bitmap b = null;
b=BitmapFactory.decodeResource(getResources(),*********);
b.compress(CompressFormat.PNG, 0, outputStream);
AlertDialog.Builder builder = new AlertDialog.Builder(Edit.this);
builder.setTitle("Comfirm");
builder.setMessage("Do you want to choose this picture?");
builder.setPositiveButton("Continue", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
image = outputStream.toByteArray();
}
});
ご覧のとおり*****
、 int のようにする必要がありますandroid.R.drawble.icon
。ユーザーが画像をクリックしたときに画像を保存したい。ユーザーがクリックしたときに画像を取得するにはどうすればよいですか?