Android normally secures your device by demanding a PIN, pattern, or full password. Your phone isn’t useless if you forget the unlock code. According to http://www.howtogeek.com, you can bypass it and get back in as long as you remember your Google account’s username and its password.
Android 4.4 and below
Older versions of Android — Android 4.4 KitKat and older — have an integrated way to bypass your pattern, PIN, or other password if you forget it. Google removed this feature in Android 5.0 Lollipop, so you’ll have to use a different method if you have a device with a newer version of Android. To find this feature, first enter an incorrect pattern or PIN five times at the lock screen. “Forgot pattern,” “forgot PIN,” or “forgot password” button will appear. Tap it. You’ll be prompted to enter the username and password of the Google account associated with your Android device.
Android 5.0 and up
This feature was removed in Android 5.0. Unfortunately, this means there’s no built-in way to simply reset your pattern, PIN, or password and gain access to your phone or tablet. Android’s Smart Lock feature may be able to save you. For example, let’s say you’ve set up Smart Lock on your Android phone and have it automatically logged in when it’s on your home Wi-Fi. You can take your phone to that home Wi-FI network and it will automatically unlock for you, even if you can’t remember the normal unlock code. Read more