Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.content.Intent; public class Main { static final String DISPLAY_MESSAGE_ACTION = "com.dhansiddh.chatmessenger.DISPLAY_MESSAGE"; static final String EXTRA_MESSAGE = "message"; static final String EXTRA_NUMBER = "number"; /** * Notifies UI to display a message. * <p> * This method is defined in the common helper because it's used both by * the UI and the background service. * * @param context application's context. * @param message message to be displayed. */ static void displayMessage(Context context, String message, String numb) { Intent intent = new Intent(DISPLAY_MESSAGE_ACTION); intent.putExtra(EXTRA_NUMBER, numb); intent.putExtra(EXTRA_MESSAGE, message); context.sendBroadcast(intent); } }