signal String via Os Message - Android Android OS

Android examples for Android OS:Message

Description

signal String 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 signalStr(Handler handler, String key, String str) {
        if (handler != null && str != null && key != null
                && !key.equals("")) {
            Message msg = handler.obtainMessage();
            Bundle b = new Bundle();
            b.putString(key, str);//from  w  w w  .j a  v  a 2s.  c  o m
            msg.setData(b);
            handler.sendMessage(msg);
        }
    }
}

Related Tutorials