hasancse1991

DateChangeListener

Jul 10th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. public class DateChangeBroadcastListener extends BroadcastReceiver {
  2.  
  3.     @Override
  4.     public void onReceive(Context context, Intent intent) {
  5.         final String action = intent.getAction();
  6.  
  7.         if (action != null && (action.equals(Intent.ACTION_DATE_CHANGED)
  8.                 || action.equals(Intent.ACTION_TIME_CHANGED))) {
  9.             Toast.makeText(context, "Date changed", Toast.LENGTH_SHORT).show();
  10.         }
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment