Here I'm going to give you a sample for create wifi tethering hotspot programmatically using android WifiManager hotspot.
Following example can directly use for create a WPA_PSK secured wifi hotspot programmatically. But this won't create the hotspot that you set in this code if you have switch on the tethering hotspot in your device before executing this code.
---------------------------------------------------------<for more>-----------------------------------------------------------