I'm using Linux Mint as opposed to Ubuntu, but this information might be relevant
One way or another, you are probably launching Android Studio via the bin/studio.sh shell script. If you open that file in a text editor, you'll see how the following section where the JDK is loaded.
---------------------------------------------------------------------
# Locate a JDK installation directory which will be used to run the IDE.
# Try (in order): STUDIO_JDK, JDK_HOME, JAVA_HOME, "java" in PATH.
# ---------------------------------------------------------------------
if [ -n "$STUDIO_JDK" -a -x "$STUDIO_JDK/bin/java" ]; then
JDK="$STUDIO_JDK"
elif [ -n "$JDK_HOME" -a -x "$JDK_HOME/bin/java" ]; then
JDK="$JDK_HOME"
elif [ -n "$JAVA_HOME" -a -x "$JAVA_HOME/bin/java" ]; then
JDK="$JAVA_HOME"
else
JAVA_BIN_PATH=`which java`
...
In my case, I had the $JAVA_HOME defined in my .bashrc file pointing to my OpenJDK location (probably when I first installed Eclipse or some other software that had instructions on setting a global java location environment variable).
# JAVA HOME
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin
Since the studio.sh script looks for the environment variable $STUDIO_JDK first, you can simply install Oracle's JDK and define a STUDIO_JDK environment variable in your .bash_profile or .bashrc to point to this installation. I have not yet done so myself, so I will edit this if I run into any issues when I do.
/usr/share/java_7/bin/java -jar path_to_Androidstudio