編輯:關於android開發
在客戶端代碼如下。
public class MainActivity extends Activity { private IAidlCall mIAidlCall; private IBinder.DeathRecipient mDeathRecipient = new IBinder.DeathRecipient() { @Override public void binderDied() { // TODO Auto-generated method stub if (mIAidlCall == null) return; mIAidlCall.asBinder().unlinkToDeath(mDeathRecipient, 0); mIAidlCall = null; // TODO:重新綁定遠程服務
bindService(new Intent("demo.action.aidl.IAidlCall").
setPackage("com.example.severdemo"), conn, BIND_AUTO_CREATE);
} }; private ServiceConnection conn = new ServiceConnection() { @Override public void onServiceDisconnected(ComponentName name) { } @Override public void onServiceConnected(ComponentName name, IBinder service) { mIAidlCall = IAidlCall.Stub.asInterface(service); try { service.linkToDeath(mDeathRecipient, 0); Toast.makeText(getApplicationContext(), mIAidlCall.getName(), Toast.LENGTH_LONG).show(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // "demo.action.aidl.IAidlCall" 是遠程服務的action bindService(new Intent("demo.action.aidl.IAidlCall")
.setPackage("com.example.severdemo"), conn, BIND_AUTO_CREATE);
} }
引用:http://blog.csdn.net/chan1116/article/details/49930539
android開發環境以及genymotion虛擬機配合HBuilder測試(自總結),genymotionhbuilder一、安裝android-studio http
QQ好友列表向左滑動出現置頂、刪除--第三方開源--SwipeMenuListView,swipemenulistview SwipeMenuListView是在gith
自定義View等待旋轉,自定義view等待效果圖 1 string.xml <string name=default_progressbar>D
我們為什麼要在Android中使用RxJava 感覺RxJava最近風生水起,不學習一下都不好意思了,灑家也是初學RxJava,也是感覺代碼好像更復雜更難懂了,看了一
利用bintray-release插件上傳到Bintray- HTTP/