package com.gigglingcorpse.test.haxejavatoast; import android.os.Bundle; import android.app.Activity; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.Toast; import android.widget.EditText; class MyActivity extends Activity { public var btnToast:Button; public var editBox:EditText; override public function onCreate( state:Bundle ) { super.onCreate(state); haxe.Log.trace = function(msg:Dynamic, ?pos:haxe.PosInfos) { android.util.Log.i( "trace", pos.className + "@" + pos.lineNumber + ": " + msg) ; } trace("starting android haxe-java toast"); setContentView(r.Layout.main); btnToast = cast( findViewById(r.Id.btnToast), Button ); editBox = cast( findViewById(r.Id.message), EditText ); } public function sendToast( view:View ) { var s:String = editBox.getText().toString(); if ( s.length == 0 ) s = "You've typed nothing!"; var t = Toast.makeText( this, s, Toast.LENGTH_LONG); t.show(); } }