четверг, 9 мая 2013 г.

periodic task on ruboto

For create periodic task on android by ruboto require create handler and assign task with delay in milliseconds (handl.postDelayed(method_for_eecution, 1000)).
And each time when finished  task - assing new(second line in method test_meth)

def onCreate(bundle)
  ....
  handler = Java::android.os.Handler.new
  test_meth(handler)
end

def test_meth(handl)
    toast "test #{Time.now}"
     handl.postDelayed(test_meth(handl), 1000)
end


 And more clear then java code wich was before.


Комментариев нет: