0

logcat manifest code snippet 1 code snippet 2 code snippet 3 I still can't figure out what's causing my app to crash. I've already included permissions and user features but still wont work. How to solve this?

P.S. I'm new to Android.

InsaneCat
  • 2,115
  • 5
  • 21
  • 40
kendi
  • 3
  • 4
  • show your logcat – Anisur Rahman Tonu Aug 29 '18 at 03:14
  • 1
    May be required permission is an issue. Without logs and code sample it will be hard to solve the issue. – Swapnil Aug 29 '18 at 03:22
  • HI! @AnisurRahmanTonu already posted the logcat. – kendi Aug 29 '18 at 04:08
  • I think when you run an App in your Device API above lollipop you have to give manually Permissions to that APP. Go to Settings>Installed Apps>Your_App>Permissions and then enable permission whichever you want to provide. – Jay Mungara Aug 29 '18 at 04:33
  • @kendi please share your error log – Ashwani Aug 29 '18 at 04:41
  • @kendi show the error or exception from logcat which crashes your app – Bhagyashri Aug 29 '18 at 05:15
  • Dear @kendi, here on StackOverflow, please post code and logs as text, whenever possible. Screenshots may be hard to read and analyze. If you have a very long text, consider uploading it to GitHub gist or other sharing site, and post a link in your question. In your question, only embed essential pieces of this text. – Alex Cohn Aug 29 '18 at 05:29
  • Take Permission of camera and read external storage. If you are running it below 23 then it will work. else you have to add run time permission which are required for your requirement. – PRATEEK BHARDWAJ Aug 29 '18 at 05:42

2 Answers2

0

From What I can see you did not get Permission from User. (Adding Camera Permission in Manifest is not enough)

In onActivityResult you have to get the image from data variable. e.g Bitmap photo = (Bitmap) data.getExtras().get("data");

I recommend you have a look at this answer from @jengelsma, in how to Capture Image from Camera. https://stackoverflow.com/a/5991757/2945356

PS. If you change logcat filter to ERROR. It will show you exactly what is the problem

Shahriar
  • 939
  • 1
  • 14
  • 36
0

I believe that the cause of the problem is that your takePictureIntent() calls startActivityForResult() twice.

Also note that EXTRA_FINISH_ON_COMPLETION does not apply to ACTION_IMAGE_CAPTURE. PLease follow more closely the official Android tutorial.

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