Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-24684

Hyperloop: Android - Cannot iterate over List interface

    Details

      Description

      When I get some List<E> I can't iterate. In this case getInstalledApplications returns a List<ApplicationInfo>.

      $.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
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jvennemann Jan Vennemann
                Reporter:
                jormagar Jorge Macias Garcia
                Reviewer:
                Christopher Williams
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-10679
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code