We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
private final Handler mHandler = new Handler(Looper.getMainLooper()) { @OverRide public void handleMessage(Message msg) { switch (msg.what) { case APPLE_INFO: Apple apple = (Apple) msg.obj; //观察者模式,通知所有客户端 final int clientNum = mCallbacks.beginBroadcast(); for (int i = 0; i < clientNum; i++) { IRemoteServiceCallBack callBack = mCallbacks.getBroadcastItem(i); if (callBack != null && apple != null) { try { callBack.noticeAppleInfo(apple); } catch (RemoteException e) { e.printStackTrace(); } } mCallbacks.finishBroadcast(); } break; } super.handleMessage(msg); } mCallbacks.finishBroadcast();应该放到for循环后面,不然通知一个就结束了
The text was updated successfully, but these errors were encountered:
No branches or pull requests
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
@OverRide
public void handleMessage(Message msg) {
switch (msg.what) {
case APPLE_INFO:
Apple apple = (Apple) msg.obj;
//观察者模式,通知所有客户端
final int clientNum = mCallbacks.beginBroadcast();
for (int i = 0; i < clientNum; i++) {
IRemoteServiceCallBack callBack = mCallbacks.getBroadcastItem(i);
if (callBack != null && apple != null) {
try {
callBack.noticeAppleInfo(apple);
} catch (RemoteException e) {
e.printStackTrace();
}
}
mCallbacks.finishBroadcast();
}
break;
}
super.handleMessage(msg);
}
mCallbacks.finishBroadcast();应该放到for循环后面,不然通知一个就结束了
The text was updated successfully, but these errors were encountered: