Working with Fragments on Tablet Applications

You create a new activity for your table app, and now you have to add fragments to it. There’s no need to write new fragments to use with the tablet activity. However, you need to make some changes to your fragments to make sure they work properly in this new environment.

Communicating between fragments

If you try to add a task with your tablet application, it doesn’t show the edit fragment next to the list fragment as you expect, but instead opens a new activity to add a task.

The reason that your app opens the edit fragment in a new activity, rather than adjacent to the list fragment, is that it’s still doing exactly what it was told. It’s still executing the old phone behavior, which is to start ...

Get Android Application Development For Dummies, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.