Skip to content

Loading…

'aload' for nil:NilClass @mEnable = CheckBoxPreference(findPreference("enable")) #181

Open
camelCaseD opened this Issue · 3 comments

2 participants

@camelCaseD

I get the error 'aload' for nil:NilClass @mEnable = CheckBoxPreference(findPreference("enable")) when trying to reference a CheckBoxPreference in android while using pindah during compilation. I have overcame this by doing '@mEnable = CheckBoxPreference(self.findPreference("enable")). For those that have not worked with android in java the code is suppose to be CheckBoxPreference mCheckBox = (CheckBoxPreference) findPreference("key");.

@baroquebobcat
The Mirah Community member

Can you give me a little fuller example? This looks like a scope related issue. Was @mEnable = CheckBoxPreference(findPreference("enable")) in a closure, or just a method definition?
eg

class Clazz
  # ...
  def method
    #this:
    @mEnable = CheckBoxPreference(findPreference("enable"))
    # or this?
    other_method do
      @mEnable = CheckBoxPreference(findPreference("enable"))
    end
  end
end
@camelCaseD

it was the following:

class Clazz
    #...
        def onPreferenceTreeClick
            @mEnable = CheckBoxPreference(findPreference("enable"))
        end
end
@baroquebobcat
The Mirah Community member

Thanks for the reduced case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.