send Intent Voice Broad Cast - Android Intent

Android examples for Intent:Broadcast

Description

send Intent Voice Broad Cast

Demo Code


import android.content.Context;
import android.content.Intent;

public class Main{
    /*from   w  ww. ja  va  2s  . c  o m*/
    public static void sendVoiceBroadCast(Context context, String content) {
        Intent intent = new Intent();
        intent.setAction(Constants.VOICE_RECOGNITION_RESULT_ACTION);
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.putExtra(Constants.VOICE_RECOGNITION_RESULT_KEY, content); //?String ???? 
        context.sendBroadcast(intent);
    }
    
    public static void sendBroadCast(Context context, String action,
            String key, String value) {
        Intent intent = new Intent();
        intent.setAction(action);
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.putExtra(key, value); //?key,value????
        context.sendBroadcast(intent);
    }
    public static void sendBroadCast(Context context, String action,
            String key, int value) {
        Intent intent = new Intent();
        intent.setAction(action);
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.putExtra(key, value);
        context.sendBroadcast(intent);
    }
}

Related Tutorials