0

I am a novice programmer on android studio, I want to know why does the delay function does an error on handler.postDelayed (new Runnable(){ do I have to import any library? and what is the shortcut key for :@override..." whenever I does a code. thanks.

heres the code:

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Handler handler = new Handler();
    handler.postDelayed (new Runnable(){
        @.
        public void run() {
             msg();

        }
    },500);

}
Dennis Kriechel
  • 3,719
  • 14
  • 40
  • 62

1 Answers1

0

sry i write it as an answer cause i cant post comments yet but can you post the exact error? i'm pretty sure you should write

public class MainActivity extends AppCompatActivity {

like this :

public class MainActivity extends AppCompatActivity implements runnable {

but thats just an educated guess since I dont know whats the exact error you are getting.

Daniel Netzer
  • 2,151
  • 14
  • 22