[TIMOB-23134] Android: ScrollableView crashed when setViews([])
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-04-05T03:31:11.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.4.0 |
Components | Android |
Labels | android, scrollableView |
Reporter | Andrey Tkachenko |
Assignee | Ashraf Abu |
Created | 2016-04-01T14:49:43.000+0000 |
Updated | 2016-05-27T18:35:03.000+0000 |
Description
I cant clear views through setViews([])
Error:
[ERROR] : TiApplication: (main) [7060,7060] Sending event: exception on thread: main msg:java.lang.IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 3, found: 0 Pager id: ffffffff Pager class: class ti.modules.titanium.ui.widget.TiUIScrollableView$1 Problematic adapter: class ti.modules.titanium.ui.widget.TiUIScrollableView$ViewPagerAdapter; Titanium 5.2.1,2016/03/18 22:51,23e1c7d
[ERROR] : TiApplication: java.lang.IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 3, found: 0 Pager id: ffffffff Pager class: class ti.modules.titanium.ui.widget.TiUIScrollableView$1 Problematic adapter: class ti.modules.titanium.ui.widget.TiUIScrollableView$ViewPagerAdapter
[ERROR] : TiApplication: at android.support.v4.view.ViewPager.populate(ViewPager.java:1000)
[ERROR] : TiApplication: at android.support.v4.view.ViewPager.populate(ViewPager.java:952)
[ERROR] : TiApplication: at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1474)
[ERROR] : TiApplication: at android.view.View.measure(View.java:15518)
[ERROR] : TiApplication: at org.appcelerator.titanium.view.TiCompositeLayout.constrainChild(TiCompositeLayout.java:398)
[ERROR] : TiApplication: at org.appcelerator.titanium.view.TiCompositeLayout.onMeasure(TiCompositeLayout.java:278)
[ERROR] : TiApplication: at android.view.View.measure(View.java:15518)
[ERROR] : TiApplication: at org.appcelerator.titanium.view.TiCompositeLayout.constrainChild(TiCompositeLayout.java:398)
[ERROR] : TiApplication: at org.appcelerator.titanium.view.TiCompositeLayout.onMeasure(TiCompositeLayout.java:278)
[ERROR] : TiApplication: at android.view.View.measure(View.java:15518)
[ERROR] : TiApplication: at org.appcelerator.titanium.view.TiCompositeLayout.constrainChild(TiCompositeLayout.java:398)
[ERROR] : TiApplication: at org.appcelerator.titanium.view.TiCompositeLayout.onMeasure(TiCompositeLayout.java:278)
[ERROR] : TiApplication: at android.view.View.measure(View.java:15518)
[ERROR] : TiApplication: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
[ERROR] : TiApplication: at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
[ERROR] : TiApplication: at android.support.v7.internal.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:124)
[ERROR] : TiApplication: at android.view.View.measure(View.java:15518)
[ERROR] : TiApplication: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
[ERROR] : TiApplication: at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:393)
[ERROR] : TiApplication: at android.view.View.measure(View.java:15518)
[ERROR] : TiApplication: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
[ERROR] : TiApplication: at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
[ERROR] : TiApplication: at android.view.View.measure(View.java:15518)
[ERROR] : TiApplication: at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
[ERROR] : TiApplication: at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
[ERROR] : TiApplication: at android.view.View.measure(View.java:15518)
[ERROR] : TiApplication: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
[ERROR] : TiApplication: at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
[ERROR] : TiApplication: at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
[ERROR] : TiApplication: at android.view.View.measure(View.java:15518)
[ERROR] : TiApplication: at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
[ERROR] : TiApplication: at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
[ERROR] : TiApplication: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
[ERROR] : TiApplication: at android.view.ViewRootImpl.doTraversal(ViewR
[ERROR] : TiApplication: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
[ERROR] : TiApplication: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
[ERROR] : TiApplication: at android.view.Choreographer.doCallbacks(Choreographer.java:562)
[ERROR] : TiApplication: at android.view.Choreographer.doFrame(Choreographer.java:532)
[ERROR] : TiApplication: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
[ERROR] : TiApplication: at android.os.Handler.handleCallback(Handler.java:725)
[ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:92)
[ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:137)
[ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5041)
[ERROR] : TiApplication: at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Method.java:511)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
Test code:
index.xml
<Alloy>
<Window class="container">
<ScrollableView id="scrollableView">
<View><Label>1</Label></View>
<View><Label>2</Label></View>
<View><Label>3</Label></View>
</ScrollableView>
<View height="Ti.UI.SIZE" top="0" layout="vertical">
<Button onClick="doClear">Clear</Button>
</View>
</Window>
</Alloy>
index.js
function doClear(e) {
$.scrollableView.setViews([]);
}
$.index.open();
Friday PR: https://github.com/appcelerator/titanium_mobile/pull/7904
Tested code with test case above. Working as expected.
PR https://github.com/appcelerator/titanium_mobile/pull/7904 Merged with test cases in TIMOB-23134 and TIMOB-20116
Verified the fix. Scrollview does not crash when setView([]). Closing. Environment: Appc Studio : 4.6.0.201605180604 Ti SDK : 5.4.0.v20160526011354 Ti CLI : 5.0.8 Alloy : 1.8.7 MAC El Capitan : 10.11.4 Appc NPM : 4.2.5-5 Appc CLI : 5.3.0-47 Node: 4.2.2 Nexus 6 - Android 6.0.0