This article explains how to protect Android photo gallery with a secret code.
Steps
Part 1 of 2: Install AppLock

Step 1. Open the Play Store
It is located in the app drawer or on the home screen.
If you are using a Samsung Galaxy mobile or tablet, you can find the option to lock the gallery directly on the device

Step 2. Search for AppLock
It is a free application that allows you to block almost all Android apps. To find it, type applock in the search bar and tap the magnifying glass. A list of results will appear.

Step 3. Tap DoMobileLab AppLock in the search results
The page dedicated to the application will open.

Step 4. Tap Install

Step 5. Tap Accept
AppLock will be downloaded to your mobile or tablet. Once the download is complete, the AppLock icon will appear in the app drawer.
Part 2 of 2: Lock the Gallery

Step 1. Press the home button
It is the central button located at the bottom of the device and takes you back to the main screen.

Step 2. Open AppLock
It is located in the app drawer. The icon depicts a safe that contains various colored sheets.

Step 3. Enter an unlock pattern with your finger
Try to choose a sequence that is easy to remember but difficult for other people to guess.

Step 4. Repeat the sequence to confirm
Once the sequence has been selected, you can continue with the final step.

Step 5. Enter your email address

Step 6. Tap Save
The sequence will then be set.

Step 7. Tap OK
The main AppLock screen will appear, showing a list of the applications you can protect with the pattern.

Step 8. Tap the lock icon next to "Gallery"
This will block the gallery application. In the future, when you intend to access the photos, you will first need to enter the sequence you created.