1.in:
代碼:

Log.d(TAG, "onClick: "+String.valueOf(message.isSendSuccess()));
其實他在remoteService設定了isSendSuccess為true,但列印結果是false,即它在remoteService設定為true,但是沒有改變在MainActivity中的值

2.inout:
設定為inout

編譯的時候不通過,會爆紅,添加代碼:

//inout的時候添加
public void readFromParcel(Parcel parcel){
content=parcel.readString();
isSendSuccess=parcel.readByte()==1;
}
然后運行,連接,記得等待5秒,然后列印的值為true,即remoteService改變值,影響了MainActivity

3.out
out與in反過來
代碼直接修改為out即可

在remoteService中的列印結果為空

轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/211939.html
標籤:其他
