I have an application I want to adapt to tablets and handheld devices
- When handheld device is in portrait or landscape I want to display
ListViewand when list item is selected I start another activity. - When tablet device is in portrait – see above.
- When tablet device is in landscape I want to display
ListViewin one part of the screen and selected item content in another part of the screen. Basically something like this:
How should I achieve that? I was thinking different activities and layout resources for each orientation. But I have a feeling that there is a smarter and better way.
Of course I could stuff everything in one activity somehow but it doesn’t feel right. Nor looks nice 🙂
Thank you
What you want to achieve can be done using
Fragments. Here is an example depicting the use ofFragments.To communicate between fragments see this link.