2

Hello I was wondering how to do the following:

CheckBoxPreference mCheckBox = (CheckBoxPreference) findPreference("key");

except in mirah?                                     ^^^^^^^^^^^^^^^^^^^^^^^
                                                                This cast here is what I don't know how to translate into mirah.

camelCaseD
  • 2,483
  • 5
  • 29
  • 44

1 Answers1

2

From what I understand, casting in Mirah is in the form of wrapping the object in the form of TypeToCastTo(ObjectToCast), for example:

mCheckBox = CheckBoxPreference(findPreference("key"));

AC2MO
  • 1,627
  • 13
  • 15
  • thx for the response. When I try the following `@mEnable = CheckBoxPreference(findPreference("enable"))` I get the error `undefined method 'aload' for nil:NilClass @mEnable = CheckBoxPreference(findPreference("enable"))` when I convert from mirah to java – camelCaseD Apr 14 '12 at 05:07
  • I believe `findPreference("enable")` should be `self.findPreference("enable")`... I've only glanced at using Mirah, so I may be missing something :/ – AC2MO Apr 14 '12 at 05:18
  • 1
    well adding self didn't help but I got a few other ideas to try. – camelCaseD Apr 14 '12 at 15:08
  • The `aload` thing is a compiler bug, could you file an issue at https://github.com/mirah/mirah/issues ? – BaroqueBobcat Apr 14 '12 at 21:28
  • @BaroqueBobcat the issue can be found at [https://github.com/mirah/mirah/issues/181](http://https://github.com/mirah/mirah/issues/181) – camelCaseD Apr 14 '12 at 22:03