{ "id": "123995", "key": "TIMOB-16048", "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": [ { "id": "15719", "description": "2013 Sprint 26", "name": "2013 Sprint 26", "archived": true, "released": true, "releaseDate": "2014-01-03" }, { "id": "15721", "description": "2013 Sprint 26 Core", "name": "2013 Sprint 26 Core", "archived": true, "released": true, "releaseDate": "2014-01-03" }, { "id": "15856", "description": "Release 3.2.1", "name": "Release 3.2.1", "archived": false, "released": true, "releaseDate": "2014-02-10" }, { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-12-23T21:28:26.000+0000", "created": "2013-12-18T23:54:11.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "andoid", "module_tableview", "qe-testadded", "regression" ], "versions": [], "issuelinks": [ { "id": "33926", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "109479", "key": "TIMOB-12658", "fields": { "summary": "Android: TableView row labels disappear, related to className property", "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": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-01-23T10:39:39.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": "Taking picture from the camera and adding new row with the picture to a tableview shows only the first one. \r\n\r\nh2.Steps to reproduce:\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n title : 'image test',\r\n layout : 'vertical'\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n\ttitle : 'take picture'\r\n});\r\nbtn.addEventListener('click',function(e){\r\n\tTi.Media.showCamera({\r\n\t\tsuccess : function(o) {\r\n\t\t var row = Ti.UI.createTableViewRow({\r\n className : 'img'\r\n\t\t });\r\n\t\t row.add(Ti.UI.createImageView({\r\n\t\t\timage : o.media\r\n\t\t }));\r\n\t\t tv.appendRow(row);\r\n\t\t}\r\n\t});\r\n});\r\nwin.add(btn);\r\n \r\nvar tv = Ti.UI.createTableView({});\r\nwin.add(tv);\r\n\r\nwin.open();\r\n\r\n{code} \r\nh4.Expected result:\r\n once a picture is taken, a new row should be added with that image.\r\n\r\nh4.Actual result:\r\n A row is added but only the first row shows an image.\r\n\r\nh3.Important:\r\n I tried this also on a listview and a scrollview also I changed from o.media to o.media.nativePath but nevermind the combination all had the same unfortunate result of showing only the first image.\r\n\r\n", "attachment": [], "flagged": false, "summary": "Only first Image is showing on a tableview when taking a picture from camera", "creator": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "subtasks": [], "reporter": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "environment": "SDK 3.2.0\r\nAndroid 4.1.2", "comment": { "comments": [ { "id": "285107", "author": { "name": "sfeather", "key": "sfeather", "displayName": "Stephen Feather", "active": true, "timeZone": "America/New_York" }, "body": "typo in test case, line 3, missing closing quotes.", "updateAuthor": { "name": "sfeather", "key": "sfeather", "displayName": "Stephen Feather", "active": true, "timeZone": "America/New_York" }, "created": "2013-12-19T00:27:17.000+0000", "updated": "2013-12-19T00:27:17.000+0000" }, { "id": "285109", "author": { "name": "sfeather", "key": "sfeather", "displayName": "Stephen Feather", "active": true, "timeZone": "America/New_York" }, "body": "Instead of referencing the returned blob directly, you really need to save it to a file you are managing yourself.", "updateAuthor": { "name": "sfeather", "key": "sfeather", "displayName": "Stephen Feather", "active": true, "timeZone": "America/New_York" }, "created": "2013-12-19T00:29:26.000+0000", "updated": "2013-12-19T00:29:26.000+0000" }, { "id": "285110", "author": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "body": "Also tried that, saved it to all possible places that Ti.FileSystem has to offer but nothing worked.", "updateAuthor": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "created": "2013-12-19T00:32:19.000+0000", "updated": "2013-12-19T00:34:53.000+0000" }, { "id": "285127", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "We have determined this is a regression from 3.1.3, and caused by the fix for TIMOB-12658. Can you try a workaround specifying a height/width value in the image view? Fixing this right now is likely to be extremely risky, but we will attempt a fix onto the 3.2.X branch ASAP right after 3.2.0 goes out.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-19T03:41:50.000+0000", "updated": "2013-12-19T03:42:33.000+0000" }, { "id": "285293", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Master PR: https://github.com/appcelerator/titanium_mobile/pull/5151", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-20T00:57:18.000+0000", "updated": "2013-12-20T00:57:18.000+0000" }, { "id": "285299", "author": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "body": "I think this does not only concern tableviewrow, you can reproduce it also with simple view.\r\nJust replace the tableview with a view that has a vertical layout and you'll see the same result.\r\nAlso as I wrote the under important section this happens also for listview and scrollview.", "updateAuthor": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "created": "2013-12-20T01:09:35.000+0000", "updated": "2013-12-20T01:09:35.000+0000" }, { "id": "285308", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "What are you adding to the listview/scrollview? Could you please provide a code snippet of what you're talking about?\r\n\r\nI tried adding the image view to a scroll view with vertical layout, and it works fine.", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-20T01:20:00.000+0000", "updated": "2013-12-20T01:22:51.000+0000" }, { "id": "285312", "author": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "body": "As written in the ticket this happens when you take an image somewhere from the local storage, the scenario I described is taking a a picture with the camera and add it to a tableview (look at the code snippet at the steps to reproduce).\r\nNow if you replace the tableview with a vertical view or a scrollableview or a listview you will still get the same result - only the first pic you took will be shown.\r\n\r\n", "updateAuthor": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "created": "2013-12-20T01:29:39.000+0000", "updated": "2013-12-20T01:29:39.000+0000" }, { "id": "285315", "author": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "body": "of course test it on device and not simulator. I tested it on Samsung Galaxy II.", "updateAuthor": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "created": "2013-12-20T01:34:10.000+0000", "updated": "2013-12-20T01:34:10.000+0000" }, { "id": "285316", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "If you just replaced the tableview line with a scroll view, then you are adding a tableview row to a scroll view. In that scenario, it is invalid code. If you could provide a snippet of EXACTLY what you are using, that would be very helpful.\n\n\n", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-20T01:34:40.000+0000", "updated": "2013-12-20T01:34:40.000+0000" }, { "id": "285318", "author": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "body": "Yes of course you also need of course to change the row to a view. here is the code snippet:\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n title : 'image test',\r\n});\r\n \r\nvar btn = Ti.UI.createButton({\r\n title : 'take picture'\r\n});\r\nbtn.addEventListener('click',function(e){\r\n Ti.Media.showCamera({\r\n success : function(o) {\r\n var row = Ti.UI.createView({\r\n });\r\n row.add(Ti.UI.createImageView({\r\n image : o.media\r\n }));\r\n view.add(row);\r\n }\r\n });\r\n});\r\nwin.add(btn);\r\n \r\nvar view = Ti.UI.createView({\r\n layout : 'vertical',\r\n width : Ti.UI.FILL,\r\n height : Ti.UI.FILL\r\n});\r\nwin.add(view);\r\n \r\nwin.open();\r\n{code}", "updateAuthor": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "created": "2013-12-20T01:41:50.000+0000", "updated": "2013-12-20T08:49:45.000+0000" }, { "id": "285400", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The test case you posted does not work. The view covers the button, and you can't click on it. You need to make the window a 'vertical' layout. After I change that, I was able to take the picture, and have it placed inside the view correctly. I tried this on a Galaxy SII and a Nexus 5, and both work fine.\n\nSo I can't reproduce the problem. If you have any more use cases, please let me know.", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-20T18:13:12.000+0000", "updated": "2013-12-20T18:13:12.000+0000" }, { "id": "285406", "author": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "body": "you're correct forgot to add vertical layout to the window, but the bug happens if you take *more than one picture*.\r\nDo you see all of the pictures ?", "updateAuthor": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "created": "2013-12-20T19:10:25.000+0000", "updated": "2013-12-20T19:10:25.000+0000" }, { "id": "285450", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "You shouldn't see more than one picture.\n\nYou're adding 2 views with 'fill' behavior to a view with vertical layout so only one view show at a time. If you want it to display more than 1 image, you need to define height/width for the 'row' variable.", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-20T22:09:30.000+0000", "updated": "2013-12-20T22:09:30.000+0000" }, { "id": "285454", "author": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "body": "You are right I should have set the height (forgot) and I see that with view example it is working.\r\nSo seems to me that the fix you did in tableviewrow should solve the problem.\r\nBut what about lisview and scrollview? I experienced the same behavior as in tableview.", "updateAuthor": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "created": "2013-12-20T22:36:17.000+0000", "updated": "2013-12-20T22:36:44.000+0000" }, { "id": "285457", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "It worked fine on the scroll view for me as well. If you are experiencing the issue on either of those, please provide an example.", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-20T22:41:49.000+0000", "updated": "2013-12-20T22:41:49.000+0000" }, { "id": "285473", "author": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "body": "yeah same problem with listview, take more than 2 pictures and you'll see that only the first 2 are shown.\r\nhere is the code snippet:\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\ttitle : 'image test',\r\n\tlayout : 'vertical',\r\n\tnavBarHidden : false\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n\ttitle : 'take picture'\r\n});\r\nbtn.addEventListener('click', function(e) {\r\n\tTi.Media.showCamera({\r\n\t\tsuccess : function(o) {\r\n\t\t\tlistSection.appendItems([{\r\n\t\t\t\tpic : {\r\n\t\t\t\t\timage : o.media\r\n\t\t\t\t},\r\n\t\t\t\ttemplate : 'picTemplate'\r\n\t\t\t}]);\r\n\t\t}\r\n\t});\r\n});\r\nwin.add(btn);\r\nvar picTemplate = {\r\n\tproperties : {\r\n\t\theight : 120\r\n\t},\r\n\tchildTemplates : [{\r\n\t\ttype : 'Ti.UI.ImageView', \r\n\t\tbindId : 'pic', \r\n\t\tproperties : {\r\n\t\t\twidth : Ti.UI.FILL,\r\n\t\t\theight : 100,\r\n\t\t\tleft : 10,\r\n\t\t\tright : 10,\r\n\t\t\ttop : 10,\r\n\t\t\tbottom : 10\r\n\t\t}\r\n\t}]\r\n};\r\n\r\nvar listView = Ti.UI.createListView({\r\n\ttemplates : {\r\n\t\t'picTemplate' : picTemplate\r\n\t},\r\n\tdefaultItemTemplate : 'picTemplate',\r\n});\r\n\r\nvar listSection = Ti.UI.createListSection();\r\nlistView.setSections([listSection]);\r\nwin.add(listView);\r\n\r\nwin.open();\r\n\r\n{code}", "updateAuthor": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "created": "2013-12-20T23:04:00.000+0000", "updated": "2013-12-20T23:04:00.000+0000" }, { "id": "285487", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I tried this on a Galaxy SII and a Nexus 5 and it works fine for me. I was able to take multiple pictures and it showed up in the row. I did notice in the Galaxy SII, it didn't show up for the 4th picture, but in the logs, it shows an out of memory exception, which is a limitation of the device memory while loading the bitmap.\n\n{code}\n[INFO] : \b\b \b TiDrawableReference: (pool-3-thread-1) [323,122812] Unable to decode bitmap. Will retry.\n[DEBUG] : \b\b \bskia: --- SkImageDecoder::Factory returned null\n[INFO] : \b\b \b TiDrawableReference: (pool-3-thread-1) [252,123064] Unable to decode bitmap. Will retry.\n{code}", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-21T00:07:11.000+0000", "updated": "2013-12-21T00:07:11.000+0000" }, { "id": "285522", "author": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "body": "Allen, I'd like to thank you for the logging you showed me, it finally helped me to figure out what went wrong.\r\nIt has nothing to do with tableview. the problem here is purely memory!!!.\r\n\r\nPictures taken from camera are big and when bitmap tries to decode them it fails on out of memory.\r\nSo after a long hard work I managed to come with a good solution for this.\r\nWhat needs to be done is resizing the picture and compressing it.\r\nI tried to use the ImageFactory you guys developed but it failed on OutOfMemory error because code assumes it can compress all of the imageBlob bytes when infact it is to big.\r\nSo I created my own module and used the android best practice guide for displaying bitmaps - http://developer.android.com/training/displaying-bitmaps/load-bitmap.html\r\n\r\nSo to conclude:\r\n1. I don't think there is a bug with tableview regarding taking pictures, it is all related to memory.\r\n thus you can place an image in any type of view (table/list/scroll) but it will show it only if image is not too big.\r\n2. You should maybe show a clearer indication for this, like broken picture, or an error popup.\r\n3. ImageFactory module needs to be fixed it assumes that decode of byte array is always possible.\r\n\r\n", "updateAuthor": { "name": "nadavh", "key": "nadavh", "displayName": "Nadav Hoze", "active": true, "timeZone": "Asia/Gaza" }, "created": "2013-12-22T00:00:31.000+0000", "updated": "2013-12-22T00:00:31.000+0000" }, { "id": "285647", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~nadavh], thanks for your feedback. There is actually an issue with loading images with tableview, and I have addressed it in the PR.\n\nFor out of memory type exceptions, our normal approach is to log these errors instead of showing it in the UI. We wouldn't want production apps to have error popups.\n\nFor the ImageFactory module, it would be great if you could file a separate ticket for that module. We'll make sure to take a look at it accordingly.\n", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-23T18:07:29.000+0000", "updated": "2013-12-23T18:07:29.000+0000" }, { "id": "285686", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "3_2_X: https://github.com/appcelerator/titanium_mobile/pull/5163", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-23T23:25:04.000+0000", "updated": "2013-12-23T23:25:04.000+0000" }, { "id": "286908", "author": { "name": "nmittal", "key": "nmittal", "displayName": "Neha Mittal", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Tested with SDK: 3.2.1.v20140106195644 and 3.3.0.v20140106195650 using environment:\n\nAppcelerator Studio: 3.2.1.201401061716\nacs@1.0.11\nalloy@1.3.1-beta\nnpm@1.3.2\ntitanium@3.2.0\ntitanium-code-processor@1.1.0\nMac OSX 10.9 Mavericks\nDevice: Nexus 7(v4.4.2)\n\nResult: I am able to take multiple pictures and it showed up in the row.", "updateAuthor": { "name": "nmittal", "key": "nmittal", "displayName": "Neha Mittal", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-01-07T06:55:48.000+0000", "updated": "2014-01-07T06:55:48.000+0000" }, { "id": "287093", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix. Took 6 pics and all appeared one after other as expected.\r\n\r\nClosing.\r\n\r\nEnvironment:\r\nAppc Studio : 3.2.1.201401061716\r\nTi SDK : 3.2.1.v20140106195644 , 3.3.0.v20140106195650\r\nMac OSX : 10.8.5\r\nAlloy : 1.3.1-beta \t\r\nCLI - 3.2.0\r\nSamsung Galaxy S4 running android 4.2.2\r\nNexus 5 running android 4.4", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-07T23:20:02.000+0000", "updated": "2014-01-07T23:20:02.000+0000" } ], "maxResults": 23, "total": 23, "startAt": 0 } } }