我有一个pojo类名联系
我打开新活动进行编辑
使用此
Intent iEditContact = new Intent(JsonParseActivity.this, EditContatctActivity.class);
iEditContact.putExtra(Constant.intent_key_edit_contact, contact);
startActivityForResult(iEditContact, Constant.edt_contect_request_code);
我使用此
收到了该联系人if (iContact != null && iContact.hasExtra(Constant.intent_key_edit_contact)) {
contact = iContact.getParcelableExtra(Constant.intent_key_edit_contact);
在我更新其名称和号码以及其他详细信息之后...我想再次发送pojo到我的主要活动并刷新recyclerview
如何在OnActivityResult()的帮助下如何在不创建新活动的情况下执行此操作
以及如何在我的mainactivtiy中再次检索该列表
答案 0 :(得分:1)
如何在我的mainactivtiy中再次检索该列表?
好吧,您可以使用 BroadcastReceiver 将其接收回第一个活动,看看..
在 1st Activity
中制作 BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Contact contact;
if(intent.getExtras()!=null) {
contact = intent.getParcelableExtra(Constant.intent_key_edit_contact);
}
};
onResume
并在@Override
public void onResume() {
super.onResume();
LocalBroadcastManager.getInstance(context).registerReceiver(broadcastReceiver,new IntentFilter("receive_contact"));
}
注册接收器!!
modification
在contact object
Intent intent = new Intent("receive_contact");
intent.putExtra(Constant.intent_key_edit_contact, contact);
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
之后第二个活动
`Sub Macro1()
'
' Macro1 Macro
'
'
Range("F6:F14").Select
Selection.FormatConditions.AddDatabar
Selection.FormatConditions(Selection.FormatConditions.Count).ShowValue = True
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1)
.MinPoint.Modify newtype:=xlConditionValueAutomaticMin
.MaxPoint.Modify newtype:=xlConditionValueAutomaticMax
End With
With Selection.FormatConditions(1).BarColor
.Color = 2668287
.TintAndShade = 0
End With
Selection.FormatConditions(1).BarFillType = xlDataBarFillSolid
Selection.FormatConditions(1).Direction = xlContext
Selection.FormatConditions(1).NegativeBarFormat.ColorType = xlDataBarColor
Selection.FormatConditions(1).BarBorder.Type = xlDataBarBorderNone
Selection.FormatConditions(1).AxisPosition = xlDataBarAxisAutomatic
With Selection.FormatConditions(1).AxisColor
.Color = 0
.TintAndShade = 0
End With
With Selection.FormatConditions(1).NegativeBarFormat.Color
.Color = 255
.TintAndShade = 0
End With
Range("H11").Select
End Sub`