I am very new to Android development and I am working on an application in which I have 4 actions. Each action should be able to go to any of the other 3. Therefore, I created 4 buttons at the top of each action that allow this. The XML code is as follows:
<Button ... android:onClick="loadProfileLayout"/> <Button ... android:onClick="loadRulesLayout"/> <Button ... android:onClick="loadSettingsLayout"/> <Button ... android:onClick="loadHelpLayout"/>
the manifest has an activity tag for each:
<activity android:name=".Profiler" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="Rules"></activity> <activity android:name="Settings"></activity> <activity android:name="Help"></activity>
And the called functions:
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)); }
So, this initially works. From the main activity "Profile" I can go to any of the others. And from the other 3 I can move anywhere, but back to the main one. When I click the main activity button, the application crashes. I am trying to debug, but not even performing loadProfileLayout (). Eclipse opens the file "View.class" with the contents basically "Source not found." If I press F8 to continue debugging, it will load "ZygoteInit $ MethodAndArgsCaller.run ()" ... again, "Source not found." Pressing F8 will load the error message again into the emulator "Sorry! The application has stopped unexpectedly. Please try again."
Again, I'm new to Android, and all I know about activity is what I read on the dev website. Am I making a fundamental mistake here that I don't know about?
Thanks,
Nat
source share