Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It sounds like there are two activities. Your main activity with the set of buttons and a second activity that displays a set of instructions and images. Just build your activity so, based on how it is launched from your main application it reads the information to be displayed.</p> <p>Edit: Details</p> <p>To be honest, this is a pretty broad software design question. You want to separate the <em>what</em> you are displaying from the <em>how</em> you are displaying it.</p> <p>I'm going to loosely refer to your content as pages (text and images). This is the <em>what</em> when we talk about your applications data. What you want to do is further define this into something like an object:</p> <pre><code>public class PageData implements Serializable { String imageUrl; String description; } public class Book implements Serializable { ArrayList&lt;PageData&gt; swipeablePages; } </code></pre> <p>When you invoke your Activity to display a set of pages, you'd pass the Book as a extra to the intent. Your activity is then written generically to just display whatever book is sent to it. This reduces the number of different Activities you have greatly because now, you no longer need to have your Activity say 'I'm Mother Goose Nursery Rhymes" ... instead it just says "I can display any book you throw at me" and your main activity now could have a book shelf of 30 books. The main activity creates the books and shows an index and your second activity displays and allows users to interact with a book.</p> <p>The sky is really the limit. Lets say you create the most entertaining book experience ever on android. You could now publish your intent as "content:mybookdisplayer" and explain to other developers what books should look like. Then other developers could use your book viewer and heap praise on you for your piece of work! You could even embed an add on your book viewer and make millions of dollars :) Anyway, it all starts with dividing the <em>what</em> from the <em>how</em>. If you get that separation down, I think you'll find that your code is more reusable and easier to maintain.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload