Code example for Handler

    UpdateLockService(Context context) {
        mContext = context;
        mLocks = new LockWatcher(new Handler(), "UpdateLocks");
        // Consider just-booting to be a reasonable time to allow 
        // interruptions for update installation etc. 
    void sendLockChangedBroadcast(boolean state) {
        // Safe early during boot because this broadcast only goes to registered receivers. 
        long oldIdent = Binder.clearCallingIdentity();
        try { 
            Intent intent = new Intent(UpdateLock.UPDATE_LOCK_CHANGED)
                    .putExtra(UpdateLock.NOW_IS_CONVENIENT, state)
                    .putExtra(UpdateLock.TIMESTAMP, System.currentTimeMillis())
Stop searching for code, let great code find you!  Add Codota to your java IDE