我认为当至少注册一个接收器时它返回true,如果没有注册接收器则返回false.它是否正确?
关于这个缺失的文档有一个未解决的问题:Issue 59626
解决方法 是的,它检查可用的接收器,如果没有找到则返回false:从method
219 ArrayList<ReceiverRecord> receivers = null;220 for (int i=0; i<entrIEs.size(); i++) {221 ReceiverRecord receiver = entrIEs.get(i);222 if (deBUG) Log.v(TAG,"Matching against filter " + receiver.filter);223224 if (receiver.broadcasting) {225 if (deBUG) {226 Log.v(TAG," Filter's target already added");227 }228 continue;229 }230231 int match = receiver.filter.match(action,type,scheme,data,232 categorIEs,"LocalbroadcastManager");233 if (match >= 0) {234 if (deBUG) Log.v(TAG," Filter matched! match=0x" +235 Integer.toHexString(match));236 if (receivers == null) {237 receivers = new ArrayList<ReceiverRecord>();238 }239 receivers.add(receiver);240 receiver.broadcasting = true;241 } else {242 if (deBUG) {243 String reason;244 switch (match) {245 case IntentFilter.NO_MATCH_ACTION: reason = "action"; break;246 case IntentFilter.NO_MATCH_category: reason = "category"; break;247 case IntentFilter.NO_MATCH_DATA: reason = "data"; break;248 case IntentFilter.NO_MATCH_TYPE: reason = "type"; break;249 default: reason = "unkNown reason"; break;250 }251 Log.v(TAG," Filter dID not match: " + reason);252 }253 }254 }255256 if (receivers != null) {257 for (int i=0; i<receivers.size(); i++) {258 receivers.get(i).broadcasting = false;259 }260 mPendingbroadcasts.add(new broadcastRecord(intent,receivers));261 if (!mHandler.hasMessages(MSG_EXEC_PENDING_broADCASTS)) {262 mHandler.sendEmptyMessage(MSG_EXEC_PENDING_broADCASTS);263 }264 return true;265 }266 }267 }268 return false;总结
以上是内存溢出为你收集整理的android – 类LocalBroadcastManager的sendBroadcast方法返回什么?全部内容,希望文章能够帮你解决android – 类LocalBroadcastManager的sendBroadcast方法返回什么?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)