android - How can I launch fragment in broadcast receiver -


how can use broadcast receiver start/lunch fragment example : if need start/luanch activity , can use intent :

public void onreceive(final context context, intent intent) {      this.context = context;     this.intent = intent;      try {         bundle bundle = intent.getextras();          int messageid = bundle.getint("id");          intent = new intent(context, getalarm.class);          intent.putextra("id",messageid);          intent.setflags(intent.flag_activity_new_task);         context.startactivity(intent);      } catch (exception e) {         toast.maketext(context, "there error ", toast.length_short)                 .show();         e.printstacktrace();     } } 

but don't know how fragment

you must luanch intent , putextera , sendactivity. can launch fragment activity.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -