0

I have used this code for take photo from camera however onActivityResult() not call.

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File f = new File(android.os.Environment.getExternalStorageDirectory(),"temp.jpg");
intent.putExtra("return-data", true);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
startActivityForResult(intent, 0);
codeMagic
  • 44,549
  • 13
  • 77
  • 93
Patel Hiren
  • 305
  • 2
  • 11

2 Answers2

0

you don't have onActivityResult() method, check this related problem onActivityResult error . OP had almost working example.

Community
  • 1
  • 1
deadfish
  • 11,996
  • 12
  • 87
  • 136
0

There are 2 ways to take a photo :

1 - Using an Intent to make a photo

2 - Using the camera API

I think you should use the second way and there is a sample code for two of them.

Hope It helps.

Hassanova
  • 1
  • 3