Android Basics – Phone vs Tablet – Which Layout the Device is using ?

In the last Blog Post you learnt how to create device specific resources like Layout, Menu, Images etc.

On a phone the Employee App will display list of Employees initially and on click of an employee the DetailActivity will be called. Whereas on a Tablet the List and the Detail is shown next to each other.

Question is how to achieve this?

If you take a look at the Layout XML file you will find that for a Tablet you have a FrameLayout.

So you can check in the Activity class that if this attribute exists then its a tablet. If not then call the DetailActivity.

Source Code – Github

Follow the video to understand this better.

Author: androidsmartly

I am a Tech Enthusiast who likes to work on new Ideas. Sharing knowledge on Android, Marketing, Startups and More.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s