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

Hyperloop: Android - Can't get value from "Editable" class because toString method is overridden

    Details

    • Story Points:
      5
    • Sprint:
      2016 Sprint 24 SDK

      Description

      I'm currently implementing a Hyperloop lib that uses the native EditText widget.
      The EditText widget holds its value in an instance of the Editable class. When you want to get this value, all you have to do is:

      yourEditText.getText(); // an implicit call to toString() is done here when you try to log this value
      

      The problem that I'm facing is that the Editable implementation of toString() is not accessible with Hyperloop.

      Example:
      Create a Hyperloop enabled project and require the android.text.Editable class in any controller:

      var Editable = require('android.text.Editable');
      

      Build and run the project. Go to the /build/hyperloop/android/js folder and look for the android.text.Editable file. You'll notice that the generated toString() method is not calling the native toString() function like this:

      ...
      this.$native.callNativeFunction({ /* something here */ }) 
      ...
      

      Instead, this is what's being generated:

      Editable.toString = function() {
      	return "[object " + this.className + "]";
      };
      

      This basically blocks you from using any widget/component that stores its data in an Editable instance, since the value of toString() will always be [object android.text.Editable]

        Attachments

          Activity

            People

            • Assignee:
              gmathews Gary Mathews
              Reporter:
              rdperottoni Rodolfo Perottoni
              Reviewer:
              Christopher Williams
              Tester:
              Josh Longton
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Source Code