How do I pass data from a BroadcastReceiver through to an Activity being started?

前端 未结 5 555
我寻月下人不归
我寻月下人不归 2020-12-02 23:56

I\'ve got an Android application which needs to be woken up sporadically throughout the day.

To do this, I\'m using the AlarmManager to set up a PendingIntent and ha

5条回答
  •  春和景丽
    2020-12-03 00:41

    Set flag SingleTop works (don't mix with other flags)

    Intent intent = new Intent(ContextManager.getContext(),OrderList.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    Bundle bundle = new Bundle();       
    
    bundle.putString("username",username);
    bundle.putString("password",password);
    
    intent.putExtras(bundle);
    startActivityForResult(intent,0); 
    

提交回复
热议问题