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

Crash when no images are set #7

Open
fdonzello opened this issue Mar 10, 2016 · 6 comments
Open

Crash when no images are set #7

fdonzello opened this issue Mar 10, 2016 · 6 comments

Comments

@fdonzello
Copy link

Hi,

as in subject..

I have to remove from the layout to avoid the crash..

@fasteque
Copy link

I'm facing the same issue

08-17 15:17:38.134 6189-6189/com.swisscom.mycloud E/AndroidRuntime: FATAL EXCEPTION: main
                                                                    Process: com.swisscom.mycloud, PID: 6189
                                                                    java.lang.NullPointerException: Attempt to get length of null array
                                                                        at com.goka.kenburnsview.KenBurnsView.autoSwapImage(KenBurnsView.java:181)
                                                                        at com.goka.kenburnsview.KenBurnsView.access$000(KenBurnsView.java:22)
                                                                        at com.goka.kenburnsview.KenBurnsView$1.run(KenBurnsView.java:274)
                                                                        at android.os.Handler.handleCallback(Handler.java:739)
                                                                        at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                        at android.os.Looper.loop(Looper.java:135)
                                                                        at android.app.ActivityThread.main(ActivityThread.java:5254)
                                                                        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:903)
                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

I think the issue is the animation is started when onAttachedToWindow is called, but if you have the view set in the layout it can crash as soon as you start the Activity.

@alaaghribi
Copy link

alaaghribi commented Nov 16, 2016

I have the same problem, and the dev did not respond since March ...

@fasteque
Copy link

@alaaghribi you can always fork it or push a fix or take this as an inspiration and do your own implementation. I think this library works pretty well, so I wouldn't drop it ;)

@sashafiero
Copy link

I had this crop up, and what fixed it for me was realizing that I'd put the view_pager_frame FrameLayout INSIDE the KenBurnsView. Once I realized it was supposed to be on top of it (so to speak), and moved it to outside the KenBurnsView, it worked.

@tomeroto
Copy link

can you give sample layout? I have same problem :(

@sashafiero
Copy link

sashafiero commented Jan 27, 2017

<RelativeLayout>
    <com.goka.kenburnsview.KenBurnsView
        android:id="@+id/tablet_sidebar"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_toLeftOf="@id/tablet_content"/>

    <FrameLayout
        android:id="@+id/view_pager_frame"
        android:layout_width="300dp"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"/>
</RelativeLayout>

They are sibling elements, not parent/child, which was my first problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants