Find connected device to Galaxy Tab - Android
I'm developing an app in which I must start a slideshow with some picture info. So far, so good. There's only one issue: I need to show one type of view wh开发者_如何学编程en the device (galaxy tab) is connected to a TV (TV-Out) and another view if it's showing on the tab.
Example:
If is connected to TV: Show only the images on TV, no info. If is not connected to TV: Show images plus info.
How can I find out if the device is plugged to a TV?
Try this (I'm not sure as I don't have the Tab):
- Add
uiMode
toandroid:configChanges
in your manifest. - Extend
onConfigurationChanged(..)
in your main Activity. - Inside it check
Configuration
for various flags.
Does onConfigurationChanged()
gets called when you plug in the TV? Do any flags change?
精彩评论