Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some mobile phone have a exception when take a picture。 #22

Closed
HarlonWang opened this issue Dec 17, 2014 · 12 comments
Closed

Some mobile phone have a exception when take a picture。 #22

HarlonWang opened this issue Dec 17, 2014 · 12 comments
Labels

Comments

@HarlonWang
Copy link

Some mobile phone have a exception when take a picture。
java.lang.IllegalStateException: Unable to create new file: /storage/sdcard0/DCIM/Camera/1418805137509.jpg

cause this code :String path = MediaStore.Images.Media.insertImage(getActivity().getContentResolver(), bitmap, getPhotoFilename(), null);

I think this exception maybe with some mobile phone sdcard path diffenrent

could you help me to solve this question, thanks a lot.

@jaydeepw
Copy link
Owner

I would really love to help you here. The problem is I am not checking if the SDcard is preset of not.

Here is a gist of how it should be handled. I can review and merge if you send me a PR.
http://stackoverflow.com/questions/13633308/android-contentresolver-insert-crashes-with-unable-to-create-new-file

@HarlonWang
Copy link
Author

Thank you for your reply, but I now encountered a new problem, when I finished take a picture, time to enter, the photo album appeared two times before.

@jaydeepw
Copy link
Owner

Yes, I have noticed that on some phones. That is because image orientation is being corrected after taking the picture. Which device are you using?

@HarlonWang
Copy link
Author

Mi(www.mi.com) phone at China ,perhaps you didn't hear about it , And other China Phone have same problem

@jaydeepw
Copy link
Owner

Yes. I know about Mi. We have a lot of buyers of Mi in India too. However, I cannot test on that device as I dont have the device with me. Capturing and storing the image may take time but does it crash other than what you have reported earlier?

@HarlonWang
Copy link
Author

I tried several different ways to insert image,I think its may about with EXTERNAL_CONTENT_URI And
INTERNAL_CONTENT_URI

@jaydeepw
Copy link
Owner

Yes, defintely it is about that. So if the SDCard is mounted the image should be stored on EXTERNAL_CONTENT_URI otherwise if the device has sufficient storage, it should be stored on INTERNAL_CONTENT_URI. If the device does not have enough space, we should show some message to the user.

@HarlonWang
Copy link
Author

you are right,Thank you code again, its very helpful for me. my english is not good.and thank you answer again.

@jaydeepw
Copy link
Owner

Welcome Jack. Submit a Pull Request when you are done editing the code. Please make sure you keep the code consistent. I will review and merge it.

@HarlonWang
Copy link
Author

of course ,If I can solve this ,I have the honor of send a PR .

@jaydeepw
Copy link
Owner

👍

@jaydeepw jaydeepw added the bug label Jan 4, 2015
@jaydeepw
Copy link
Owner

I tested the sample app that uses the latest version (vv1.0.11 at the time of writing) on Mi Redmi and found it working flawlessly. Anything specific I should do to reproduce the crash?

Let me know, I will close the issue otherwise.

@jaydeepw jaydeepw closed this as completed Mar 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants