This is a simple thing, there is nothing special about the PI, first, connect it to a wireless dongle (USB is your only option anyways), then create a file with your network settings, because of the scenario this is written for, and it is written as a reference for someone, I will connect it to an android hotspot, the subnet here is specific to android, others should use your own according to their router.
1- create the following file at /etc/wpa_supplicant/wpa_supplicant.conf
network={ ssid="isam" psk="abcabc1234" proto=RSN key_mgmt=WPA-PSK pairwise=CCMP auth_alg=OPEN }
Now, modify the file /etc/network/interfaces