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

Open
camelCaseD opened this Issue Apr 14, 2012 · 3 comments

Comments

Projects
None yet
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

This comment has been minimized.

Show comment
Hide comment
@baroquebobcat

baroquebobcat Apr 16, 2012

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
Member

baroquebobcat commented Apr 16, 2012

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

This comment has been minimized.

Show comment
Hide comment
@camelCaseD

camelCaseD May 22, 2012

it was the following:

class Clazz
    #...
        def onPreferenceTreeClick
            @mEnable = CheckBoxPreference(findPreference("enable"))
        end
end

it was the following:

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

This comment has been minimized.

Show comment
Hide comment
@baroquebobcat

baroquebobcat May 25, 2012

Member

Thanks for the reduced case.

Member

baroquebobcat commented May 25, 2012

Thanks for the reduced case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment