I have a BroadcastReceiver which receives broadcast sent to a Fragment. I'm getting the broadcast but how can I call a method from the Fragment itself? I basically need to update a List once the broadcast arrives, the List & update method are part of the Fragment.
public class FragmentReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if(action != null && action.equals("AllTasksFragmentUpdate"))
{
//
}
}
}
Registering the receiver:
@Override
public void onCreate(final Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
getActivity().registerReceiver(new FragmentReceiver(), new IntentFilter("AllTasksFragmentUpdate"));
}
How can I call the method from the Fragment?