0
I have an Android app that has 7 imageButtons, need to store the captured images in a List Bitmap, I am trying to define the indices of the array list as the id of the imageButtons, however the crash application 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()));
}
}
}