Sunday, November 2, 2014

Android : Need help understanding what exactly are the try-catch statements in java and android



I am a beginner developer and I am currently learning android and java etc.. I have the following lines of code and I am not exactly sure what the try-catch-finally statements are about. I understand that in the try part there is the sleep method which determines the length of the activity, but what about the rest please? Thanks in advance!



Thread timer = new Thread() {
public void run() {
try {
sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
Intent openStartingPoint = new Intent(
"com.example.testapp.MAINACTIVITY");
startActivity(openStartingPoint);
}
}
};
timer.start();
}

No comments:

Post a Comment