[Solved] java android app execute every 10 seconds [closed]


A timer task will not work, as it will create a different thread and only originating thread may touch its views.

For android the preferred way to do this is to use a handler. Ether by

textMsg.post( new Runnable(){

     public void run(){
            doProcessing();
            testMesg.setText("bla");
            testMsg.postDelayed(this,(1000*10));
     }
};

or having a seperate instance of the Handler class

Handler mHanlder = new Handler();
mHandler.post(runnable);

solved java android app execute every 10 seconds [closed]