Two things are commonly recommended for Android-owning RPi users: one, tether with your smartphone instead of buying a separate Wifi dongle, and two, set up a VNC connection when you don’t have an HDMI setup handy.
To do both at the same time, however, is tricky – the tethering is typically done via DHCP to tell the Pi the gateway address, while VNC users like to give their Pi a static address so they don’t need to guess what to connect to.
As it turns out, you can have both: Android’s tethering IP is actually hardcoded to precisely
192.168.42.129. This means you can set up a static IP (like
192.168.42.42) and a fixed gateway address for internet access.
Without qualms and reservations, you can write into your
iface usb0 inet static address 192.168.42.42 netmask 255.255.255.0 network 192.168.42.0 broadcast 192.168.42.255 gateway 192.168.42.129
for both internet access and VNC.
Bonus: if you’ve set up your Pi via ethernet because there’s a laptop on your desk anyway and you’re tired of staring at a small screen, you can also share that laptop’s wifi through the ethernet cable while using VNC. In this case, there is no hardcoded address. Still, once you find out your computer’s IP you can use the
route command to make it your Pi’s gateway, without having to edit the
interfaces file and restarting anything:
sudo route add default gw <your_computer's_ip>