{ "id": "139381", "key": "TIMOB-18413", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2018-01-05T02:57:46.000+0000", "created": "2014-11-11T10:35:15.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [ "TCSupport" ], "versions": [ { "id": "16676", "description": "Release 3.4.1", "name": "Release 3.4.1", "archived": false, "released": true, "releaseDate": "2014-11-14" }, { "id": "16704", "description": "Release 3.5.0", "name": "Release 3.5.0", "archived": false, "released": true, "releaseDate": "2015-01-13" } ], "issuelinks": [ { "id": "56243", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "121818", "key": "TIMOB-15780", "fields": { "summary": "Android: ScrollableView.setCurrentPage() fires \"scrollend\" event when it shouldn't", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-01-05T02:57:46.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h4. Problem Description\r\nWhen trying to remove view in \"scrollend\" event, I'm getting crash. \r\n\r\nh4. Steps to reproduce\r\n1. Create a new mobile project (Classic Titanium)\r\n2. Replace the contents of app.js with this code: \r\n{code}\r\nvar win = Ti.UI.createWindow();\r\n\r\nvar colors = [ '#f23', '#246', '#48b', '#842', '#b47' ];\r\nvar currentIndex = 0;\r\n\r\nfunction createView() {\r\n\tvar view = Ti.UI.createView({ backgroundColor: colors[currentIndex] });\r\n\tcurrentIndex = (currentIndex + 1) % colors.length;\r\n\treturn view;\r\n}\r\n\r\nvar scrollableView = Ti.UI.createScrollableView({\r\n\tviews: [ createView() ],\r\n\tscrollingEnabled: false,\r\n\tshowPagingControl: false\r\n});\r\n\r\nscrollableView.addEventListener('scrollend', function() {\r\n\t// scrollableView.removeView(0); // doesn't work\r\n\tTi.API.info('scrollableView.views ');\r\n\tTi.API.info(scrollableView.views.length);\r\n\tscrollableView.removeView(scrollableView.views[0]); // crash\r\n\t// scrollableView.setViews(scrollableView.views.unshift()); // crash\r\n});\r\n\r\nscrollableView.addEventListener('singletap', function() {\r\n\tscrollableView.addView(createView());\r\n\tscrollableView.moveNext();\r\n});\r\n\r\nwin.add(scrollableView);\r\nwin.open();\r\n{code}\r\n3. Run in a device\r\n4. Scroll to the end, while checking the logs. \r\n\r\n\r\nh4. Extra information\r\nFirst issue is that passing view index to \"removeView\" method doesn't do anything, although it's documented it works.\r\n\r\n{code}\r\nTiScrollableView: (main) [32757,41129] removeView() ignored. Expected a Titanium view object, got Integer\r\n{code}\r\n\r\nSecond issue is crash. Just tap on screen to see the issue. Here are logs:\r\n\r\n{code}\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): FATAL EXCEPTION: main\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): Process: com.tipsyandtumbler.testing, PID: 14644\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): java.lang.IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 2, 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\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.support.v4.view.ViewPager.populate(ViewPager.java:962)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.support.v4.view.ViewPager.populate(ViewPager.java:914)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1436)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.View.measure(View.java:16497)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat org.appcelerator.titanium.view.TiCompositeLayout.constrainChild(TiCompositeLayout.java:398)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat org.appcelerator.titanium.view.TiCompositeLayout.onMeasure(TiCompositeLayout.java:278)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.View.measure(View.java:16497)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat org.appcelerator.titanium.view.TiCompositeLayout.constrainChild(TiCompositeLayout.java:398)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat org.appcelerator.titanium.view.TiCompositeLayout.onMeasure(TiCompositeLayout.java:278)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.View.measure(View.java:16497)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat org.appcelerator.titanium.view.TiCompositeLayout.constrainChild(TiCompositeLayout.java:398)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat org.appcelerator.titanium.view.TiCompositeLayout.onMeasure(TiCompositeLayout.java:278)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.View.measure(View.java:16497)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.widget.FrameLayout.onMeasure(FrameLayout.java:310)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.View.measure(View.java:16497)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:327)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.View.measure(View.java:16497)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.widget.FrameLayout.onMeasure(FrameLayout.java:310)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.View.measure(View.java:16497)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1912)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1109)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1291)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.Choreographer.doCallbacks(Choreographer.java:574)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.Choreographer.doFrame(Choreographer.java:544)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.os.Handler.handleCallback(Handler.java:733)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.os.Handler.dispatchMessage(Handler.java:95)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.os.Looper.loop(Looper.java:136)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat android.app.ActivityThread.main(ActivityThread.java:5001)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat java.lang.reflect.Method.invoke(Native Method)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)\r\n11-11 11:15:50.749: E/AndroidRuntime(14644): \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)\r\n11-11 11:15:50.749: W/ActivityManager(608): Force finishing activity com.tipsyandtumbler.testing/org.appcelerator.titanium.TiActivity\r\n11-11 11:15:51.249: W/ActivityManager(608): Activity pause timeout for ActivityRecord{65b28c98 u0 com.tipsyandtumbler.testing/org.appcelerator.titanium.TiActivity t164 f}\r\n{code}\r\n\r\n\r\nI tired to use timeout, but no luck. So, atm there is no workaround I can think of.", "attachment": [], "flagged": false, "summary": "Android: ScrollableView crash", "creator": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "* TiSDK 3.4.0.GA\r\n* TiCLI 3.4.0\r\n* Android 4.4.4\r\n* Nexus 5\r\n* OSX 10.10", "comment": { "comments": [ { "id": "331551", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Also, check out this example of infinite scrollable view: http://developer.appcelerator.com/question/156180/infinite-circular-scroll\r\n\r\n\r\nWhile it works fine on iOS, on Android (after commenting out \"backgroundColor: Ti.UI.iOS.COLOR_SCROLLVIEW_BACKGROUND\" line) example works, but you'll see relayout flash (which is not good UX).", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2014-11-11T10:38:59.000+0000", "updated": "2014-11-11T10:38:59.000+0000" }, { "id": "339642", "author": { "name": "goseta", "key": "goseta", "displayName": "Juan Maceda", "active": true, "timeZone": "America/Los_Angeles" }, "body": "any idea when this can be addressed?? thanks!!!", "updateAuthor": { "name": "goseta", "key": "goseta", "displayName": "Juan Maceda", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-01-19T03:45:52.000+0000", "updated": "2015-01-19T03:45:52.000+0000" }, { "id": "348968", "author": { "name": "aroyce", "key": "aroyce", "displayName": "Andrew Royce", "active": true, "timeZone": "America/New_York" }, "body": "The only way I could successfully remove a view from a scrollableview in Android was to scroll to a different view, remove view, then scroll back. Not a great solution but works for now.\r\n\r\n{code:JavaScript}\r\ncontainer.scrollToView(0);\r\ncontainer.removeView(container.views[i - 1]);\r\n{code}\r\nSource: NeoPro\r\n\r\nhttps://developer.appcelerator.com/question/157758/android---scrollableview---removeview---not-working", "updateAuthor": { "name": "aroyce", "key": "aroyce", "displayName": "Andrew Royce", "active": true, "timeZone": "America/New_York" }, "created": "2015-04-08T20:31:37.000+0000", "updated": "2015-04-08T20:31:37.000+0000" }, { "id": "432772", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Unable to reproduce crash, but I have confirmed that the \"scrollend\" event is being fired when it shouldn't (after the remove). This causes the attached project to remove both child views instead of only the 1st child view within the ScrollableView.\r\n\r\nThe fix for [TIMOB-15780] will resolved this issue. This fix is planned to be in Titanium 7.1.0.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-01-05T02:56:45.000+0000", "updated": "2018-01-05T02:56:45.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }