Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

call function after specific time java android

Runnable mToastRunnable;
Handler mHandler = new Handler();



  //create runnable for delay
       mToastRunnable = new Runnable() {
            @Override
            public void run() {
                Toast.makeText(MainActivity.this, "This is a delayed toast", Toast.LENGTH_SHORT).show();
                mHandler.postDelayed(this, 3000000);
                getlocation();
            }
        };
//start
 mToastRunnable.run();

//stop
 mHandler.removeCallbacks(mToastRunnable);
 
PREVIOUS NEXT
Tagged: #call #function #specific #time #java #android
ADD COMMENT
Topic
Name
1+6 =