Android examples for android.os:Messenger
Use the provided Messenger to send a Message to a Handler in another process.
//package com.java2s; import android.os.Bundle; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; public class Main { /**//from w w w .j a v a2 s . c o m * The key used to store/retrieve a file's pathname from a Bundle. */ public static final String PATHNAME_KEY = "PATHNAME"; /** * Use the provided Messenger to send a Message to a Handler in * another process. * * The provided string, outputPath, should be put into a Bundle * and included with the sent Message. */ public static void sendPath(String outputPath, Messenger messenger) { Message msg = Message.obtain(); Bundle data = new Bundle(); data.putString(PATHNAME_KEY, outputPath); // Make the Bundle the "data" of the Message. msg.setData(data); try { // Send the Message back to the client Activity. messenger.send(msg); } catch (RemoteException e) { e.printStackTrace(); } } }