No enclosing instance of the type is accessible in scope

后端 未结 3 1929
梦如初夏
梦如初夏 2020-12-16 17:19

I have this code:

Thread thread = new Thread(null, vieworders, \"MagentoBackground\");
thread.start();
m_progressDialog = ProgressDialog.show(SoftwarePassion         


        
3条回答
  •  轮回少年
    2020-12-16 17:58

    If you want to put your snippet inside a different class rather than SoftwarePassionView, you can pass an instance of the class SoftwarePassionView in your thread constructor.

    Here is an example:

    Class SoftwarePassionView {
      ....
    
      Thread thread = new something(SoftwarePassionView);
      thread.start();
      ......
      }
    

    In the other class

     Class something extends Thread{
      SoftwarePassionView SPV;
      something(SoftwarePassionView){
      super(null, vieworders, "MagentoBackground");
      this.SPV = SoftwarePassionView}
      }
    
       @Override
    public void run(){
        m_progressDialog = ProgressDialog.show(SPV, 
        "Please wait...", "Retrieving data...", true);
         }
    
      }
    

提交回复
热议问题