Tylko oryginalny wątek, który utworzył hierarchię widoku, może dotykać jego widoków

Próbuję uzyskać animację ImageView między 2 obrazami w moim folderze do rysowania.

Myślałem, że wszystko będzie dobrze, ale dziennik pokazuje błąd:Only the original thread that created a view hierarchy can touch its views.

Oto mój kod:

public class ExerciseActivity extends Activity {
    private ExercisesDataSource datasource;
    private Cursor cursor;
    private ImageView image_1_view;
    private Timer _timer;
    private int _index;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_exercise);     

        datasource = new ExercisesDataSource(this);
        datasource.open();

        cursor = datasource.fetchExercise(exerciseDataID);

        image_1_view = (ImageView) findViewById(R.id.exercise_image);

        _index = 1;
        _timer = new Timer();
        _timer.schedule(new TickClass(), 1000);

    }

    public class TickClass extends TimerTask
    {
        private int columnIndex;

        @Override
        public void run() {
            if (_index == 1) {
                columnIndex = cursor.getColumnIndex(MySQLiteHelper.COLUMN_IMAGE_1);
                _index = 2;
            }
            else {
                columnIndex = cursor.getColumnIndex(MySQLiteHelper.COLUMN_IMAGE_2);
                _index = 1; 
            }   

            String image_1 = cursor.getString(columnIndex);
            image_1 = image_1.replace(".png", "");
            int resourceId = getResources().getIdentifier(getPackageName() + ":drawable/" + image_1, null, null);
            image_1_view.setImageDrawable(getResources().getDrawable(resourceId));
        }
    }
}

Poszedłem dalej, ustawiłem klasy i funkcje na publiczne, ale to nie naprawiło.

Wszystkie zasoby i wszystko jest w porządku, jak mogę naprawić ten błąd?

questionAnswers(2)

yourAnswerToTheQuestion