Come on, admit it. We've all done it. Maybe you've just received a shiny new Android device that you're eager to use. Perhaps you've decided to give the world of custom ROMs a try or are jumping from ROM to ROM in a flashing frenzy. Maybe you were unlucky enough to be forced into a factory reset. In any case, at some point in the process, it's a good idea to set up a lock code of some sort. Pin, pattern, password, whatever you put in place, it's probably a good idea to remember it right? If you forget it, however, don't panic! Android has a built-in method to get you back up and running. Samsung phones have an additional method, if you have a Samsung account.
On any Android, entering incorrect lock screen credentials a certain number of times will make it lock you out for a specified period, normally twenty or thirty seconds. During this time, you can't attempt to enter credentials. Repeat this snafu twenty times, however, and the device will ask you for your Google sign in rather than simply locking you out again. Enter in your details as you would if logging on for the first time, then get into your Gmail inbox on another device. There should be a confirmation email in there from Google, telling you about the lock screen mishap. Confirm that the encounter was your doing and you'll be able to reset your password. You don't have an infinite number of resets to your name, however, so be wise about choosing a login in the second time around.
For Samsung devices, if using Google fails for whatever reason, you can still get into your device using Samsung's "Find My Mobile" tool, if you've created a Samsung Account. Log into it via the official website and you'll find a button that says "Unlock my Device". As long as the device is on and has either wi-fi or cellular data, you'll get a popup on the website. Click OK on that and your device will unlock. From there, you're free to create a new passcode that you'll actually remember. As far as this writer is aware, there is no limit to the number of times you can use this function.