开发者

Find connected device to Galaxy Tab - Android

开发者 https://www.devze.com 2023-02-14 10:53 出处:网络
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)

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):

  1. Add uiMode to android:configChanges in your manifest.
  2. Extend onConfigurationChanged(..) in your main Activity.
  3. Inside it check Configuration for various flags.

Does onConfigurationChanged() gets called when you plug in the TV? Do any flags change?

0

精彩评论

暂无评论...
验证码 换一张
取 消