Then practice keeping your phone in your pocket for increasingly long periods of time. You may need to build up to this and to develop some level of control.