title: Leaked window com.internal.policy.impl.PhoneWindow$DecorView
body: <p>I've dont know where's the error is...<br>
  I've try to debug it but error keeps coming and coming.</p>
  
  <pre><code> public class ActivityOwner extends Activity implements OnClickListener {
  
          private ProgressDialog progressDialog;
          private Button btnLogin;
          private EditText username, password;
          private TextView tvLinkToRegister;
  
          JSONParser jsonParser = new JSONParser(); //---JSON parser class
  
          //---Testing on android device:
          private static final String OWNER_LOGIN_URL = "http://192.168.2.5/idot/owner_login.php";
  
          //---Testing on Emulator:
          //private static final String REGISTER_URL = "http://10.0.2.2:1234/idot/register.php";
          //---Testing from a real server:
          //Private static final String REGISTER_URL = "http://domain name/sub folder/register.php";
  
          private static final String TAG_SUCCESS = "success";
          private static final String TAG_MESSAGE = "message";
  
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_owner);
  
              username = (EditText) findViewById(R.id.etOwnerUsername);
              password = (EditText) findViewById(R.id.etOwnerPassword);
  
              tvLinkToRegister = (TextView) findViewById(R.id.link_to_register);
              btnLogin = (Button) findViewById(R.id.btnOwnerLogin);
  
              tvLinkToRegister.setOnClickListener(new View.OnClickListener() {
  
                  @Override
                  public void onClick(View view) {
                      // TODO Auto-generated method stub
     Intent registrationForm = new Intent(ActivityOwner.this, ActivityOwnerRegister.class);
                      startActivity(registrationForm);
                  }
              });
  
              btnLogin.setOnClickListener(this);
          }
  
          @Override
          public void onClick(View v) {
              new AttemptLogin().execute();
          }
  
          class AttemptLogin extends AsyncTask&lt;String, String, String&gt; {
  
              @Override
              protected void onPreExecute() {
                  super.onPreExecute();
                  progressDialog = new ProgressDialog(ActivityOwner.this);
                  progressDialog.setMessage("Attempting login...");
                  progressDialog.setIndeterminate(false);
                  progressDialog.setCancelable(true);
                  progressDialog.show();
              }
  
              @Override
              protected String doInBackground(String... args) {
                  // TODO Auto-generated method stub
                  // Check for success tag
                  int success;
                  String stringUsername = username.getText().toString();
                  String stringPassword = password.getText().toString();
                  try {
                      // Building Parameters
                      List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
                      params.add(new BasicNameValuePair("owner_username", stringUsername));
                      params.add(new BasicNameValuePair("owner_password", stringPassword));
  
                      Log.d("request!", "starting");
                      // getting product details by making HTTP request
                      JSONObject json = jsonParser.makeHttpRequest(OWNER_LOGIN_URL, "POST", params);
  
                      // check your log for json response
                      Log.d("Login attempt", json.toString());
  
                      // json success tag
                      success = json.getInt(TAG_SUCCESS);
                      if (success == 1) {
                          Log.d("Login Successful!", json.toString());
                          // save user data
                          SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(ActivityOwner.this);
                          Editor edit = sp.edit();
                          edit.putString("owner_username", stringUsername);
                          edit.commit();
  
                          Intent i = new Intent(ActivityOwner.this, ActivityOwnerSuccessLogin.class);
                          //progressDialog.dismiss();
                          finish();
                          startActivity(i);
  
                          return json.getString(TAG_MESSAGE);
  
                      } else {
                          Log.d("Login Failure!", json.getString(TAG_MESSAGE));
                          return json.getString(TAG_MESSAGE);
                      }
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
  
                  return null;
  
              }
  
              @Override
              protected void onPostExecute(String file_url) {
                  // dismiss the dialog once product deleted
                  progressDialog.dismiss();
                  if (file_url != null) {
                      Toast.makeText(ActivityOwner.this, file_url, Toast.LENGTH_LONG).show();
                  }
  
              }
  
          }
  </code></pre>
  
  <p>-LOGCAT-------</p>
  
  <pre><code>11-14 14:37:14.460: E/WindowManager(11609): Activity ph.idot.sp.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4101cf78 that was originally added here
  11-14 14:37:14.460: E/WindowManager(11609): android.view.WindowLeaked: Activity ph.idot.sp.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4101cf78 that was originally added here
  11-14 14:37:14.460: E/WindowManager(11609):     at android.view.ViewRootImpl.&lt;init&gt;(ViewRootImpl.java:349)
  11-14 14:37:14.460: E/WindowManager(11609):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:267)
  11-14 14:37:14.460: E/WindowManager(11609):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215)
  11-14 14:37:14.460: E/WindowManager(11609):     at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:140)
  11-14 14:37:14.460: E/WindowManager(11609):     at android.view.Window$LocalWindowManager.addView(Window.java:537)
  11-14 14:37:14.460: E/WindowManager(11609):     at android.app.Dialog.show(Dialog.java:285)
  11-14 14:37:14.460: E/WindowManager(11609):     at ph.idot.owner.ActivityOwner$AttemptLogin.onPreExecute(ActivityOwner.java:88)
  11-14 14:37:14.460: E/WindowManager(11609):     at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:561)
  11-14 14:37:14.460: E/WindowManager(11609):     at android.os.AsyncTask.execute(AsyncTask.java:511)
  11-14 14:37:14.460: E/WindowManager(11609):     at ph.idot.owner.ActivityOwner.onClick(ActivityOwner.java:76)
  11-14 14:37:14.460: E/WindowManager(11609):     at android.view.View.performClick(View.java:3511)
  11-14 14:37:14.460: E/WindowManager(11609):     at android.view.View$PerformClick.run(View.java:14109)
  11-14 14:37:14.460: E/WindowManager(11609):     at android.os.Handler.handleCallback(Handler.java:605)
  11-14 14:37:14.460: E/WindowManager(11609):     at android.os.Handler.dispatchMessage(Handler.java:92)
  11-14 14:37:14.460: E/WindowManager(11609):     at android.os.Looper.loop(Looper.java:137)
  11-14 14:37:14.460: E/WindowManager(11609):     at android.app.ActivityThread.main(ActivityThread.java:4424)
  11-14 14:37:14.460: E/WindowManager(11609):     at java.lang.reflect.Method.invokeNative(Native Method)
  11-14 14:37:14.460: E/WindowManager(11609):     at java.lang.reflect.Method.invoke(Method.java:511)
  11-14 14:37:14.460: E/WindowManager(11609):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
  11-14 14:37:14.460: E/WindowManager(11609):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
  11-14 14:37:14.460: E/WindowManager(11609):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>What's the problem here? Help me please.</p>