I'm new to android and have a problem with my simple application.
I using a very simple counter using AsyncTask.

When I run the app and start the counter, it counts to 10, and then instead of printing "DONE!" the app just crushes, I have no idea why. Here's my code.
(The activity has 3 buttons to create, start and cancel the task).

```
public class AsyncTaskActivity extends AppCompatActivity {

    AsyncTask myAsyncTask;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_async_task);
    }

    public static void startActivity(Context context){

        Intent intent = new Intent(context, AsyncTaskActivity.class);
        context.startActivity(intent);

    }

    public void createNewTask(View view) {

        TextView textView = findViewById(R.id.text_view_id);
        myAsyncTask = new MyAsyncTask(textView);
    }

    public void startTask(View view) {

        myAsyncTask.execute();
    }

    public void cancelTask(View view) {

        myAsyncTask.cancel(true);
    }

    private static class MyAsyncTask extends AsyncTask{

        private TextView textView;

        public MyAsyncTask(TextView textView){

            this.textView = textView;
        }

        @Override
        protected Object doInBackground(Object[] objects) {

            for(int counter = 0; counter <= 10; counter ++){

                if(!isCancelled()) {
                    textView.setText(String.valueOf(counter));
                    SystemClock.sleep(500);
                }
                else
                    break;
            }

            textView.setText("DONE!");
            return null;
        }
    }

```