Update MainActivity.java

Change to try/catch statement.