I was trying to get Android Studio to use Java 1.7 on Mac OS X (Mountain Lion)
I went to
File > Project Structure...
I went to Java SE Downloads and downloaded Java 7 again. The method mentioned above worked for Eclipse.
Running the installer from this manual download placed the JDK in
/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home, which was accepted by Android Studio.