How do I connect a PS3 Controller with Xperia P? How do I connect a PS3 Controller with Xperia P?
If your android is rooted  you can follow the steps


Install Sixaxis Pairing tool in your pc
Install Sixaxis Controller app in your android
In android app Tap the start button and wait for bluetooth to initiate. If you
get an 'Error: Missing required protocol' message, your device is
not supported.
You must manually pair the controller with your
phone. This can be done using SixaxisPairTool in yor pc.Your phones bluetooth
address should be shown at the bottom of the main application window
and will look something like 1A:3C:13:00:21:C2; you need to enter
this number into the SixaxisPairTool
Once paired, unplug the USB cable and press the power button on the
controller. If successful, the lights on the controller will stop
blinking and a single light will remain on.
Tap the 'Change Input Method' button and select 'Sixaxis Controller'. You should now
be able to use the controller in any games or applications that
support key bindings, such as many emulators.


Source: http://www.dancingpixelstudios.com/sixaxiscontroller/instructions.html

Youtube video : 


https://www.youtube.com/watch?v=WI3t-h390rc#t=22 
https://www.youtube.com/watch?v=WBcO_Gt0fd4