本文整理了Java中android.content.BroadcastReceiver.setPendingResult()
方法的一些代码示例,展示了BroadcastReceiver.setPendingResult()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BroadcastReceiver.setPendingResult()
方法的具体详情如下:
包路径:android.content.BroadcastReceiver
类名称:BroadcastReceiver
方法名:setPendingResult
暂无
代码示例来源:origin: robolectric/robolectric
private Intent processStickyIntents(
IntentFilter filter, BroadcastReceiver receiver, Context context) {
Intent result = null;
for (Intent stickyIntent : stickyIntents.values()) {
if (filter.matchAction(stickyIntent.getAction())) {
if (result == null) {
result = stickyIntent;
}
if (receiver != null) {
receiver.setPendingResult(ShadowBroadcastPendingResult.createSticky(stickyIntent));
receiver.onReceive(context, stickyIntent);
receiver.setPendingResult(null);
} else if (result != null) {
break;
}
}
}
return result;
}
代码示例来源:origin: robolectric/robolectric
@Override
public void run() {
receiver.setPendingResult(ShadowBroadcastPendingResult.create(0, null, null, false));
shReceiver.onReceive(context, broadcastIntent, abort);
}
});
代码示例来源:origin: robolectric/robolectric
@Override
public ListenableFuture<BroadcastResultHolder> apply(
BroadcastResultHolder broadcastResultHolder) throws Exception {
final BroadcastReceiver.PendingResult result =
ShadowBroadcastPendingResult.create(
broadcastResultHolder.resultCode,
broadcastResultHolder.resultData,
broadcastResultHolder.resultExtras,
true /*ordered */);
wrapper.broadcastReceiver.setPendingResult(result);
scheduler.post(
() -> {
ShadowBroadcastReceiver shadowBroadcastReceiver =
Shadow.extract(wrapper.broadcastReceiver);
shadowBroadcastReceiver.onReceive(context, intent, abort);
});
return BroadcastResultHolder.transform(result);
}
},
代码示例来源:origin: org.robolectric/shadows-core
@Override
public ListenableFuture<BroadcastResultHolder> apply(BroadcastResultHolder broadcastResultHolder) throws Exception {
final BroadcastReceiver.PendingResult result = ShadowBroadcastPendingResult.create(
broadcastResultHolder.resultCode,
broadcastResultHolder.resultData,
broadcastResultHolder.resultExtras,
true /*ordered */);
wrapper.broadcastReceiver.setPendingResult(result);
scheduler.post(new Runnable() {
@Override
public void run() {
Shadows.shadowOf(wrapper.broadcastReceiver).onReceive(realApplication, intent, abort);
}
});
return BroadcastResultHolder.transform(result);
}
代码示例来源:origin: org.robolectric/shadows-core-v23
@Override
public ListenableFuture<BroadcastResultHolder> apply(BroadcastResultHolder broadcastResultHolder) throws Exception {
final BroadcastReceiver.PendingResult result = ShadowBroadcastPendingResult.create(
broadcastResultHolder.resultCode,
broadcastResultHolder.resultData,
broadcastResultHolder.resultExtras,
true /*ordered */);
wrapper.broadcastReceiver.setPendingResult(result);
scheduler.post(new Runnable() {
@Override
public void run() {
Shadows.shadowOf(wrapper.broadcastReceiver).onReceive(realApplication, intent, abort);
}
});
return BroadcastResultHolder.transform(result);
}
代码示例来源:origin: org.robolectric/framework
@Override
public ListenableFuture<BroadcastResultHolder> apply(BroadcastResultHolder broadcastResultHolder) throws Exception {
final BroadcastReceiver.PendingResult result = ShadowBroadcastPendingResult.create(
broadcastResultHolder.resultCode,
broadcastResultHolder.resultData,
broadcastResultHolder.resultExtras,
true /*ordered */);
wrapper.broadcastReceiver.setPendingResult(result);
scheduler.post(new Runnable() {
@Override
public void run() {
Shadows.shadowOf(wrapper.broadcastReceiver).onReceive(realApplication, intent, abort);
}
});
return BroadcastResultHolder.transform(result);
}
代码示例来源:origin: org.robolectric/shadows-framework
private Intent processStickyIntents(
IntentFilter filter, BroadcastReceiver receiver, Context context) {
Intent result = null;
for (Intent stickyIntent : stickyIntents.values()) {
if (filter.matchAction(stickyIntent.getAction())) {
if (result == null) {
result = stickyIntent;
}
if (receiver != null) {
receiver.setPendingResult(ShadowBroadcastPendingResult.createSticky(stickyIntent));
receiver.onReceive(context, stickyIntent);
receiver.setPendingResult(null);
} else if (result != null) {
break;
}
}
}
return result;
}
代码示例来源:origin: org.robolectric/shadows-core
@Override
public void run() {
receiver.setPendingResult(ShadowBroadcastPendingResult.create(0, null, null, false));
shReceiver.onReceive(realApplication, broadcastIntent, abort);
}
});
代码示例来源:origin: org.robolectric/shadows-core-v23
@Override
public void run() {
receiver.setPendingResult(ShadowBroadcastPendingResult.create(0, null, null, false));
shReceiver.onReceive(realApplication, broadcastIntent, abort);
}
});
代码示例来源:origin: org.robolectric/shadows-framework
@Override
public void run() {
receiver.setPendingResult(ShadowBroadcastPendingResult.create(0, null, null, false));
shReceiver.onReceive(context, broadcastIntent, abort);
}
});
代码示例来源:origin: org.robolectric/framework
@Override
public void run() {
receiver.setPendingResult(ShadowBroadcastPendingResult.create(0, null, null, false));
shReceiver.onReceive(realApplication, broadcastIntent, abort);
}
});
代码示例来源:origin: org.robolectric/shadows-framework
@Override
public ListenableFuture<BroadcastResultHolder> apply(
BroadcastResultHolder broadcastResultHolder) throws Exception {
final BroadcastReceiver.PendingResult result =
ShadowBroadcastPendingResult.create(
broadcastResultHolder.resultCode,
broadcastResultHolder.resultData,
broadcastResultHolder.resultExtras,
true /*ordered */);
wrapper.broadcastReceiver.setPendingResult(result);
scheduler.post(
() -> {
ShadowBroadcastReceiver shadowBroadcastReceiver =
Shadow.extract(wrapper.broadcastReceiver);
shadowBroadcastReceiver.onReceive(context, intent, abort);
});
return BroadcastResultHolder.transform(result);
}
},
内容来源于网络,如有侵权,请联系作者删除!