Repository navigation
Description
I can reproduce this exception with the following steps:
Goto an folder which is configured for grid-view but is empty
Press back button
On master it seems to be necessary to switch from list to gridview prior to click back.
The calling code is in: ExtendedListFragment:428 (function setFooterEnabled)
************ CAUSE OF ERROR ************
java.lang.IllegalStateException: Cannot add header view to grid -- setAdapter has already been called.
at third_parties.in.srain.cube.GridViewWithHeaderAndFooter.addFooterView(GridViewWithHeaderAndFooter.java:183)
at com.owncloud.android.ui.fragment.ExtendedListFragment.setFooterEnabled(ExtendedListFragment.java:490)
at com.owncloud.android.ui.fragment.ExtendedListFragment.setFooterText(ExtendedListFragment.java:516)
at com.owncloud.android.ui.fragment.OCFileListFragment.updateLayout(OCFileListFragment.java:830)
at com.owncloud.android.ui.fragment.OCFileListFragment.listDirectory(OCFileListFragment.java:805)
at com.owncloud.android.ui.fragment.OCFileListFragment.onBrowseUp(OCFileListFragment.java:528)
at com.owncloud.android.ui.activity.FileDisplayActivity.onBackPressed(FileDisplayActivity.java:901)
at android.app.Activity.onKeyUp(Activity.java:2632)
at android.view.KeyEvent.dispatch(KeyEvent.java:3214)
at android.app.Activity.dispatchKeyEvent(Activity.java:2887)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:50)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:224)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2610)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4777)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4732)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4271)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4324)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4290)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4416)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4298)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4473)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4271)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4324)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4290)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4298)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4271)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4324)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4290)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4449)
at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:4613)
at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2766)
at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2358)
at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2349)
at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2743)
at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:143)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:6837)
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:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
************ DEVICE INFORMATION ***********
Brand: samsung
Device: zerolte
Model: SM-G925F
Id: LMY47X
Product: zeroltexx
************ FIRMWARE ************
SDK: 22
Release: 5.1.1
Incremental: G925FXXS3QOK2
Activity
tobiasKaminsky commentedon Jan 24, 2016
I can solve this by changing:
mGridView.addFooterView(mGridFooterView, null, false);
to be in the if branch two lines above.
https://github.com/owncloud/android/blob/beta/src/com/owncloud/android/ui/fragment/ExtendedListFragment.java#L490
But I do not know if this affects something else?
@AndyScherzinger @przybylski
AndyScherzinger commentedon Jan 24, 2016
Looking through the code I don't know either. May ask @davivel since he also helped me some time ago with the footer handling when I worked on the Material design changes.
tobiasKaminsky commentedon Mar 14, 2016
@cornzy is this still valid? I cannot reproduce it.
cornzy commentedon Mar 14, 2016
@tobiasKaminsky is there a newer beta release? Just checked F-Droid but there is no update. With 20160120 I could still reproduce.
AndyScherzinger commentedon Mar 14, 2016
@cornzy can you give the latest one a try: https://github.com/owncloud/android/blob/beta/apks/owncloud-beta-20160313.apk?raw=true
Unfortunately we are experiencing problems with f-droid for a couple of week now so the latest beta versions haven't made it to the f-droid repo :(
tobiasKaminsky commentedon Apr 28, 2016
@cornzy Please try again
cornzy commentedon May 1, 2016
Sorry, didn't checked Github Mails too long.
Exception still occurs in latest Beta 20160427. Remember it does not comes when opening the folder but when clicking back button inside the empty folder.
************ CAUSE OF ERROR ************
java.lang.IllegalStateException: Cannot add header view to grid -- setAdapter has already been called.
at third_parties.in.srain.cube.GridViewWithHeaderAndFooter.addFooterView(GridViewWithHeaderAndFooter.java:183)
at com.owncloud.android.ui.fragment.ExtendedListFragment.setFooterEnabled(ExtendedListFragment.java:533)
at com.owncloud.android.ui.fragment.ExtendedListFragment.setFooterText(ExtendedListFragment.java:559)
at com.owncloud.android.ui.fragment.OCFileListFragment.updateLayout(OCFileListFragment.java:855)
at com.owncloud.android.ui.fragment.OCFileListFragment.listDirectory(OCFileListFragment.java:830)
at com.owncloud.android.ui.fragment.OCFileListFragment.onBrowseUp(OCFileListFragment.java:541)
at com.owncloud.android.ui.activity.FileDisplayActivity.onBackPressed(FileDisplayActivity.java:903)
at android.app.Activity.onKeyUp(Activity.java:2712)
at android.view.KeyEvent.dispatch(KeyEvent.java:3273)
at android.app.Activity.dispatchKeyEvent(Activity.java:2982)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:50)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:224)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:50)
at com.android.internal.policy.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2697)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:5220)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5173)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4620)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4673)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4639)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4781)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4647)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4838)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4620)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4673)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4639)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4647)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4620)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4673)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4639)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4814)
at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:5057)
at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2877)
at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2449)
at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2440)
at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2854)
at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
tobiasKaminsky commentedon May 1, 2016
This is a bug that also happens in master, removing beta.
The important step is to switch to grid view on an empty folder.
[-]Beta 20160120: IllegalStateException in GridView[/-][+]IllegalStateException in GridView[/+]davivel commentedon Jul 13, 2016
We need to refactor the methods in the call tree from
OCFileListFragment.onBrowseUp. It's too complex, and ends calling the methodExtendedListFragment.setFooterEnabledfromlistDirectoryeven though it's warned in the method comment that could finish in an exception.We should hide and show the footerView in the grid without adding it , the view itself should be added before, probably in
onCreateView.jesmrec commentedon Apr 21, 2022
Grid view was removed in new architecture. Not reproducible in master either