Listing 118 srccomcookbookadvancerpcrpcServicejava

package com.cookbook.advance.rpc;

import; import android.content.Intent; import android.os.IBinder; import android.os.RemoteException;

public class RPCService extends Service {

IAdditionService.Stub mBinder;

@Override public void onCreate() { super.onCreate();

mBinder = new IAdditionService.Stub() {

public int factorial(int valuel) throws RemoteException { int result=1;

return result;

^Override public IBinder onBind(Intent intent) { return mBinder;

^Override public void onDestroy() { super.onDestroy();

Now the second activity that runs in a different process must be specified.The associated layout file is shown in Listing 11.9. Inside the layout, it has three views that actually serve the main roles. EditText takes the input from the user, the Button triggers the factorial() function call, and the Textview with ID result is used for displaying the result from factorial.

Character Building Thought Power

Character Building Thought Power

Character-Building Thought Power by Ralph Waldo Trine. Ralph draws a distinct line between bad and good habits. In this book, every effort is made by the writer to explain what comprises good habits and why every one needs it early in life. It draws the conclusion that habits nurtured in early life concretize into impulses in future for the good or bad of the subject.

Get My Free Ebook

Post a comment