[TIMOB-24684] Hyperloop: Android - Cannot iterate over List interface
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-02-02T18:40:47.000+0000 |
Affected Version/s | Hyperloop 2.1.0, Hyperloop 2.1.1 |
Fix Version/s | Hyperloop 3.0.2 |
Components | Hyperloop |
Labels | Android, Hyperloop |
Reporter | Jorge Macias Garcia |
Assignee | Jan Vennemann |
Created | 2017-05-11T07:02:04.000+0000 |
Updated | 2018-02-05T17:16:41.000+0000 |
Description
When I get some List I can't iterate. In this case getInstalledApplications returns a List.
$.addListener($.index, 'open', onOpen);
function onOpen(e) {
var Activity = require('android.app.Activity'),
activity = new Activity(Ti.Android.currentActivity);
var PackageManager = require('android.content.pm.PackageManager');
var pm = activity.getPackageManager();
var installedApplications = pm.getInstalledApplications(PackageManager.GET_META_DATA);
console.log('installedApplication: ' + installedApplications);
console.log('installedApllications className: ' + installedApplications['className']);
console.log('List size : ' + installedApplications.size()); //Throws exception
}
//Output:
[INFO] installedApplication: [ApplicationInfo{769a688 com.example.android.livecubes}, ApplicationInfo{de98821 com.android.providers.telephony}, ApplicationInfo{e6f3446 com.google.android.googlequicksearchbox}...
[INFO] installedApllications className: java.util.List
[ERROR] TiExceptionHandler: (main) [407,407] ----- Titanium Javascript Runtime Error -----
[ERROR] TiExceptionHandler: (main) [0,407] - In /alloy/controllers/index.js:19,60
[ERROR] TiExceptionHandler: (main) [1,408] - Message: Uncaught TypeError: installedApplications.size is not a function
[ERROR] TiExceptionHandler: (main) [0,408] - Source: console.log("List size : " + installedApplications.size());
[ERROR] V8Exception: Exception occurred at /alloy/controllers/index.js:19: Uncaught TypeError: installedApplications.size is not a function
PR: https://github.com/appcelerator/hyperloop.next/pull/269
Verified the fix with hyperloop 3.0.2. No issues in iterating over list interfaces. Closing. Studio Ver: 5.0.0.201712081732 SDK Ver: 7.0.2.v20180201155017 OS Ver: 10.13.2 Xcode Ver: Xcode 9.2 Appc NPM: 4.2.11 Appc CLI: 7.0.2-master.7 Daemon Ver: 1.0.1 Ti CLI Ver: 5.0.14 Alloy Ver: 1.10.12 Node Ver: 8.9.1 NPM Ver: 5.5.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 --- Android 6.0.1 ⇨ google Pixel --- Android 7.1.1