title: Use ProgressDialog in a non activity class
body: <p>I am using ProgressDialog in my activity which is called from a non-Activity Class.
  Its throwing an error. Below are the two class how i tried to use ProgressDialog which it was not able to achieve.</p>
  
  <p>MainActivity.java</p>
  
  <pre><code>public class LoginPage extends Activity {
  
  
  LoginH appLogin;    
  Context context;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {        
      super.onCreate(savedInstanceState);
      setContentView(R.layout.login);
  
      Button  loginButton = (Button) findViewById(R.id.bLogin);       
      context = LoginPage.this;
  
      loginButton.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
          sDefault =  defaultText.getText().toString();
  
          appLogin = new LoginH(context);
          appLogin.execute(sDefault);         
          }
      });
  }   
  }
  </code></pre>
  
  <p>LoginH.java</p>
  
  <pre><code>public class LoginH extends AsyncTask&lt;String, Void, String&gt; {
  
  String urlLogin;
  private Context context;
  
  public LoginHmg(Context context){
      this.context = context;
  }
  
  ProgressDialog prg = new ProgressDialog(context);   
  @Override
  protected String doInBackground(String... params) { 
  
      urlLogin ="xxx"
      WebServiceT wLoginApp = new WebServiceT();
      return wLoginApp.getMethod(urlLogin);
  }   
  
  @Override
  protected void onPreExecute() {     
      super.onPreExecute();       
      prg.show();
      prg.setMessage("Loading...");
      prg.setCancelable(false);       
  }
  }
  </code></pre>