parksanggwon / tedbottompicker Goto Github PK
View Code? Open in Web Editor NEWTedBottomPicker is simple image picker using bottom sheet
TedBottomPicker is simple image picker using bottom sheet
Hi @ParkSangGwon ,
Can you please Check Error :::
Here Is crash Report :::
Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=65537, result=-1, data=null} to activity {com.iotconnect/com.iotconnect.activity.DrawerActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getPath()' on a null object reference
at android.app.ActivityThread.deliverResults(ActivityThread.java:4067)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3389)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3434)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2772)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4471)
at android.app.ActivityThread.access$1000(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1455)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getPath()' on a null object reference
at gun0912.tedbottompicker.TedBottomPicker.onActivityResultCamera(TedBottomPicker.java:467)
at gun0912.tedbottompicker.TedBottomPicker.onActivityResult(TedBottomPicker.java:453)
at android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:164)
at android.app.Activity.dispatchActivityResult(Activity.java:6549)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4063)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3389)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3434)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2772)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4471)
at android.app.ActivityThread.access$1000(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1455)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
Here is my Code ::
bottomPicker = new TedBottomPicker.Builder(mActivity)
.setPeekHeight(getResources().getDisplayMetrics().heightPixels / 2)
.setCameraTile(R.drawable.icon_camera)
.setTitle("Choose Image")
.setPreviewMaxCount(99999)
.showGalleryTile(false)
.setOnImageSelectedListener(new TedBottomPicker.OnImageSelectedListener() {
@Override public void onImageSelected(Uri uri) {
imageUri = uri;
Glide.with(mActivity)
.load(uri)
.placeholder(R.drawable.menu_profile_placeholder)
.bitmapTransform(new CropCircleTransformation(mActivity))
.into(ivUserProfile);
}
}).create();
bottomPicker.show(getFragmentManager());
Here is the Gradle ::: compile 'gun0912.ted:tedbottompicker:1.0.6'
I m Only getting Crash While taking Image from Camera Device is SAMSUNG manufacture(other Device Works Perfectly).
can you please look into this issue and Resolve as soon as Possible.
Thanks.
Why not skip the permission checking in builder when camera tile is disabled. I have checked the implementation, the WRITE_EXTERNAL permission is only needed when camera tile is enabled.
When I use the camera icon to capture picture and add to selected images in multi-select mode, sometimes screen rotate after camera saved the picture. In this state, your library onCreate called again and selectedUriList lost!
I added this code for saving this variable in onSaveInstanceState and in setupDialog check if it's null then create a new instance.
It's worked just for saving the array variable, but the view for this selected images must recreate!
Selecting local images works ok, but when I select some image not from file:// , but content:// , it crashes
Hi, I'm getting this error when I'm opening the camera window.
Please update the library or let us know a solution.
Thanks in advance
FATAL EXCEPTION: main
Process: com.successive.khoyapaya, PID: 2337
android.os.FileUriExposedException: file:///storage/emulated/0/Pictures/JPEG_20170208115930_1243992149.jpg exposed beyond app through ClipData.Item.getUri()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:1813)
at android.net.Uri.checkFileUriExposed(Uri.java:2360)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:832)
at android.content.Intent.prepareToLeaveProcess(Intent.java:8957)
at android.content.Intent.prepareToLeaveProcess(Intent.java:8942)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1583)
at android.app.Activity.startActivityForResult(Activity.java:4228)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:79)
at android.support.v4.app.ActivityCompatJB.startActivityForResult(ActivityCompatJB.java:30)
at android.support.v4.app.ActivityCompat.startActivityForResult(ActivityCompat.java:146)
at android.support.v4.app.FragmentActivity.startActivityFromFragment(FragmentActivity.java:937)
at android.support.v4.app.FragmentActivity$HostCallbacks.onStartActivityFromFragment(FragmentActivity.java:1047)
at android.support.v4.app.Fragment.startActivityForResult(Fragment.java:954)
at android.support.v4.app.Fragment.startActivityForResult(Fragment.java:943)
at gun0912.tedbottompicker.TedBottomPicker.startCameraIntent(TedBottomPicker.java:190)
at gun0912.tedbottompicker.TedBottomPicker.access$000(TedBottomPicker.java:45)
at gun0912.tedbottompicker.TedBottomPicker$2.onItemClick(TedBottomPicker.java:139)
at gun0912.tedbottompicker.adapter.ImageGalleryAdapter$1.onClick(ImageGalleryAdapter.java:131)
at android.view.View.performClick(View.java:5612)
at android.view.View$PerformClick.run(View.java:22285)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Here is the crash log
Exception java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.getCanonicalPath()' on a null object reference
android.support.v4.content.FileProvider$SimplePathStrategy.getUriForFile (FileProvider.java:695)
android.support.v4.content.FileProvider.getUriForFile (FileProvider.java:400)
gun0912.tedbottompicker.TedBottomPicker.startCameraIntent (TedBottomPicker.java:414)
gun0912.tedbottompicker.TedBottomPicker.access$100 (TedBottomPicker.java:57)
gun0912.tedbottompicker.TedBottomPicker$3.onItemClick$5359dc9a (TedBottomPicker.java:275)
gun0912.tedbottompicker.adapter.ImageGalleryAdapter$1.onClick (ImageGalleryAdapter.java:180)
android.view.View.performClick (View.java:5612)
From a MotoZ running 7.0, using 1.0.12 of this library
Let me know whatever else I can do to help. thanks!
There is an incorrect layout in multi-select mode.
I saw incorrect layout while using this library.
sometimes layout vibrates in my project.
so, I tried to run your sample project.
and, I faced the same issue on my devices that Galexy7edge and Redmi note4.
please check attached video.
bug-reporting.mp4.zip
I've found a weird bug while switching camera.
Steps to reproduce:
default camera app was open in the background
1.open the sample app with TED initialized with custom string title and choose capture camera
2.while the sample camera is open change apps for default camera
4.change back to sample camera and make the photo
5.observe
Here is the stacktrace:
04-04 10:23:57.062 11220-11220/ E/AndroidRuntime: FATAL EXCEPTION: main Process: com.***, PID: 11220 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.***.develop/com.***.presentation.Activity}: java.lang.NullPointerException: Attempt to read from field 'boolean gun0912.tedbottompicker.TedBottomPicker$Builder.showTitle' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2666) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6121) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779) Caused by: java.lang.NullPointerException: Attempt to read from field 'boolean gun0912.tedbottompicker.TedBottomPicker$Builder.showTitle' on a null object reference at gun0912.tedbottompicker.TedBottomPicker.setTitle(TedBottomPicker.java:483) at gun0912.tedbottompicker.TedBottomPicker.setupDialog(TedBottomPicker.java:168) at android.support.v4.app.DialogFragment.getLayoutInflater(DialogFragment.java:315) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299) at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595) at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2900) at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:201) at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:603) at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178) at com.***.presentation.Activity.onStart(ListRoomActivity.java:207) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1248) at android.app.Activity.performStart(Activity.java:6699) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2629) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6121) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779) ``
Is the library supposed to handle rotation itself or am I supposed to hide it somehow before the rotation takes place? At the moment I can't think of a simple way to solve it in my app (but it's 3 am after all).
AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{CENSORED/CENSORED.MainActivity}: java.lang.NullPointerException: Attempt to read from field 'int gun0912.tedbottompicker.TedBottomPicker$Builder.peekHeight' on a null object reference
when camera (by MediaStore.ACTION_IMAGE_CAPTURE intent) or gallery (by Intent.ACTION_PICK intent) is used, TedBottomPicker calls "dismiss()" after OnImageSelectedListener's onImageSelected() in onActivityResult().
but, in this case, dismiss() is likely to occur exceptions. (in detail, IllegalStateException:Can not perform this action after onSaveInstanceState)
for example, (in my case) NestedFragment (I mean, fragment has another fragment as child) calls TedBottomPicker. and I choose in onImageSelected() start other Activity.
in this case IllegalStateException occurs.
how do you think about changing dismiss() to dismissAllowingStateLoss()?
Whenever I take an image using that option and click the blue checkmark button to select it while being rotated to landscape I get the following exception. For some reason it seems the cameraImageUri variable is null in onActivityResultCamera(final Uri cameraImageUri) when in landscape.
Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=65537, result=-1, data=Intent { }} to activity {CENSORED/CENSORED.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getPath()' on a null object reference
at android.app.ActivityThread.deliverResults(ActivityThread.java:4089)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3403)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3469)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2732)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4519)
at android.app.ActivityThread.-wrap19(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1483)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6126)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getPath()' on a null object reference
at gun0912.tedbottompicker.TedBottomPicker.onActivityResultCamera(TedBottomPicker.java:479)
at gun0912.tedbottompicker.TedBottomPicker.onActivityResult(TedBottomPicker.java:465)
at android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:164)
at CENSORED.MainActivity.onActivityResult(MainActivity.java:885)
at android.app.Activity.dispatchActivityResult(Activity.java:6932)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4085)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3403)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3469)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2732)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4519)
at android.app.ActivityThread.-wrap19(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1483)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6126)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Hi... i am getting by this exception Attempt to read from field 'int gun0912.tedbottompicker.TedBottomPicker$Builder.peekHeight' on a null object reference when i select the camera option in the Android 6.0.1 Asus Zenfone 2 laser and also using i the portrait mode
While using this library, i got to know that the image which i select from gallery, will not selecting as the final result, it just stuck at the same bottompicker screen.
When tried to click a pic using the camera button provided in bottompicker, it isn't saving the photo i just clicked, (had all the required permissions), do check and reply soon
Currently, as I understood correctly, we can specify max count of photos through TedBottomPicker.Builder.maxCount. But I for example want to show all images from gallery.
Now I can write something like:
builder.setMaxCount(Integer.MAX_VALUE)
But it looks like workaround.
I want to be able to write something like:
builder.noLimit()
or even better have unlimited list as default behavior and possibility to limit it through:
builder.limit(25)
Thank you.
Can you give the option to disable preview in the OnMultiImageSelectedListener?
选择器弹出后,status bar会发生变化,变成黑色。关闭后,恢复蓝色
need support MultiSelection
Hello,
First of all thanks for the awesome library.
Recently I have encountered the follwing error in Fabric because some users found it.
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{es....}: java.lang.NullPointerException: Attempt to read from field 'int gun0912.tedbottompicker.c$a.n' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) at android.app.ActivityThread.access$900(ActivityThread.java:150) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by java.lang.NullPointerException: Attempt to read from field 'int gun0912.tedbottompicker.c$a.n' on a null object reference at gun0912.tedbottompicker.TedBottomPicker.show(Unknown Source) at android.support.v4.app.DialogFragment.getDialog(Unknown Source) at android.support.v4.app.FragmentManagerImpl.modifiesAlpha(Unknown Source) at android.support.v4.app.FragmentManagerImpl.getBackStackEntryCount(Unknown Source) at android.support.v4.app.FragmentManagerImpl.modifiesAlpha(Unknown Source) at android.support.v4.app.FragmentManagerImpl.findFragmentUnder(Unknown Source) at android.support.v4.app.FragmentController.dispatchActivityCreated(Unknown Source) at android.support.v4.app.FragmentActivity.onStart(Unknown Source) at android.support.v7.app.AppCompatActivity.onStart(Unknown Source) at com.Activity.onStart(Unknown Source) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1238) at android.app.Activity.performStart(Activity.java:6302) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) at android.app.ActivityThread.access$900(ActivityThread.java:150) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616))
I'm using the version 'gun0912.ted:tedbottompicker:1.0.10'
Thanks
It seems you have not handled the onDismiss or noImage selected events
Hi.
Appreciate for sharing awesome source code.
This library really useful and efficiency to me.
But I noticed that has problem with landscape mode screen.
First, when it start in landscape mode shows only 'Select image' title bar.
Second, photo image tile size is too big to show in landscape mode.
In my opinion this behavior looks something strange.
Tested version is '1.0.12'
안녕하세요.
먼저 좋은 소스코드 공유해주셔서 너무 감사하구요...
제 프로젝트에 너무 필요한 기능이라 감동하고 있습니다. ^^
그런데 가로 모드에서는 조금 이상한 동작을 하고 있는듯 보입니다.
먼저 처음 Picker를 실행하면 타이틀 바에 사진 선택 바만 살짝 보입니다.
거기에 바를 올려보면 이미지 타일이 가로모드에서는 조금 크게 보입니다.
이상의 동작이 제 생각엔 조금 이상하게 보입니만 수정 계획이 있으실지 문의 합니다.
테스트 버전은 '1.0.12'입니다.
감사합니다.
While selecting camera from the grid it shows Can't connect to camera dialog with ok button.
Please help.
and also i want to know is there any way to select multiple image at once?
If the "Pictures" directory has been deleted by the user, or doesn't yet exist, the library will crash when trying to generate the URI for the camera.
I am facing a problem when i try to capture image from camera if the target sdk is 24 or above the app crashs known that it works well with least android versions and here is the exception
android.os.FileUriExposedException: file:///storage/emulated/0/Pictures/JPEG_20170330135039_1219814178.jpg exposed beyond app through ClipData.Item.getUri()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:1799)
at android.net.Uri.checkFileUriExposed(Uri.java:2346)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:832)
at android.content.Intent.prepareToLeaveProcess(Intent.java:8909)
at android.content.Intent.prepareToLeaveProcess(Intent.java:8894)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1517)
at android.app.Activity.startActivityForResult(Activity.java:4224)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:79)
at android.support.v4.app.ActivityCompatJB.startActivityForResult(ActivityCompatJB.java:30)
at android.support.v4.app.ActivityCompat.startActivityForResult(ActivityCompat.java:146)
at android.support.v4.app.FragmentActivity.startActivityFromFragment(FragmentActivity.java:937)
at android.support.v4.app.FragmentActivity$HostCallbacks.onStartActivityFromFragment(FragmentActivity.java:1047)
at android.support.v4.app.Fragment.startActivityForResult(Fragment.java:959)
at android.support.v4.app.Fragment.startActivityForResult(Fragment.java:948)
at gun0912.tedbottompicker.TedBottomPicker.startCameraIntent(TedBottomPicker.java:189)
at gun0912.tedbottompicker.TedBottomPicker.access$000(TedBottomPicker.java:44)
at gun0912.tedbottompicker.TedBottomPicker$2.onItemClick(TedBottomPicker.java:138)
at gun0912.tedbottompicker.adapter.ImageGalleryAdapter$1.onClick(ImageGalleryAdapter.java:131)
at android.view.View.performClick(View.java:5609)
at android.view.View$PerformClick.run(View.java:22262)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
issue at API LEVEL 24
private File getImageFile() {
// Create an image file name
File imageFile = null;
try {
String timeStamp = new SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault()).format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
imageFile = File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
storageDir /* directory */
);
// Save a file: path for use with ACTION_VIEW intents
cameraImageUri = Uri.fromFile(imageFile);
i think.. Uri.fromFile should be changed to like below
FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", createImageFile());
Good work the library is excellent, but I need to print the photograph and get the exift data of the URI.
It returns me empty when I want to get the orientation of the photo. :(
Here.
tedBottomPicker = new TedBottomPicker.Builder(ActivityVisitaFotografias.this)
.setOnImageSelectedListener(new TedBottomPicker.OnImageSelectedListener() {
@Override
public void onImageSelected(Uri uri) {
Bitmap bitmap=null;
try {
bitmap = MediaStore.Images.Media.getBitmap(getApplicationContext().getContentResolver(), uri);
} catch (IOException e) {
e.printStackTrace();
}
if(bitmap!=null)
imageView.setImageBitmap(bitmap);
}
})
Since API 24 we can't expose a file using file:// scheme, because it will cause android.os.FileUriExposedException
, since StrictMode
was enhanced for this since this version.
We need change the scheme to other one, maybe content
?
Here is the particular line where the exception happens .
Here is more info.
I have not found how to select multi images at the same time?
Thanks
I have found the solution. I make a pull request already. Please review
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1888, result=0, data=null} to activity {photo.booth.app/photo.booth.app.PhotoboothActivity}: java.lang.NullPointerException
at android.app.ActivityThread.deliverResults(ActivityThread.java:2934)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:2986)
at android.app.ActivityThread.access$2000(ActivityThread.java:132)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1068)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4293)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at photo.booth.app.PhotoboothActivity.onActivityResult(PhotoboothActivity.java:76)
at android.app.Activity.dispatchActivityResult(Activity.java:4108)
at android.app.ActivityThread.deliverResults(ActivityThread.java:2930)
Caused by: java.lang.NullPointerException: Attempt to read from field 'int gun0912.tedbottompicker.TedBottomPicker$Builder.peekHeight' on a null object reference
at gun0912.tedbottompicker.TedBottomPicker.setupDialog(TedBottomPicker.java:102)
at android.support.v4.app.DialogFragment.getLayoutInflater(DialogFragment.java:310)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1108)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1290)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1272)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2149)
at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:201)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:600)
at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1237)
at android.app.Activity.performStart(Activity.java:6253)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
My requirement is need to select the photo from camera or photos and crop with ratio of 16:9.
So I user TedBottomPicker for the image selection part and for crop I used uCrop lib but face issue that picket conflict with the onActivityResult and unable to select image from camera as well photos.
RT
I want to localized this message!
I have my app setup with a main activity and a navigation drawer that flips between fragments. One of the fragments uses the ted bottom picker, on 1.0.8 I seem to be getting a memory leak.
Here is the exception followed by LeakCanary's analysis:
01-18 19:02:45.340 2957-2975/com.example W/FastPrintWriter: Write failure
java.io.IOException: write failed: EPIPE (Broken pipe)
at libcore.io.IoBridge.write(IoBridge.java:501)
at java.io.FileOutputStream.write(FileOutputStream.java:316)
at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:336)
at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:359)
at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:394)
at android.view.WindowManagerGlobal.dumpGfxInfo(WindowManagerGlobal.java:584)
at android.app.ActivityThread$ApplicationThread.dumpGfxInfo(ActivityThread.java:1175)
at android.app.ApplicationThreadNative.onTransact(ApplicationThreadNative.java:577)
at android.os.Binder.execTransact(Binder.java:565)
Caused by: android.system.ErrnoException: write failed: EPIPE (Broken pipe)
at libcore.io.Posix.writeBytes(Native Method)
at libcore.io.Posix.write(Posix.java:273)
at libcore.io.BlockGuardOs.write(BlockGuardOs.java:319)
at libcore.io.IoBridge.write(IoBridge.java:496)
at java.io.FileOutputStream.write(FileOutputStream.java:316)
at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:336)
at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:359)
at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:394)
at android.view.WindowManagerGlobal.dumpGfxInfo(WindowManagerGlobal.java:584)
at android.app.ActivityThread$ApplicationThread.dumpGfxInfo(ActivityThread.java:1175)
at android.app.ApplicationThreadNative.onTransact(ApplicationThreadNative.java:577)
at android.os.Binder.execTransact(Binder.java:565)
01-18 19:02:45.349 2957-2975/com.example W/FastPrintWriter: Write failure
java.io.IOException: write failed: EPIPE (Broken pipe)
at libcore.io.IoBridge.write(IoBridge.java:501)
at java.io.FileOutputStream.write(FileOutputStream.java:316)
at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:336)
at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:359)
at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:394)
at android.view.WindowManagerGlobal.dumpGfxInfo(WindowManagerGlobal.java:584)
at android.app.ActivityThread$ApplicationThread.dumpGfxInfo(ActivityThread.java:1175)
at android.app.ApplicationThreadNative.onTransact(ApplicationThreadNative.java:577)
at android.os.Binder.execTransact(Binder.java:565)
Caused by: android.system.ErrnoException: write failed: EPIPE (Broken pipe)
at libcore.io.Posix.writeBytes(Native Method)
at libcore.io.Posix.write(Posix.java:273)
at libcore.io.BlockGuardOs.write(BlockGuardOs.java:319)
at libcore.io.IoBridge.write(IoBridge.java:496)
at java.io.FileOutputStream.write(FileOutputStream.java:316)
at com.android.internal.util.FastPrintWriter.flushBytesLocked(FastPrintWriter.java:336)
at com.android.internal.util.FastPrintWriter.flushLocked(FastPrintWriter.java:359)
at com.android.internal.util.FastPrintWriter.flush(FastPrintWriter.java:394)
at android.view.WindowManagerGlobal.dumpGfxInfo(WindowManagerGlobal.java:584)
at android.app.ActivityThread$ApplicationThread.dumpGfxInfo(ActivityThread.java:1175)
at android.app.ApplicationThreadNative.onTransact(ApplicationThreadNative.java:577)
at android.os.Binder.execTransact(Binder.java:565)
01-18 19:03:07.020 2957-4410/com.example D/LeakCanary: In com.example:1.0:1.
01-18 19:03:07.020 2957-4410/com.example D/LeakCanary: * com.current.app.ui.main.MainActivity has leaked:
01-18 19:03:07.020 2957-4410/com.example D/LeakCanary: * GC ROOT static gun0912.tedbottompicker.TedBottomPicker.builder
01-18 19:03:07.021 2957-4410/com.example D/LeakCanary: * references gun0912.tedbottompicker.TedBottomPicker$Builder.context
01-18 19:03:07.021 2957-4410/com.example D/LeakCanary: * leaks com.current.app.ui.main.MainActivity instance
01-18 19:03:07.021 2957-4410/com.example D/LeakCanary: * Retaining: 484 KB.
01-18 19:03:07.021 2957-4410/com.example D/LeakCanary: * Reference Key: 1a66aa7f-b26e-447f-b322-d4777524e49a
01-18 19:03:07.021 2957-4410/com.example D/LeakCanary: * Device: unknown Android Android SDK built for x86_64 sdk_google_phone_x86_64
01-18 19:03:07.021 2957-4410/com.example D/LeakCanary: * Android Version: 7.1 API: 25 LeakCanary: 1.5 00f37f5
01-18 19:03:07.021 2957-4410/com.example D/LeakCanary: * Durations: watch=5062ms, gc=154ms, heap dump=4781ms, analysis=21586ms
To trigger this all i do is create the dialog then pick gallery image then back out of the app via back button. I even commented out all the code I do with the returned uri.
Occurs on 7.1 real device, 7.1 simulator and 4.4 simulator. write storage permission granted for all.
Let me know what other info could help.
Just wondering if you're already working in this feature if so, would you commit your working in progress? But if you are not I'll just keep working on my own implementation.
Hi! Nice library!
It will be really nice to allow setSpacing to add space from the edges too.
It seems to be not hard, because this feature already in your code base:
rc_gallery.addItemDecoration(new GridSpacingItemDecoration(gridLayoutManager.getSpanCount(), builder.spacing, false));
Will be great if you can add parameter to change this false to true in the builder. Maybe right in the setSpacing() method.
//Image Upload
TedBottomPicker tedBottomPicker = new TedBottomPicker.Builder(MainActivity.this)
.setOnImageSelectedListener(new TedBottomPicker.OnImageSelectedListener() {
@Override
public void onImageSelected(Uri uri) {
// here is selected uri
Log.e("CAMERA",uri.toString());
}
})
.create();
tedBottomPicker.show(getSupportFragmentManager());
I try to get Uri from onImageSelected, but I can not get Uri when I select image from touch camera or gallery icon. I just can get Uri when I touch other bottom images.
Could you let me know how to get Uri when I touch camera or gallery icon?
Thanks :)
onImageSelected를 통해서 Uri를 가져오고 싶은데, 카메라 버튼이나 갤러리 버튼을 통해서 사진을 선택할 경우 Uri를 가져오지 못하고, 밑에 뜨는 이미지를 선택할 때는 Uri를 가져옵니다. 혹시 카메라버튼이나 갤러리 버튼을 통해 선택한 사진의 Uri를 가져오려면 어떻게 구현하면 될까요?
감사합니다.
我在TedBottomPicker中#183,查看了打开相机的地方,
Intent cameraInent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);这里改为
Intent cameraInent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE_SECURE);就能够打开相机了。
参考:
https://developer.android.com/reference/android/provider/MediaStore.html#ACTION_IMAGE_CAPTURE
LeakCanary detected a memory leak. Tracking it down, I found that there's a static variable for the builder at TedBottomPicker.java:16 and the builder has a reference to the context TedBottomPicker.java:553
Is there a reason for keeping a static instance of the builder?
i can not select multi images from gallery
How can i select Multiple Images and also how to set custom layout for title??
Is it possible to pick videos too?
This error occurred in version 1.0.9
FATAL EXCEPTION: main
java.lang.SecurityException: Permission Denial: opening provider android.support.v4.content.FileProvider from ProcessRecord{42997758 569:com.sec.android.app.camera/u0a10079} (pid=569, uid=10079) that is not exported from uid 10163
I google this error and found this link https://medium.com/@a1cooke/using-v4-support-library-fileprovider-and-camera-intent-a45f76879d61#.34hcs7dml
I read this page and based on that I think you should add below code to startCameraIntent method
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
List resolvedIntentActivities = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
for (ResolveInfo resolvedIntentInfo : resolvedIntentActivities) {
String packageName = resolvedIntentInfo.activityInfo.packageName;
context.grantUriPermission(packageName, fileUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
I think it happened just on multi image selecting!
I have implemented it as what it looks like in the example. I already checked for permissions. However after taking a picture from the camera, it seems like it was pressed back button, and no Uri
provided.
After experimenting with it, it turns out because I have a method called onActivityResult
in the activity, so how to fix this issue? I already change the request code for other request, but still no luck.
In the latest version the issue with crashing on rotation when the picker is open is back (previously reported in #19 and the same exception also happens in #42 ). The previous fix was seemingly reverted by this change: c4f0907
04-15 12:28:30.079 3528-3528/CENSORED E/AndroidRuntime: FATAL EXCEPTION: main
Process: CENSORED, PID: 3528
java.lang.RuntimeException: Unable to start activity ComponentInfo{CENSORED/CENSORED.MainActivity}: java.lang.NullPointerException: Attempt to read from field 'boolean gun0912.tedbottompicker.TedBottomPicker$Builder.showTitle' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2666)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4520)
at android.app.ActivityThread.-wrap19(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1484)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6128)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Caused by: java.lang.NullPointerException: Attempt to read from field 'boolean gun0912.tedbottompicker.TedBottomPicker$Builder.showTitle' on a null object reference
at gun0912.tedbottompicker.TedBottomPicker.setTitle(TedBottomPicker.java:483)
at gun0912.tedbottompicker.TedBottomPicker.setupDialog(TedBottomPicker.java:168)
at android.support.v4.app.DialogFragment.getLayoutInflater(DialogFragment.java:315)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2900)
at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:2207)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1326)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2900)
at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:201)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:603)
at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
at CENSORED.MainActivity.onStart(MainActivity.java:162)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1249)
at android.app.Activity.performStart(Activity.java:6699)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2629)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4520)
at android.app.ActivityThread.-wrap19(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1484)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6128)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Bottomsheet flickers and force expands to top when you select image, or when you`r deleting it from selected images... problem occurs when multi select mode is launched, single select seems ok
I have used Glide in my base app but when i call TedBottom picker it gives this error
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.