Changes

Jump to: navigation, search

MAP524/DPS924 Lab 4

2,111 bytes added, 23:09, 12 July 2015
Created page with 'Create a simple Android app, named FragmentExample that continues from the example given in this week's lecture. Once you have …'
Create a simple Android app, named FragmentExample that continues from the example [[MAP524/DPS924_Lecture_4#Implementing_your_own|given in this week's lecture]].

Once you have the basic app running correctly from the notes, make these modifications:

# Change the background colour of each of the layout files to something more light and pleasing - not the dark red, green and blue (RGB) used in the original app.
# Change the two text views in each fragment layout to image views.
# Find two image (png) files and add them to the drawable directory of your app.
# Change each fragment layout to these images.
# At this point you should run your app. It should look something like this:
 
[[Image:frag1.png|300px|centre]]
 
<ol start="6">
<li>Notice that one image has a white background while the other has a transparent background.</li>
<li>Also notice the background colours are a little nicer than in the original app (but come up with your own).</li>
<li>Now change the text view in the main activity's layout to a button instead. Label the button Switch.</li>
<ul><li>Note: the label on the button should be defined in the strings.xml file</li></ul>
<li>If you run your app now, you should see something like this:</li>
&nbsp;
[[Image:frag2.png|300px|centre]]
&nbsp;
<li>Now add an onClick method to your main activity to handle the clicking of the button.</li>
<li>When the button clicks, the images in each fragment should be exchanged to now look something like this:</li>
&nbsp;
[[Image:frag3.png|300px|centre]]
&nbsp;
<li>Finally modify your code so that each time the button is clicked the images in the two fragments will be exchanges.</li>
<li>Run your app and create your own screencast. You can do this in Linux Mint by turning on recording with these keystrokes - CTRL-SHIFT-ALT-R. You will see a red bullet on your window indicating recording is turned on.</li>
<ul><li>Now click the button several times to show your app functions correctly.</li><li>To stop recording just hit CTRL-SHIFT-ALT-R a second time.</li><li>Your recording is saved in your home directory</li></ul>
</ol>

Navigation menu