coomar2841 / image-chooser-library Goto Github PK
View Code? Open in Web Editor NEWAn Easy Image/Video Chooser Library for your Android Apps
An Easy Image/Video Chooser Library for your Android Apps
I'm using image-chooser-library, but i was getting 'file not found' error in some cases with different files, although other files was working correctly.
The error is solved when i added Internet permissions to the app and switched on mobile date of the device.
I want to know why such library would need internet connection for?
There's a lot more information about this crash on crashlytics.com:
https://fabric.io/kbeanie/android/apps/com.beanie.imagechooserapp/issues/54aee1b465f8dfea158c45bb
There's a lot more information about this crash on crashlytics.com:
https://fabric.io/kbeanie/android/apps/com.beanie.imagechooserapp/issues/54da63cf65f8dfea15d7d188
Is there a plan on publishing the version artifacts to a maven repository for a nicer gradle integration?
ImageChooseBuilder & VideoChooserBuilder both import com.kbeanie.imagechooser.R to access strings. It makes it impossible to use these files in another project without modifying them.
You could instead use properties, with hardcoded default values, which can be overridden.
When I take pictures, picture rotated 90 degrees
I used your library in my app. It works like charm in all devices but Mi3.
Here is the stack trace:
java.lang.RuntimeException: Unable to resume activity {com.mypackage/com.mypackage.MyActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=294, result=-1, data=null} to activity {com.mypackage/com.mypackage.MyActivity}: java.lang.NullPointerException at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2777) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2806) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2241) at android.app.ActivityThread.access$800(ActivityThread.java:138) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5034) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:805) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:621) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=294, result=-1, data=null} to activity {com.mypackage/com.mypackage.MyActivity}: java.lang.NullPointerException at android.app.ActivityThread.deliverResults(ActivityThread.java:3354) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2764) ... 12 more Caused by: java.lang.NullPointerException at com.mypackage/com.mypackage.MyActivity.onActivityResult(MyActivity.java:4194) at android.app.Activity.dispatchActivityResult(Activity.java:5438) at android.app.ActivityThread.deliverResults(ActivityThread.java:3350)
Not quite sure the best way to describe this. The kitkat+ document browser navigation drawer has upper and lower sections. For me on lollipop the upper section has document providers like Images, Downloads, Recent, Internal storage, Drive and OneDrive. The lower section has Photos, OneDrive plus others.
When I use OneDrive from the upper section, I get a fail in the image chooser library with error toast "file not found". Here is the uri:
content://com.microsoft.skydrive.content.StorageAccessProvider/document/content%3A%2F%2Fcom.microsoft.skydrive.content.metadata%2Fproperty%2Fjay%2540ariseditions.com%2FD5796D89F69EDE94!59186%2FSnow%25202012%2520008.JPG
When I use OneDrive from the lower section, the operation succeeds. Here is the uri:
file:///storage/emulated/0/Android/data/com.microsoft.skydrive/cache/SkyDriveCacheFile_2304.cachedata/Snow%202012%20008.JPG
Is there a way to compress images to say a small, medium and large size using this library?
If not, is there a specific place this can be implemented? (I will send a pull request if there is).
I have used the library previously and It works like a charm.
Currently my application has targetSdkVersion 21 and testing application on Nexus 4 / 5.0.1 (API 21). I am calling pick photo from within a fragment like following
imageChooserManager = new ImageChooserManager(this, ChooserType.REQUEST_PICK_PICTURE);
imageChooserManager.setImageChooserListener(this);
imageChooserManager.choose();
after picking photo, I do get in onActivityResult and imageChooserManager.submit(requestCode, data) is called but I never get any error in log or callback to onImageChosen or onError.
I have checked the content of data and I get correct URI of image from data.getData().toString().
After it didn't work, I tested the same application on Nexus 7/4.4/API 19 and It worked there.
I see library is complied with targetSdkVersion 20. Are there any known issues with library working on API 21?
Choosing multiple images / videos / files at once is fundamental, because if user is allowd e.g. to upload multiple images, it's the worst UX if it has to add each manually.
Could you please add multi-choice? Can anybody in meantime suggest how to achieve that with this lib?
Hello again,
I have detected another bug trying use image-chooser-library from one GalaxyS3 Mini with Android 4.1, it dont show ok and cancel buttons.
Have you detected any same it?
Regards and very thanks for your work.
some problem in demo project..
I found out that the requestCode received by onActivityResult does NOT match the requestCode specified in the manager constructor, if the manager is instantiated using ImageChooserManager(Fragment fragment, int type). Everything works fine in case of using an activity.
The codes received by onActivityResult are 65827 for ChooserType.REQUEST_PICK_PICTURE and 65830 for ChooserType.REQUEST_CAPTURE_PICTURE.
when saving the photo or image from gallery, the pictures stored on previous days seem to get deleted from the bimagechooser folder...
Hi,
I need this kind of chooser:
ChooserType.REQUEST_PICK_IMAGE_OR_VIDEO
To make it possible for user to go to gallery and choose image or video (whatever he wants). Maybe better to call it ChooserType.REQUEST_PICK_MEDIA..
Can you add it? Is it lots of work? Maybe I can add this functionality by myself..
Thanks,
Dmitry
Thumbnails are not always needed, and their generation takes time and processing power. An option to disable thumbnail generation would be really helpful
I have found one error picking video from Camera in Android 2.3 or before. Error is:
08-21 13:03:00.900: E/AndroidRuntime(23720): at com.sec.android.app.camera.CamcorderEngine.renameTempFile(CamcorderEngine.java:1357)
I have found any information about it,
http://stackoverflow.com/questions/10494839/verifiyandsetparameter-error-when-trying-to-record-video
It is MediaStore.EXTRA_OUTPUT issue
I dont need Samsung Link Menu in image Chooser
I am thinking about add crop image with https://github.com/lvillani/android-cropimage
Where could i add it?
View Crash Report on Crittercism
Reported by: Kumar Bibek ([email protected])
Status: Unresolved
This Crash occured 1 times for 1 users
0 java.lang.OutOfMemoryError: bitmap size exceeds VM budget
1 at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
2 at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:470)
3 at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:284)
4 at com.kbeanie.imagechooser.threads.MediaProcessorThread.compressAndSaveImage(MediaProcessorThread.java:158)
5 at com.kbeanie.imagechooser.threads.MediaProcessorThread.getThumbnailSmallPath(MediaProcessorThread.java:112)
6 at com.kbeanie.imagechooser.threads.MediaProcessorThread.createThumbnails(MediaProcessorThread.java:97)
7 at com.kbeanie.imagechooser.threads.ImageProcessorThread.process(ImageProcessorThread.java:93)
8 at com.kbeanie.imagechooser.threads.ImageProcessorThread.processImage(ImageProcessorThread.java:85)
9 at com.kbeanie.imagechooser.threads.ImageProcessorThread.run(ImageProcessorThread.java:54)
I/ImageChooserManager(27319): File: content://media/external/images/media/53529
I/MediaProcessorThread(27319): Directory size: 8529038
I/MediaProcessorThread(27319): Deleted 0 files
I/ImageProcessorThread(27319): Processing Image File: content://media/external/images/media/53529
I/MediaProcessorThread(27319): Image Uri: content://media/external/images/media/53529
D/AbsListView(27319): unregisterIRListener() is called
I/MediaProcessorThread(27319): Before: 0x0
I/MediaProcessorThread(27319): Scale: 0
I/MediaProcessorThread(27319): Rotate: 0
I/MediaProcessorThread(27319): After: 1050x1152
I/MediaProcessorThread(27319): Compressing ... THUMBNAIL SMALL
I/MediaProcessorThread(27319): Before: 0x0
I/MediaProcessorThread(27319): Scale: 0
I/MediaProcessorThread(27319): Rotate: 0
I/MediaProcessorThread(27319): After: 525x576
I/ImageChooserManager(27319): File: content://media/external/images/media/54786
I/MediaProcessorThread(27319): Directory size: 10379373
I/MediaProcessorThread(27319): Deleted 0 files
I/ImageProcessorThread(27319): Processing Image File: content://media/external/images/media/54786
I/MediaProcessorThread(27319): Image Uri: content://media/external/images/media/54786
V/GAV4 (27319): Thread[GAThread,5,main]: putHit called
I/MediaProcessorThread(27319): Compressing ... THUMBNAIL
E/JHEAD (27319): can't open '/storage/emulated/0/myfolder/20150214_151157_fact_2.jpg'
I/MediaProcessorThread(27319): Before: 0x0
I/MediaProcessorThread(27319): Scale: 0
I/MediaProcessorThread(27319): Rotate: 0
E/BitmapFactory(27319): Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/myfolder/20150214_151157_fact_2.jpg: open failed: ENOENT (No such file or directory)
W/System.err(27319): java.lang.NullPointerException
W/System.err(27319): at com.kbeanie.imagechooser.threads.MediaProcessorThread.compressAndSaveImage(MediaProcessorThread.java:183)
W/System.err(27319): at com.kbeanie.imagechooser.threads.MediaProcessorThread.getThumnailPath(MediaProcessorThread.java:116)
W/System.err(27319): at com.kbeanie.imagechooser.threads.MediaProcessorThread.createThumbnails(MediaProcessorThread.java:107)
W/System.err(27319): at com.kbeanie.imagechooser.threads.ImageProcessorThread.process(ImageProcessorThread.java:108)
W/System.err(27319): at com.kbeanie.imagechooser.threads.ImageProcessorThread.processImage(ImageProcessorThread.java:100)
W/System.err(27319): at com.kbeanie.imagechooser.threads.ImageProcessorThread.run(ImageProcessorThread.java:57)
W/System.err(27319): java.lang.Exception: Corrupt or deleted file???
W/System.err(27319): at com.kbeanie.imagechooser.threads.MediaProcessorThread.compressAndSaveImage(MediaProcessorThread.java:205)
W/System.err(27319): at com.kbeanie.imagechooser.threads.MediaProcessorThread.getThumnailPath(MediaProcessorThread.java:116)
W/System.err(27319): at com.kbeanie.imagechooser.threads.MediaProcessorThread.createThumbnails(MediaProcessorThread.java:107)
W/System.err(27319): at com.kbeanie.imagechooser.threads.ImageProcessorThread.process(ImageProcessorThread.java:108)
W/System.err(27319): at com.kbeanie.imagechooser.threads.ImageProcessorThread.processImage(ImageProcessorThread.java:100)
W/System.err(27319): at com.kbeanie.imagechooser.threads.ImageProcessorThread.run(ImageProcessorThread.java:57)
There's a lot more information about this crash on crashlytics.com:
https://fabric.io/kbeanie/android/apps/com.beanie.imagechooserapp/issues/54aef0d165f8dfea158c6125
Hi there, I want to make a limitation to my users to can only select video files up to 10 MB size.
How can get video size?
thanks
I have the onedrive android app installed and onedrive shows as a source on the new kitkat document picker. It shows in the bottom section along with gallery and photos. When I select a jpeg image, image chooser fails with "file not found" as the reason.
Here is the log
04-07 14:51:06.766: W/System.err(6096): java.io.FileNotFoundException: /Dos Figuras.jpeg: open failed: ENOENT (No such file or directory)
04-07 14:51:06.766: W/System.err(6096): at libcore.io.IoBridge.open(IoBridge.java:409)
04-07 14:51:06.766: W/System.err(6096): at java.io.FileInputStream.(FileInputStream.java:78)
04-07 14:51:06.766: W/System.err(6096): at com.kbeanie.imagechooser.threads.MediaProcessorThread.copyFileToDir(MediaProcessorThread.java:209)
04-07 14:51:06.766: W/System.err(6096): at com.kbeanie.imagechooser.threads.MediaProcessorThread.process(MediaProcessorThread.java:95)
04-07 14:51:06.766: W/System.err(6096): at com.kbeanie.imagechooser.threads.ImageProcessorThread.process(ImageProcessorThread.java:97)
04-07 14:51:06.766: W/System.err(6096): at com.kbeanie.imagechooser.threads.ImageProcessorThread.processImage(ImageProcessorThread.java:91)
04-07 14:51:06.766: W/System.err(6096): at com.kbeanie.imagechooser.threads.ImageProcessorThread.run(ImageProcessorThread.java:55)
04-07 14:51:06.766: W/System.err(6096): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
04-07 14:51:06.766: W/System.err(6096): at libcore.io.Posix.open(Native Method)
04-07 14:51:06.766: W/System.err(6096): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
04-07 14:51:06.766: W/System.err(6096): at libcore.io.IoBridge.open(IoBridge.java:393)
04-07 14:51:06.776: W/System.err(6096): ... 6 more
04-07 14:51:06.776: W/System.err(6096): java.lang.Exception: File not found
04-07 14:51:06.776: W/System.err(6096): at com.kbeanie.imagechooser.threads.MediaProcessorThread.copyFileToDir(MediaProcessorThread.java:222)
04-07 14:51:06.776: W/System.err(6096): at com.kbeanie.imagechooser.threads.MediaProcessorThread.process(MediaProcessorThread.java:95)
04-07 14:51:06.776: W/System.err(6096): at com.kbeanie.imagechooser.threads.ImageProcessorThread.process(ImageProcessorThread.java:97)
04-07 14:51:06.776: W/System.err(6096): at com.kbeanie.imagechooser.threads.ImageProcessorThread.processImage(ImageProcessorThread.java:91)
04-07 14:51:06.776: W/System.err(6096): at com.kbeanie.imagechooser.threads.ImageProcessorThread.run(ImageProcessorThread.java:55)
In Nexus10, Android 4.3, when i select video from gallery it show videos from google+, and it fail if i try select one
Should be:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.+'
compile project(':image-chooser-library')
compile 'com.google.android.gms:play-services:6.+'
}
This may not be limited to lollipop. The image is stored on the device in Pictures/Instragram. Using the "Images" provider succeeds and this is the returned uri:
content://com.android.providers.media.documents/document/image%3A13194
Using the "Internal storage" provider to pick the same image fails with error toast "Couldn't process a null file". Here is the returned uri:
content://com.android.externalstorage.documents/document/primary%3APictures%2FInstagram%2FIMG_20141104_183552.jpg
Hi,
In Galaxy S4, for example, the image appears rotate -90ΒΊ. I think you should control about rotations, because some devices returns rotated images.
Congrats!
Caused by: java.lang.SecurityException: Permission Denial: opening provider com.android.gallery3d.provider.GalleryProvider from ProcessRecord{411c6770 20120:com.beanie.imagechooserapp/u0a10161} (pid=20120, uid=10161) requires com.google.android.gallery3d.permission.GALLERY_PROVIDER or com.google.android.gallery3d.permission.GALLERY_PROVIDER
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:2545)
at android.app.ActivityThread.acquireProvider(ActivityThread.java:4648)
at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2054)
at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1101)
at android.content.ContentResolver.query(ContentResolver.java:356)
at android.content.ContentResolver.query(ContentResolver.java:315)
at com.beanie.imagechooser.api.BChooser.getAbsoluteImagePathFromUri(BChooser.java:112)
at com.beanie.imagechooser.api.ImageChooserManager.processImageUri(ImageChooserManager.java:216)
at com.beanie.imagechooser.api.ImageChooserManager.processImageFromGallery(ImageChooserManager.java:252)
at com.beanie.imagechooser.api.ImageChooserManager.submit(ImageChooserManager.java:198)
at com.beanie.imagechooserapp.ImageChooserActivity.onActivityResult(ImageChooserActivity.java:120)
at android.app.Activity.dispatchActivityResult(Activity.java:5293)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3443)
... 11 more
There's a lot more information about this crash on crashlytics.com:
https://fabric.io/kbeanie/android/apps/com.beanie.imagechooserapp/issues/54da43f965f8dfea15d78f79
Is there a plan on publishing the version artifacts to a maven repository for a nicer gradle integration?
See (http://www.gradle.org/docs/current/userguide/publishing_maven.html)
I like this library, i think that it is good.
You could add it to Maven Central for integrate it?
I am, too, writing library about upload any Multipart/POST content to server. I think that i could use your library, replacing my own library, and, if you upload to Maven Central and add support for Maven, it will be more easy.
It is my library: https://github.com/sopinet/android-mediauploader
I can help you for add Maven support too.
Thanks, regards!
Hi,
I would like to notify a problem I've found using imagechooser library.
After opening the gallery and going back to the main activity, android sometimes has killed the activity, so I get null pointer exception into "onActivityResult" because imageChooserManager=null.
@OverRide
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK &&
(requestCode == ChooserType.REQUEST_PICK_PICTURE ||
requestCode == ChooserType.REQUEST_CAPTURE_PICTURE)) {
imageChooserManager.submit(requestCode, data);
}
}
Could you explain how to solve this problem into the section "usage:"? It happens because all is controlled inside de object ImageChooserManager, how could I restore this object if the activity is killed?
Thanks.
Hi,
I'm using your demo app, I'm choosing image -> complete action using google drive app -> choose some image there.
I see message "couldn't process null file".
please add support for this case.
Thanks,
Dmitry
Hello, your library is very nice. There is a issue when I would like to save image to app folder. I change method getDirectory in FileUtils like this
public static String getDirectory(Context context, String foldername) {
File storageDir = null;
if (Environment.MEDIA_MOUNTED.equals(Environment
.getExternalStorageState())) {
storageDir = context
.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
if (storageDir != null) {
if (!storageDir.mkdirs()) {
if (!storageDir.exists()) {
Log.e("Pictures", "failed to create directory");
return null;
}
}
}
} else {
Log.v(context.getString(R.string.app_name),
"External storage is not mounted READ/WRITE.");
}
return storageDir.getAbsolutePath();
}
It is not working. Can you help me ?
Is there a way to get just the path to the image and the file name of the image?
Then i try to import library from maven, i retrieve
Error:Module version com.kbeanie:image-chooser-library:1.3.5 depends on libraries but is not a library itself
Thanks.
Is there a way to pass for instance intent.putExtra("android.intent.extra.durationLimit", 3);?
If you have an image which contains an encoded URL as the file name then the image-chooser-library will return "File not found". It appears that Uri.parse decodes the file name which causes an issue when trying to copy the file in the MediaProcessThread copyFileToDir() method.
What would the downside be to changing
file = new File(Uri.parse(filePath).getPath());
to
file = new File(filePath);
In Android 4.1, when selecting photo from
"Photos"->"Highlights", which is the google plus app, the image can not be retrieved.
View Crash Report on Crittercism
Reported by: Kumar Bibek ([email protected])
Status: Unresolved
This Crash occured 1 times for 1 users
0 java.lang.OutOfMemoryError
1 at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
2 at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:564)
3 at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:301)
4 at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:326)
5 at com.kbeanie.imagechooser.threads.MediaProcessorThread.compressAndSaveImage(MediaProcessorThread.java:210)
6 at com.kbeanie.imagechooser.threads.MediaProcessorThread.getExactThumnailPath(MediaProcessorThread.java:121)
7 at com.kbeanie.imagechooser.threads.MediaProcessorThread.createThumbnails(MediaProcessorThread.java:101)
8 at com.kbeanie.imagechooser.threads.ImageProcessorThread.process(ImageProcessorThread.java:94)
9 at com.kbeanie.imagechooser.threads.ImageProcessorThread.processImage(ImageProcessorThread.java:86)
10 at com.kbeanie.imagechooser.threads.ImageProcessorThread.run(ImageProcessorThread.java:55)
Hello,
Thanks to #34 it's possible to set extra's on ChooserManager's but I can't find a way to retrieve these afterwards, is this currently possible or would it require a new getter to fetch these?
Thanks
In Demo app, got to Image Chooser
Click "Choose Image"
Complete action using google's "Photos" app
There you can see images and videos
When picking video file, I see message in Demo app:
Corrupt or deleted file??
There's a lot more information about this crash on crashlytics.com:
https://fabric.io/kbeanie/android/apps/com.beanie.imagechooserapp/issues/54daa45465f8dfea15d84276
There's a reported issue with EXTRA_OUTPUT being ignored or something on 4.4.3. See here: https://code.google.com/p/android/issues/detail?id=71380
After upgrading my phone's ROM to 4.4.3, I can confirm that all I get from this library is a callback to onError() from library listener, stating that it's corrupt or deleted. Return result is still RESULT_OK in onActivityResult, data is just null.
Got this error :
"onActivityResult requestCode is different from the type the chooser was initialized with."
on Samsung S3 device,
for requestCode :
ChooserType.REQUEST_PICK_PICTURE
OR
ChooserType.REQUEST_CAPTURE_PICTURE
when trying to take picture / choose from Gallery.
Any idea what could have been causing it?
Actually its not issue , its a question, I want to rename the photo when set to image, howit is possible.
And thanks for such a great library..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.