我直接new出來會不會出錯呢?
我直接在onServiceConnected方法里寫MyBindService Service=new MyBindService();行不行呢?
?? ???? public void onServiceConnected(ComponentName arg0, IBinder binder) {
?
?????????????? MyBindService Service=new MyBindService();
?? ??? ??? ?
?? ??? ?}
?? ?};
2016-11-04
試了一下,出錯是不會的。
但是這個方法是不行的,因為在onBind()方法中啟動的服務沒有傳回來,你只是new 了一個MyBindService的對象出來了而已,并沒有執行onBind()方法,新new的服務相當于沒啟動。