Code example for Handler

Methods: obtainMessagesendMessageDelayed

0
    } 
 
    public void onStart() { 
        super.onStart(); 
        setEnabled(false); 
        mHandler.sendMessageDelayed(mHandler.obtainMessage(0), 1000);
    } 
 
    public boolean dispatchKeyEvent(KeyEvent event) {
        if (mConsuming) {
            //Slog.i(TAG, "Consuming: " + event); 
            return true; 
        } 
        //Slog.i(TAG, "Dispatching: " + event); 
        return super.dispatchKeyEvent(event);
    } 
 
    private void setEnabled(boolean enabled) {
        Button b = (Button)findViewById(R.id.button1);
        if (b != null) {
            b.setEnabled(enabled);