14

Exception Handling

Exception Handling for the Focus

Exception Handling for the Return/Exit Key

Exception Handling for the Player Exit Event

Exception Handling for the IME

Summary

The SmartTV application development needs to handle more exceptions than other platforms. However, understanding characteristics of the remote controlled TV and SDF provides guides that will help handling the exceptions. This chapter will cover a few important points using the Hands Frame advanced version application.

Exception Handling for the Focus

As emphasized many times already, a SmartTV uses a remote controller to move the focus to control an application. The focus must be controlled during the entire time that an application runs. Losing the focus means that a user lost the only control tool to use the application. This can cause erroneous feedback to remote control inputs, or simply no feedback at all.

When the focus is lost while running an application, due to inadequate exception handling, the only solution is ending and restarting the application. See the below example.

// Empty an element and output data from the IME input on the element.
var form_submit = function(){
      Main.login.elem.empty();
      Main.login.elem.text(‘Welcome ! ‘+Main.login.form.val() + ’.’);
};

The above code was used in the Hands Frame advanced version to implement the login feature. The code uses the IME to get user data for the login form, empty the Main.login.elem element, and enter the received data on there. Although ...

Get Samsung SmartTV Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.