How to do it
1.Switch your phone off. ...
2.Hold down the Power, Volume Up and Home buttons at the same time for about 10 seconds. ...
3.To navigate through this menu, use the volume up/down buttons to scroll up and down and the power button to confirm selections. ...
4.Scroll down and select Yes - Delete All User Data.
Your contacts on the SIM card can then be used after the rest, and the pictures on the SD card (external) will still be there.