Sub Process_Globals
End Sub
Sub Globals
Dim Label1 As Label
End Sub
Sub Activity_Create (FirstTime As Boolean)
Activity.Color = Colors.White
Label1.Initialize ("")
Activity.AddView (Label1, 5%x, 5%y, 90%x, 40dip)
Label1.Color = Colors.Red
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod ("SetTouchListener", Array (Label1))
End Sub
Sub Label_onTouch (x As Float, y As Float)
Log ("x = " & x & " y = " & y)
End Sub
#If Java
import android.view.View;
import android.view.MotionEvent;
public void SetTouchListener (View myView)
{
myView.setOnTouchListener
(
new View.OnTouchListener ()
{
@Override
public boolean onTouch (View v, MotionEvent event)
{
if (activityBA.subExists ("label_ontouch"))
{
activityBA.raiseEvent (activityBA, "label_ontouch", event.getX (), event.getY ());
}
return false;
}
}
);
}
#End If