Now, this isn’t going to work on all phones but the Sixaxis Controller Android app allows you to replicate touch, keyboard and mouse controls on your Android phone. I used it briefly with a profile from here to control Minecraft. The profile is for the SGS3 so I need to adjust it slightly for the smaller screen of my Galaxy S 2 but it worked reasonably well.
Check if your phone is compatible by using this free compatibility checker first. You pair the controller with your phone by using your PC first to set the “master MAC address”, then hope the phone pairs. It’s not for the faint hearted but it does work.
Also keep an eye on this Reddit thread.
"Control your Android phone with a PS3 controller",