发送短信-待定意向/添加额外内容?
我正在使用我利用 onSaveInstanceState 来保存文本和微调器位置等值的代码
private void sendSms(String phoneNo, String message){
PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, MainScreen.class), 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNo, null, message, pi, null);
}
,这将在接收意图、导航离开活动等时保持保存和一致,
不确定我是否可以在待处理意图中添加额外内容,这样当它开始我的主要活动时,我就可以使用这些额外功能。因为不知何故,当待处理的意图通过时,我需要它恢复到调用意图之前的状态
i'm using the code
private void sendSms(String phoneNo, String message){
PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, MainScreen.class), 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNo, null, message, pi, null);
}
i have utilized the onSaveInstanceState to save values such as text and spinner position, which will keep things saved and consistent while receiving intents, navigating away from the activity, etc
not sure if i can put extras in the pending intent, so that when it starts my main activity, i can use those extras. because somehow, when the pending intent goes through, i need it to restore to the way it was before the intent was called
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以..但是您必须清除之前的待处理意图或在构建您的待处理意图时使用一次性标志..像这样
You can.. but you must clear the previous pending intent or use the one shot flag while constructing your pending intent.. like this