Android Apps INFO1-CE9705

Syllabus

Topics are not covered in the following order. For example, items 1, 2, and 4—XML layouts and Java classes—are interlaced.

  1. XML: the Extensible Markup Language.
    1. Tags, pairs of tags, nested pairs of tags. XML version, UTF-8 character encoding.
    2. Tree-structured data.
    3. Attributes: key-value pairs, the android namespace
    4. Three XML files created automatically for any project: main.xml, strings.xml, AndroidManifest.xml.
  2. Layouts.
    1. Start with LinearLayouts and TextViews.
    2. Other types of layouts: FrameLayout for simple superimpositions, LinearLayout, TableLayout for rows and columns, RelativeLayout. Tabs for launching other Activitys.
  3. Widgets.
    1. Buttons, check boxes, ToggleButtons.
    2. EditText: dismiss the keyboard with an InputMethodManager.
    3. RadioButton and RadioGroup.
    4. SeekBar: setMax, change integer value of bar into a fraction in the range 0 to 1, onProgressChanged.
    5. The widgets don’t respond until Java listeners have been provided for them.
    6. Two examples of AdapterViews: ListView and Spinner. Two examples of Adapters to go with them: ArrayAdapter<T> and SimpleCursorAdapter.
  4. Java.
    1. Review the language, emphasizing static variables (class fields), static methods (class methods), and static nested classes and interfaces.
    2. Create a class. Generate Javadoc.
    3. Create a subclass using inheritance: extends, the @Override annotation, protected, super.
    4. Create a subclass of the Android class Activity. Override the method onCreate. See how the Java connects to the XML: setContentView.
    5. Handle UI (User Interface) events such as clicks and touches. Implement a nested interface such as View.OnClickListener. Implement it as a named class and as an anonymous class; instantiate it as a named object and as an anonymous object; or let class Activity implement it.
  5. The anatomy of an Eclipse project.
    1. Files and directories created automatically by Eclipse.
    2. The AndroidManifest.xml file. Which activity is launched when the app starts up? Launch the app in landscpae orientation.
    3. Export the project as a .zip file; import it back in. Screen shots.
    4. The tools directory.
    5. Create the project wthout using Eclipse. Create the source code with android, the .apk file with ant. Install it into the emulator with adb.
    6. Sample apps: ApiDemos contains lots of demonstrations.
  6. Connect the XML with the Java.
    1. Give the Java code a reference to an object in an .xml file. findViewById.
    2. Create the user interface programmatically. addView.
    3. Let the XML object call a method in the Java code. Listeners, anonymous inner classes.
  7. Sqlite databases.
    1. Create a database file manually with the sqlite3 interactive interpreter.
    2. Open the database with SQLiteOpenHelper, write to it with execSQL, read from it with a Cursor. Put the Cursor in a SimpleCursorAdapter to provide data for a ListView or a Spinner. Override getString in a subclass of Cursor.
    3. Use adb shell to examine the database file created by the app. Run sqlite3 inside of adb shell. Pull a file from the emulator filesystem to the computer; push it back again.
  8. Menus and dialogs.
  9. Touches.
    1. MotionEvents have different indices for different fingers.
    2. Distinguish between horizontal and vertical swipes, pinches and spreads.
  10. Graphics.
    1. 2-D graphics: create a graphic by drawing with Paint onto a Canvas object.s drawLine, drawPath.
    2. Translate, scale, and rotate the drawing. Examine the CTM (Current Transformation Matrix) with getMatrix and getValues.
    3. Animate a View by making repeated calls to invalidate.
    4. Animate a View with Animation and Transformation objects.
    5. Drawables.
    6. Android now supports OpenGL ES 2.0 with shaders.
  11. WebViews
    1. Load a web page into a WebView. The WebView’s client will tell us when the page is completely loaded. The WebView’s Chrome client will tell us if the page has called the JavaScript alert function.
    2. Call JavaScript functions in the web page after the page is loaded.
    3. Draw HTML5 graphics in the web page using JavaScript.
    4. Get a Google map with the JavaScript API version 3. See how this API can serve up any organized set of images. Examples: Moon, Mars, Sky.
  12. Activities and intents.
    1. A task is a stack of activities. Push and pop the stack (with the back button). Launch modes and affinities. Multiple instantiations of the same activity.
    2. Intents and filters. A filter for one particlar Activity class; a filter for one particular Mime type.
  13. Miscellaneous.
    1. Google Maps using the JavaScript API, Version 3.
    2. NDK: the Native Development Kit lets an app call functions written in C or C++.

    Grading policy

    No tests. Grades will be determined by the apps handed in as homework. Each app will be submitted as a .zip file uploaded to GitHub.