import android.widget.ScrollView;
import android.widget.TabHost;
import android.widget.TabWidget;
+import android.widget.Toast;
public class Main extends Activity
{
/* Private data */
private Task task;
+ private Toast toast;
private boolean ready;
/* Widgets */
private ScrollView lscroll;
private ScrollView dscroll;
- /* Private methods */
- public void onRegister(Object obj)
+ /* Private handler methods */
+ private void onRegister(Object obj)
{
Os.debug("Main: onRegister");
this.task = (Task)obj;
}
- public void onMessage(Object obj)
+ private void onMessage(Object obj)
{
Message msg = (Message)obj;
}
}
+ private void onNotify(String text)
+ {
+ Os.debug("Main: onNotify - " + text);
+ this.toast.setText(text);
+ this.toast.show();
+ }
+
+ /* Private service methods */
private void startService()
{
Os.debug("Main: startService");
// Setup main layout
this.setContentView(R.layout.main);
+ // Setup toast
+ this.toast = Toast.makeText(this, "", Toast.LENGTH_SHORT);
+
// Setup communication
this.handler = new MainHandler();
this.messenger = new Messenger(this.handler);
case Task.DISCONNECT:
Main.this.ready = false;
break;
+ case Task.NOTIFY:
+ Main.this.onNotify((String)msg.obj);
+ break;
default:
Os.debug("Main: unknown message - " + msg.what);
break;