title: How to wait execute method in Android
body: <p>I have one issue I wrote code like <code><pre>
  private class SomeClass extends AsyncTask {
      @Override
      protected void onPreExecute() {
              super.onPreExecute();
              pDialog = new ProgressDialog(CheckOutActivity.this);
              pDialog.setMessage(getText(R.string.wait));
              pDialog.setIndeterminate(false);
              pDialog.setCancelable(true);
              pDialog.show();
          }
      @Override
      protected Void doInBackground(Void... arg0) {
  //some code
  }
  @Override
          protected void onPostExecute(final Void unused) {
              if (pDialog.isShowing()) {
                  pDialog.dismiss();
              }
          }
  }
  </pre></code>
  I execute class like this
  <code><pre>
  new SomeClass().execute();
  Toast.makeText(getApplicationContext(), "msg msg", Toast.LENGTH_SHORT).show();
  </pre>
  </code>  Now My question is when .execute() start the code like not wait it means the Toast like execute before completion of SomeClass().execute(); Is there any Property for waiting this .execute() method.</p>
  
  <p><strong>EDIT:</strong> I assign some values to globle variable and after this execution I just want to compare this value. So I just put Toast message.  </p>