I am sorry, this is probably a very basic question, but my first Android program keeps getting hung when trying to switch to another activity. I have gone through several tutorials and the documentation, and I am starting to think that I am either leaving something basic out, or I am mixing methods too much. Hopefully someone can spot the problem, and show me where I am messing up.
So far, the app consists of two classes, Index and Statistics. Index is the default class, and gives the user a list of options. Statistics goes to the web, downloads an XML file of data, and displays it to the user. Both extend Activity and use onCreate and appear to work on their own.
In the manifest, I have defined a custom action for the Statistics activity:
In the index class, I have a method that receives a button click and tries to start the Activity by creating a new Intent:
When this code runs, the test dialog is displayed, indicating an ActivityNotFoundException occurred. Is there somewhere else that com.package.project.activity.SHOW_STATISTICS needs to be declared for example?
Any thoughts?
Thanks in advance for reading, and any suggestions/guidance you can offer.
So far, the app consists of two classes, Index and Statistics. Index is the default class, and gives the user a list of options. Statistics goes to the web, downloads an XML file of data, and displays it to the user. Both extend Activity and use onCreate and appear to work on their own.
In the manifest, I have defined a custom action for the Statistics activity:
Code:
<activity
android:name="Statistics"
android:label="@string/stats_title">
<intent-filter>
<action android:name="com.package.project.action.SHOW_STATISTICS" />
</intent-filter>
</activity>
In the index class, I have a method that receives a button click and tries to start the Activity by creating a new Intent:
Code:
if (R.id.statsButton == v.getId()) {
// The user wants to view the statistics, create an Intent
try {
startActivity(new Intent("com.package.project.action.SHOW_STATISTICS"));
} catch (ActivityNotFoundException e) {
showDialog(DIALOG_TESTING);
}
}
When this code runs, the test dialog is displayed, indicating an ActivityNotFoundException occurred. Is there somewhere else that com.package.project.activity.SHOW_STATISTICS needs to be declared for example?
Any thoughts?
Thanks in advance for reading, and any suggestions/guidance you can offer.