WEB开发网
开发学院手机开发Android 开发 Android AIDL必看内容 阅读

Android AIDL必看内容

 2010-05-27 03:49:00 来源:WEB开发网   
核心提示:Toast.makeText(RemoteServiceBinding.this, R.string.remote_service_connected,Toast.LENGTH_SHORT).show();}public void onServiceDisconnected(ComponentName classNam

Toast.makeText(RemoteServiceBinding.this, R.string.remote_service_connected,

Toast.LENGTH_SHORT).show();

}

public void onServiceDisconnected(ComponentName className) {

// This is called when the connection with the service has been

// unexpectedly disconnected -- that is, its process crashed.

mService = null;

mKillButton.setEnabled(false);

mCallbackText.setText("Disconnected.");

// As part of the sample, tell the user what happened.

Toast.makeText(RemoteServiceBinding.this, R.string.remote_service_disconnected,

Toast.LENGTH_SHORT).show();

}

};

/**

* Class for interacting with the secondary interface of the service.

*/

private ServiceConnection mSecondaryConnection = new ServiceConnection() {

public void onServiceConnected(ComponentName className,

IBinder service) {

// Connecting to a secondary interface is the same as any

// other interface.

mSecondaryService = ISecondary.Stub.asInterface(service);

mKillButton.setEnabled(true);

}

public void onServiceDisconnected(ComponentName className) {

mSecondaryService = null;

mKillButton.setEnabled(false);

}

};

private OnClickListener mBindListener = new OnClickListener() {

public void onClick(View v) {

// Establish a couple connections with the service, binding

// by interface names. This allows other applications to be

// installed that replace the remote service by implementing

// the same interface.

bindService(new Intent(IRemoteService.class.getName()),

mConnection, Context.BIND_AUTO_CREATE);

bindService(new Intent(ISecondary.class.getName()),

mSecondaryConnection, Context.BIND_AUTO_CREATE);

上一页  1 2 3 4 5 6  下一页

Tags:Android AIDL

编辑录入:coldstar [复制链接] [打 印]
赞助商链接