1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
| public void launchCamera(){
Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(i,REQUEST_CAPTURE);
}
public void launchCamera2(){
Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(i,REQUEST_CAPTURE2);
}
public void launchCamera3(){
Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(i,REQUEST_CAPTURE3);
}
public void launchCamera4(){
Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(i,REQUEST_CAPTURE4);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CAPTURE && resultCode == RESULT_OK){
Bundle extras = data.getExtras();
Bitmap photo = (Bitmap) extras.get("data");
if (densite1.getDrawable()==null){
densite1.setImageBitmap(photo);
// Toast.makeText(this,extras.get("URI").toString(),Toast.LENGTH_LONG);
}else if (densite2.getDrawable()==null){
densite2.setImageBitmap(photo);
}else {
densite3.setImageBitmap(photo);
btndensite.setEnabled(false);
}
}else if (requestCode == REQUEST_CAPTURE2 && resultCode == RESULT_OK){
Bundle extras = data.getExtras();
// String Path=mImageCaptureUri.getPath();
Bitmap photo = (Bitmap) extras.get("data");
if (maturite1.getDrawable()==null){
maturite1.setImageBitmap(photo);
// Toast.makeText(this,Path.toString(),Toast.LENGTH_LONG);
}else if (maturite2.getDrawable()==null){
maturite2.setImageBitmap(photo);
}else {
maturite3.setImageBitmap(photo);
btnmaturite.setEnabled(false);
}
}else if (requestCode == REQUEST_CAPTURE3 && resultCode == RESULT_OK){
Bundle extras = data.getExtras();
// String Path=mImageCaptureUri.getPath();
Bitmap photo = (Bitmap) extras.get("data");
if (homogene1.getDrawable()==null){
homogene1.setImageBitmap(photo);
// Toast.makeText(this,Path.toString(),Toast.LENGTH_LONG);
}else if (homogene2.getDrawable()==null){
homogene2.setImageBitmap(photo);
}else {
homogene3.setImageBitmap(photo);
btnhomegene.setEnabled(false);
}
}else if (requestCode == REQUEST_CAPTURE4 && resultCode == RESULT_OK){
Bundle extras = data.getExtras();
// String Path=mImageCaptureUri.getPath();
Bitmap photo = (Bitmap) extras.get("data");
if (fruitfleur1.getDrawable()==null){
fruitfleur1.setImageBitmap(photo);
// Toast.(this,Path.toString(),Toast.LENGTH_LONG);
}else if (fruitfleur2.getDrawable()==null){
fruitfleur2.setImageBitmap(photo);
}else {
fruitfleur3.setImageBitmap(photo);
btnfruitfleur.setEnabled(false);
}
}
} |
Partager