forked from ruboto/ruboto
-
Notifications
You must be signed in to change notification settings - Fork 0
Class oriented component definition
donv edited this page Jul 3, 2012
·
4 revisions
This page seeks to define the API for defining Activities, Services, BroadcastReceivers and other callback objects using concepts that are as close as possible to the Java way of doing it. We will do this without regarding implementation limitations in the first phase. That will come later.
require 'ruboto/activity'
class MyActivity
include Ruboto::Activity
def on_create
...
end
def on_resume
...
end
...
endThe activity can be started from the declaration in the AndroidManifest using Intent or by starting it programmatically:
require 'ruboto/activity'
require 'my_activity'
start_ruboto_activity(MyActivity.new)require 'ruboto/service'
class MyService
include Ruboto::Service
def on_create
...
end
def on_start_command
...
end
...
endrequire 'ruboto/broadcast_receiver'
class MyBroadcastReceiver
include Ruboto::BroadcastReceiver
def on_create
...
end
def on_receive
...
end
...
endrequire 'ruboto/callback'
class MyCallBack
include Ruboto::Callback
callbacks_for android.opengl.GLSurfaceView.Renderer
def on_some_event
...
end
def on_some_other_event
...
end
...
end