I am sending you a link. I hope that, following link will help you. Here you will get lot of example with running mode.
If you have any problem then send me detail and explain deeply. Please send me source code after that i will implement according to your requirement.