yazeed44 / MultiImagePicker

A library to pick multi images in Android
MIT License
388 stars 100 forks source link

Is it possible to use the fragments directly? #43

Open banie opened 9 years ago

banie commented 9 years ago

It will be really convenient if we can use the fragments directly such as the AlbumsFragment and ImagesThumbnailFragment, so we can really customize the use for our app. PickerActivity seems to just instantiate them in a normal way which works, but when I instantiate them within my viewpager, it throws a null pointer. Do you have any tips?

Thank you, this is the stacktrace: java.lang.NullPointerException at net.yazeed44.imagepicker.ui.AlbumsFragment.onCreateView(AlbumsFragment.java:46) at android.support.v4.app.Fragment.performCreateView(Fragment.java:1789) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:955) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501) at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:490) at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141) at android.support.v4.view.ViewPager.populate(ViewPager.java:1105) at android.support.v4.view.ViewPager.populate(ViewPager.java:951) at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1473) at android.view.View.measure(View.java:17495) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5363) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:17495) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5363) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.support.v7.internal.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:124) at android.view.View.measure(View.java:17495) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5363) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:17495) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5363) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:17495) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5363) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410) at android.widget.LinearLayout.measureVertical(LinearLayout.java:695) at android.widget.LinearLayout.onMeasure(LinearLayout.java:588) at android.view.View.measure(View.java:17495) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5363) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2548) at android.view.View.measure(View.java:17495) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2285) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1396) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1595) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6632) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:814) at android.view.Choreographer.doCallbacks(Choreographer.java:614) at android.view.Choreographer.doFrame(Choreographer.java:584) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:800) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:146) at android.app.ActivityThread.main(ActivityThread.java:5487) 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:1283) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) at dalvik.system.NativeStart.main(Native Method)

yazeed44 commented 9 years ago

This issue is kinda similar to https://github.com/yazeed44/MultiImagePicker/issues/15

Yes i have been thinking of this for a while , also it's needed for my another project Photo Sign

The exception happens because there's no Picker class in the event bus which is used to communicate in my lib

I can't promise that i will implement this feature in the mean time

but when I instantiate them within my viewpager

I'm sorry i can't think of a scenario that images fragment or albums used in view pager :laughing: