网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
04月26日漏签0天
android开发吧 关注:225,819贴子:948,837
  • 看贴

  • 图片

  • 吧主推荐

  • 视频

  • 游戏

  • 0回复贴,共1页
<<返回android开发吧
>0< 加载中...

pendingBroadcast 传参问题【求助】

  • 只看楼主
  • 收藏

  • 回复
  • SYULEN
  • 初一年级
    10
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
直接上代码
private PendingIntent RegisterReceiver_Delivered(int index, final String Id) {
String Action = getString(R.string.Delivered_Sms_Action);
Intent sendIntent = new Intent(Action);tent.putExtra("Id", Id);
sendIntent.putExtra("Index", index);
PendingIntent pendingIntent = PendingIntent.getBroadcast(MyService.this, times++, sendIntent, PendingIntent.FLAG_UPDATE_CURRENT);
MyService.this.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
String Id = bundle.getString("Id");
int index = bundle.getInt("Index");
}
}, new IntentFilter(Action));
return pendingIntent;
}
ArrayList<PendingIntent> SentInts = new ArrayList<>();
ArrayList<PendingIntent> Delivereds = new ArrayList<>();
for (int i = 0; i < dvideSms.size(); ++i) {
SentInts.add(RegisterReceiver_SendSms(CurrIndex, Id));
Delivereds.add(RegisterReceiver_Delivered(CurrIndex, Id));
}
smsManager.sendMultipartTextMessage(PhoneNumber, null, dvideSms, SentInts, Delivereds);
监听 送达 (Delivereds) 的广播里 参数 Index Id 却一直是第一次传入的参数
百度了许多都说 是requstCode需要传不同值
但是我确定 requstDode 每次传入值都不一样 为什么还是如此呢


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 0回复贴,共1页
<<返回android开发吧
分享到:
©2026 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示