teaching machines

CS 491 Lecture 7 – Persistence of Ketchup

Agenda reflecting preferences in summaries actually setting default preference values inspecting files with adb restoring a paused game incorporating word categories passing information to spawned Activitys Updating summaries You can set a preference’s summary with: EditTextPreference pref = (EditTextPreference) getPreferenceScreen().findPreference(getString(R.string.goal)); pref.setSummary(“The first team to ” + prefs.getString(getString(R.string.goal), “0”) + ” wins”); So, how can you […]

CS 145 Lecture 6

Topics Covered what does this do? facing off the computer in guess-a-number generating a random spelunking workout an acrostic editor calculating average cell phone payment What does this do? public static String ?(??) { return text + ” :)”; } public static ? ??(String text) { return text.length() == 0; } public static ? ??(String […]

CS 145 Lecture 5

Agenda revisiting method anatomy put yourself in the method’s shoes: what am I trying to do? what do I need to give back? what outside information do I need in order to perform my job? how arguments are passed method improv Code GeometryFun.java package lecture; import java.util.Scanner; public class GeometryFun { public static void main(String[] […]

CS 491 Lecture 6 – For all Intents and Preferences

Agenda Review cleaned up Ketchup Starting up other activities Adding a menu Incorporating user preferences Refactoring Ketchup I cleaned up our mess of Ketchup a bit. The biggest issue was properly sequencing the user interaction so that the timer doesn’t start until team names have been entered. Team names are displayed on the screen with […]

CS 491 Lecture 5 – More Ketchup

Agenda Generate and advance words Add a timer Talk about Android threading Add an award-point dialog Add a team name dialog Splitting layout evenly Last lecture, someone asked how to split the layout up independent of the widget’s content. The way to do this is to have the containing view group fill its parent, set […]

CS 145 Lecture 4

Agenda finish up KML example don’t repeat yourself method anatomy method’s beauty: minimize bug potential encapsulate small, testable units make calling code more readable some more examples Code Placemarker.java package lecture; import java.util.Scanner; public class Placemarker { public static void main(String[] args) { System.out.println(“<?xml version=\”1.0\” encoding=\”UTF-8\”?>”); System.out.println(“<kml xmlns=\”http://www.opengis.net/kml/2.2\”>”); System.out.println(“<Document>”); System.out.println(“<Style id=\”seethrough\”><PolyStyle><color>7fffffff</color></PolyStyle></Style>”); handlePlacemark(); handlePlacemark(); handlePlacemark(); System.out.println(“</Document>”); […]

CS 145 Lecture 3

Agenda String Scanner objects vs. primitives methods vs. operators a bunch of common String methods KML Code StringFun.java package lecture; import java.util.Scanner; public class StringFun { public static void main(String[] args) { char letter = ‘a’; String alphabet = “abcdefghijklmnopqrstuvwxyz”; int sizeOfAlphabet = alphabet.length(); System.out.println(sizeOfAlphabet); Scanner in = new Scanner(System.in); // System.out.println(“Enter something, NOW: “); […]

CS 491 Lecture 4 – Ketchup

Agenda Continue publication of PopMusic Get to discussion of autoporting Design Ketchup Draft non-trivial XML layout of game screen Autoporting A major feature of Android market is that you can sell your apps to people all over the world and probably in the ISS too. However, English is spoken by about only a quarter of […]

CS 491 Lecture 3 – Publish and polish

Agenda Toggle between popped and unpopped images Play popping sounds Fullscreenify it Persist data? Autoporting to different languages and screen densities Publish app Playing media There are a couple of ways to play media using stock Android software. The class MediaPlayer is the simplest, and it can play resources given their ID. We have a […]

CS 145 Lecture 2

Topics Covered Can we break the paperclip chain record? Boolean The nature of primitive types Switching between types Penny-based RAM Higher-level operations in the Math class Calculating cow-path savings What does this do? int a = 7; int b = 3; b = a + b; int i; System.out.println(i); int i = 100; System.out.println(i / […]

1 107 108 109 110