[Q] Android Layout / Activity Select via Hardware Detection?

Hi all,

First post here - looking forward to participating and working hard towards competency in Android development!


In the short time that I've been at this, I've noticed a great emphasis put on the importance of building a layout that will work across a range of Android hardware, or at least work well with both phones and tablets.

From what I've seen so far, the way to deal with this challenge is to compromise, and to not use absolute sizing for views etc..

I'm wondering if there is any kind of API available that would make it possible to detect hardware (at least screen size?) upon start up, which would then allow for switching to the appropriate XML layout?

I've not encountered it in any of the tutorials I've seen so far....

If this API *doesn't* exist, I would guess that the fact that the apps run on a VM might make any kind of hardware detection problematic if not impossible....

I'd appreciate any enlightenment on this that I can get!

Thanks in advance!

Show Accepted Answer

Guest Quick Reply (No URL, BBcode or HTML)

Last post by dflatley
4 hours ago
Software update
Started by ckutch
Last post by swaniawski.chester
3 hours ago
Last post by brogahn
1 hour ago
Last post by becker.sadie
4 hours ago
Last post by mosciski.stefanie
3 hours ago
Last post by tyler09
3 hours ago