0

My app launches the default android camera. However, I am having a problem editing the appearance of startActivityForResult. I just want to change the buttons of strings onStartActivityForResult to buttons that are green and red with no stings or words inside of them.

I have tried to automatically bypass this method and set the result as "OK" by setResult(RESULT_OK, intent); but that doesnt seem to work. I dont mind the camera taking the picture and launching to the next screen without launching startActivityForResult method.

Botton line I want to change the default buttons to something else...any ideas. Thank you in advance!!!

Edit Buttons

 public void takePhoto(View v) {

    Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");

    photo= new File(Environment.getExternalStorageDirectory() + boo + "/patient.jpg");

    imageUri = Uri.fromFile(photo);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
    startActivityForResult(intent, TAKE_PICTURE);

}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    super.onActivityResult(requestCode, resultCode, intent);
    if (resultCode == Activity.RESULT_OK) {
        Toast p = Toast.makeText(this, "code: " + resultCode, Toast.LENGTH_LONG);
        p.show();
        Intent intent2 = new Intent(NewPatient.this,PatientName.class);
        startActivity(intent2);
    }
}
  • hey it's default camera intent for capturing photo. StartActivityForResult used only for the starting the second activity for result. – Sachin Jul 21 '15 at 03:29

3 Answers3

1

IMAGE_CAPTURE intent launches another app. Usually it is the Camera app that shipped with the device, but the user may choose to install more camera apps, and decide to use any of them to fulfill the intent.

You have absolutely no control over look and feel of that other app. It may even decide not to open camera device.

If you care, you should implement your own custom camera activity.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
0

I don't think you can do that. You can create your own activity to capture images by camera but you can't change the way an application behaves after sending intent to them.

rockfight
  • 1,916
  • 2
  • 20
  • 31
0

I don't know about my answer is what you want...

1.I guess you can access to the button object inside onActivityResult if it is caller activity.

2.You can add parameter to your intent. How to start an Intent by passing some parameters to it?

Note: If you get an error of accessing UI thread from other thread. see this https://developer.android.com/training/multiple-threads/communicate-ui.html

Community
  • 1
  • 1
Mari Murotani
  • 723
  • 1
  • 8
  • 19