signal Int via OS Message - Android Android OS

Android examples for Android OS:Message

Description

signal Int via OS Message

Demo Code


//package com.java2s;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

public class Main {
    public static void signalInt(Handler handler, String key, int i) {
        if (handler != null && key != null && !key.equals("")) {
            Message msg = handler.obtainMessage();
            Bundle b = new Bundle();
            b.putInt(key, i);/*from w  ww. j a  va  2s  . co m*/
            msg.setData(b);
            handler.sendMessage(msg);
        }
    }
}

Related Tutorials