AsyncTask already started onCreate <p>When I try to execute an AsyncTask from a button click, my app says the task is already started. I don't execute the task anywhere in onCreate or onResume or anything like that. Can a task be started when my activity is created without me executing it programatically? </p> <pre><code> // Login button Button loginButton = (Button) findViewById(R.id.loginBtn); loginButton.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { loginTask.execute(""); } }); // Background login thread private AsyncTask&lt;Object, String, String&gt; loginTask = new AsyncTask&lt;Object, String, String&gt;(){ @Override protected String doInBackground(Object... arg0) { Log.v(TAG, "Login task started"); LoginManager lm = new LoginManager(); String username = emailText.getText().toString(); String password = passwordText.getText().toString(); loginBundle = new Bundle(); loginBundle.putString(Constants.LOGIN_HANDLER_ID, lm.login(username, password)); loginMessage = Message.obtain(null, 0); loginMessage.setData(loginBundle); loginHandler.sendMessage(loginMessage); return ""; } }; </code></pre> <p>This is the only place I call execute, and it's a button that I'm creating in the onCreate() method. When the task is executed, I get a task already started error.</p> <p>I thought maybe I'm not cancelling the thread correctly, and so I rebooted my Motrola Xoom. I ran the app once the Xoom was started, and I still got this error. What can I do? The app is using Android SDK 8... and I'm running on a Motorola Xoom.</p>