Good morning,
I would like to ask a question, my APP so far the guy takes a picture of the phone and stays in an ImageView (Ex: img1), I need to create a name defined by me in a variable example: 04102018_Foto1.jpg, would have some way so I can send the DB with that name defined by me?
Code:
String dataAtualFormatada = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(System.currentTimeMillis());
btnTirarFoto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent((MediaStore.ACTION_IMAGE_CAPTURE));
startActivityForResult(intent, 0);
// Toast.makeText(TelaAtestado.this, "Atestado cadastrado com sucesso! ", Toast.LENGTH_LONG).show();
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Bitmap bitmap = (Bitmap) data.getExtras().get("data");
ByteArrayOutputStream out = new ByteArrayOutputStream();
// Comprimir Imagem = PNG/JPG ----- QUALITY:
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
img1.setImageBitmap(bitmap);
}
}