You can manually lock the screen and keys to avoid press or tap by accident. You can still answer an incoming call and the keylock will lock again when the call is finished. The phone remains locked until you unlock it manually.
Depending on your phone model, you can activate the automatic keylock. When the automatic keylock is activated, the screen and key lock after a short period of inactivity.
Note: For some phones, you can still use external keys when the keypad is locked. If you wish to lock the external keys, you have to lock them separately.
To manually lock the keypad:

