Java tutorial
//package com.java2s; import android.app.UiModeManager; import android.content.Context; import android.content.res.Configuration; public class Main { public static boolean isTV(Context context) { UiModeManager uiModeManager = (UiModeManager) context.getSystemService(Context.UI_MODE_SERVICE); return uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION; } }