服务端怎样暴露IBinder接口对象:
package com.example.mydownload; import android.app.Service; import android.content.Intent; import android.os.Binder; import android.os.IBinder; import android.util.Log; //实现接口中的方法 public class MyService extends Service { //接口对象 IBinder mybBinder = new MyBinder(); class MyBinder extends Binder{ public String helloWorld(String name){ return name; } } @Override public void onCreate() { Log.e("log", "onCreate"); super.onCreate(); } @Override public void onDestroy() { Log.e("log", "onDestroy"); super.onDestroy(); } @Override public int onStartCommand(Intent intent, int flags, int startId) { Log.e("log", "onStartCommand"); return super.onStartCommand(intent, flags, startId); } @Override public IBinder onBind(Intent arg0) { return mybBinder; } }
client怎样调用接口对象中的方法,晚上再写。