title: how to call handler of fragment class from Broadcast receiver class to update main thread?
body: <p>I want to update myfragment thread by calling myfunction that implements handler.But I don't know how to access this handler from broadcast receiver class.Can anyone help me in this?</p>
  
  <p>Fragment Class Code:</p>
  
  <pre><code>    Calendar calendar= Calendar.getInstance();
      calendar.setTimeInMillis(System.currentTimeMillis());
      calendar.set(Calendar.HOUR_OF_DAY,16);
      calendar.set(Calendar.MINUTE,42);
      calendar.set(Calendar.SECOND,0);
      Intent intent =new Intent(getContext(),NotificationActivity.class);
      intent.putExtra("id",R.id.notification_imageView);
      PendingIntent pendingIntent =  
      PendingIntent.getBroadcast(getContext(),100,intent,PendingIntent.FLAG_UPDATE_CURRENT);
      AlarmManager alarmManager=(AlarmManager) getActivity().getSystemService(ALARM_SERVICE);
      System.out.println("DEBUG==&gt; Instantiating Alarm Manager Service");
      alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,calendar.getTimeInMillis(),1000 * 60 * 
      02,pendingIntent);
  </code></pre>
  
  <p>Implementing the handler to update ui(in fragment class)</p>
  
  <pre><code>       public void myfunction()
         {
          final Handler handler = new Handler();
          handler.postDelayed(new Runnable() {
              @Override
              public void run() {
                  ImageView img;
  
                  View view = View.inflate(context, R.layout.Sample, null);
                  img = view.findViewById(R.id.imageView);
  
  
                  Animation animation = new AlphaAnimation((float) 0.5, 0); 
                  animation.setDuration(500); // duration - half a second--2 minutes
                  animation.setRepeatCount(200);
                  img.startAnimation(animation);
  
                  handler.postDelayed(this, 100000);
              }
              }, 100000);
             }
  </code></pre>
  
  <p>BroadcastReceiever Class --ClassNotificationActivity.class</p>
  
  <pre><code>  public class NotificationActivity extends BroadcastReceiver {
    private View view;
    @Override
     public void onReceive(Context context, Intent intent) {
     ///How to call handler myfunction from here
        }
           }
  </code></pre>
  
  <p>Manifest.xml</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.SET_ALARM" /&gt;
  
   &lt;receiver  android:name=".view.ui.NotificationActivity" /&gt;
  </code></pre>