2

我有一个名为 Gradebook 的顶级类,它通过匿名处理程序为 Spinner 设置事件处理程序,其中包含一个匿名线程调用

this.spin.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener(){

        public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3){
            Gradebook.this.pd = ProgressDialog.show((Context)Gradebook.this, (CharSequence)"", (CharSequence)"Loading Grade Book...", true, true);
            Gradebook.this.gradecatitems.clear();
            new Thread(new Runnable() {
                    public void run() {
                       //I need to reference the top-most level class, GradeBook's members in here
                    }
            }).start();
        });

如何从我的线程中引用顶级类成员?请记住,我的线程是匿名类中已经存在的匿名类。

4

1 回答 1

4

它看起来像这样。-

YourClassName.this
于 2013-10-03T10:34:08.947 回答