Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should probably use a separate <code>Activity</code> for each screen; otherwise you need to end up keeping track of which individual <code>View</code> is currently being displayed, plus the state of all those not currently being displayed when the user switches to another window, or a call comes in etc.</p> <p>It's easier to keep track of this state if you just use a separate <code>Activity</code> for each piece of functionality.</p> <p>If you do decide to keep everything in a single <code>Activity</code> however, you could look at the <a href="http://developer.android.com/reference/android/app/TabActivity.html" rel="nofollow noreferrer"><code>TabActivity</code></a> class. However, there are also caveats there that prevent you from having an <code>Activity</code> as the tab content.</p> <ul> <li><a href="https://stackoverflow.com/questions/1568739/android-why-shouldnt-i-use-activities-inside-tabs">Android: Why shouldn&#39;t I use activities inside tabs?</a></li> </ul> <hr> <p>Regarding your follow-up, you unfortunately cannot attach an <code>Intent</code> directly to a <code>Button</code> like you can with a <code>MenuItem</code> via the XML, however you could just extend <code>Activity</code> to make your own common base class with some code that hooks up the listeners.</p> <p>Something like:</p> <pre><code>public class BaseActivity extends Activity { protected View.OnClickListener mButtonListener; protected void setupHeaderButtons() { findViewById(R.id.header_btn_1).setOnClickListener(mButtonListener); // ... findViewById(R.id.header_btn_n).setOnClickListener(mButtonListener); } } public class FirstActivity extends BaseActivity { @Override public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.first_activity); // This needs to be done *after* the View has been inflated setupHeaderButtons(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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