Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Activity Navigation
    primarykey
    data
    text
    <p>I'm very new to android development and I'm working on an application where I have 4 activities. Each activity needs to be able to navigate to any of the other 3. So I created 4 buttons at the top of each activity that allow for this. The XML code looks like this:</p> <pre><code>&lt;Button ... android:onClick="loadProfileLayout"/&gt; &lt;Button ... android:onClick="loadRulesLayout"/&gt; &lt;Button ... android:onClick="loadSettingsLayout"/&gt; &lt;Button ... android:onClick="loadHelpLayout"/&gt; </code></pre> <p>the manifest has an activity tag for each:</p> <pre><code> &lt;activity android:name=".Profiler" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name="Rules"&gt;&lt;/activity&gt; &lt;activity android:name="Settings"&gt;&lt;/activity&gt; &lt;activity android:name="Help"&gt;&lt;/activity&gt; </code></pre> <p>And the functions called are these:</p> <pre><code>public void loadProfileLayout() { startActivity(new Intent(this, Profiler.class)); } public void loadRulesLayout(View v) { startActivity(new Intent(this, Rules.class)); } public void loadSettingsLayout(View v) { startActivity(new Intent(this, Settings.class)); } public void loadHelpLayout(View v) { startActivity(new Intent(this, Help.class)); } </code></pre> <p>So initially this works. From the main "Profile" activity I am able to navigate to any of the other 3. And from the other 3 I can navigate anywhere but back to the main one. When I press the main activity button the application crashes. I try and debug, but it doesn't even appear to be executing loadProfileLayout(). Eclipse opens a "View.class" file with the contents of basically "Source not found". If I press F8 to continue debugging it loads "ZygoteInit$MethodAndArgsCaller.run()"... again, "Source not found". Pressing F8 again will load the error message in the emulator "Sorry! The application has stopped unexpectedly. Please try again."</p> <p>Again, I am new to Android and all I know of activities is what I've been reading on the dev website. Am I making a fundamental mistake here I am not aware of?</p> <p>Thanks,<br> Nate</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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