GridView row remove and animation - Android
Posted
by Pria
on Stack Overflow
See other posts from Stack Overflow
or by Pria
Published on 2010-04-02T10:18:45Z
Indexed on
2010/04/02
10:23 UTC
Read the original article
Hit count: 1034
I have a GridView in which each row has a custom view. The grid view adapter has an array that keeps the custom view.
At click of a button, I want to remove a specific row from the Grid and while doing so I want animation on it. I have an AnimationListener.
When I remove the upper most row from the array and setAdapter in onAnimationEnd(). It works perfectly fine. But, when I remove any other row, it gives a NullPointerException in the main thread.
The exception thread is as follows:
ERROR/AndroidRuntime(11503): java.lang.NullPointerException
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1227)
at android.widget.AbsListView.dispatchDraw(AbsListView.java:1319)
at android.view.View.draw(View.java:5944)
at android.widget.AbsListView.draw(AbsListView.java:2121)
at android.view.ViewGroup.drawChild(ViewGroup.java:1486)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
at android.view.View.draw(View.java:5841)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1486)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
at android.view.View.draw(View.java:5841)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1486)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
at android.view.View.draw(View.java:5841)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1847)
at android.view.ViewRoot.draw(ViewRoot.java:1217)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1030)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1482)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3948)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
at dalvik.system.NativeStart.main(Native Method)
Please help!!!
© Stack Overflow or respective owner