CSc 317 - Theme Nav - PA 2

Topics:

Overview

In this PA, you should build off of the ThemeXML app that you should have already written (or, if you are reading this before the due date, you might not have finished yet). The application should be a themed application, continuing with the same theme you chose on the last PA. You should name the project ThemeNav, and you can copy over content from ThemeXML if you’d like.

You should add two buttons to the main Activity from ThemeXML. Each button should bring the user to new Activity pages, with content on them to view. Each of the other two pages should display a sequence of content via a ListView. The content displayed on those pages should be somehow associated with the theme of the application.

In addition to the rules from the previous PA, here are the updated requirements:

Shown below is an example of such an application. The theme of the one shown below is the Phoenix Suns, as was the case for the Theme Code/XML application.

ThemeNav

Notice several other things, that you should implement in your application:

Development Strategy

Below is my recommended development strategy:

(1) Creating a button, changing Activity

Start by adding one button to the XML layout for the main Activity. You can use the Button XML tag for it. When that button is pressed, the Application should display another activity, which will eventually have a list of string content. Thus, you should create another Activity in your project to do this! Right click on the app directory of your project, navigate to “New” -> “Activity” -> “Empty Activity”. Give the Activity class a name (which should end in “Activity”). An activity class and a new activity layout xml file should be generated. You can read these docs to see how to have a button perform an action when pressed. In order for the button to activate an activity, you can use an intent, like so:

Intent intent = new Intent(this, YourActivity.class);
startActivity(intent);

Work on this until you can get the button to display the new activity.

(2) Adding content to the Activity

The next step is to actually get a list of text content displaying in the other activity. You should do this using a ListView with an ArrayAdapter. To use an array adapter

(3) Create another Button and Activity with ListView with Images and Text

Create another button and activity similar to how you did in part 1. When displayed on the screen, the activity should display a list with both images and text, rather than just text. You should use a SimpleAdapter with HashMap to get that working. You can reference the slides for how to accomplish that.

(5) Customizing the nav bar

Make edits to the manifest files, colors.xml, and styles.xml, in order to update the action bar appropriately. Ensure it is updated for each activity.

(6) Set the parent

Update AndroidManafest.xml to specify that the MainActivity should be the parent of the two other activities you created.

Target Platform

Target platform requirements are the same as for PA 1. As a reminder, you should target:

Submission

This PA is due on Friday, September 11, 2020, before 7pm. You should turn it in on Gradescope.

To submit, please do the following:

Note that there are not automated tests for this PA, so please ensure that your app works how the specification says it should!