'Cannot resolve symbol "postDelayed"

I have an error: Cannot resolve symbol "postDelayed". In:

handler.postDelayed(updateCurrentTime, 500);

This is some of my code:

package com.example.hubert.myapplication;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

public class ClickActivity extends AppCompatActivity {
    Handler handler = new Handler();

    Runnable updateCurrentTime = new Runnable() {
        @Override
        public void run() {
            money = money + 100;
            handler.postDelayed(this, 1000);
        }
    };
    handler.postDelayed(updateCurrentTime, 500);
(...)
}

I read other similar questions and none of the answers are working for me.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source