Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bug #2

Open
Open
bug #2
@xieguangwei

Description

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循环后面,不然通知一个就结束了

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /