3

I have this code:

public class Home extends Activity{

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
            //...
            //at some point I have
            s.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){

              @Override
              public void onProgressChanged(SeekBar seekBar, int progress,
                      boolean fromUser) {

                  ContextNotionLevel ctnl=new ContextNotionLevel(this);
// <-- how can I reference Home class here to replace **this**, which as it is points to OnSeekBarChangeListener
              }
    }
}
Janusz
  • 187,060
  • 113
  • 301
  • 369
Pentium10
  • 204,586
  • 122
  • 423
  • 502

2 Answers2

5

You can try:

 ContextNotionLevel ctnl=new ContextNotionLevel(Home.this);
ccheneson
  • 49,072
  • 8
  • 63
  • 68
3

You can use Home.this to refer to the Home object.

sepp2k
  • 363,768
  • 54
  • 674
  • 675