I have an Android app that has 7 imageButtons , I need to store the captured images in a List Bitmap , I'm trying to set the array indexes as the id > imageButtons , however the application crashes when the procedure is performed.
public void tirarFoto(View view) {
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
System.out.println(view.getId());
idBotao = (ImageButton) findViewById(view.getId());
startActivityForResult(intent, 0);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if(data != null){
Bundle bundle = data.getExtras();
if(bundle != null){
Bitmap img = (Bitmap) bundle.get("data");
idBotao.setImageBitmap(img);
//TENTA ADICIONAR A IMAGEM NO ARRAY USANDO O ID DO BOTÃO COMO CHAVE
testeArray.add(idBotao.getId(),((BitmapDrawable) idBotao.getDrawable()).getBitmap());
Log.e("ID Button",String.valueOf((int) idBotao.getId()));
}
}
}