Skip to content

Instantly share code, notes, and snippets.

@amirrajan
Created November 23, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amirrajan/d253ad2d33c2ee4b01ea to your computer and use it in GitHub Desktop.
Save amirrajan/d253ad2d33c2ee4b01ea to your computer and use it in GitHub Desktop.
def class MainThreadRunnable < Runnable
def initialize(room_activity)
@room_activity = room_activity
end
def run
@room_activity.update_core
end
end
class MyTimerTask < Java::Util::TimerTask
def initialize(roomscreen, ctx)
@game = Game.new
@ctx = ctx
@handler = Handler.new(ctx.getMainLooper) #Handler mainHandler = new Handler(context.getMainLooper());
@roomscreen = roomscreen
end
def run
return if @timer_paused
game.tick
@handler.post(MainThreadRunnable.new(@roomscreen)) #mainHandler.post(myRunnable);
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment