The NYU SCPS catalog description is limited to 100 words:
Learn to write Android apps using the Eclipse application on a Mac or PC. An app is composed of Java objects plus a screen layout in the Extensible Markup Language. See how a Java “activity” object manipulates this XML to present a user interface containing buttons, sliders, and other controls. Draw text and graphics, respond to a touch or keystroke with a “listener” object, recognize a swipe or pinch, and perform simple animations. Create menus and dialogs, open an SQLite database, play background music with a “service” object, and let the components of different apps communicate with each other.
To see if this course is right for you, start looking at the entire content of the course. This content is free and online. To see approximately how much homework there will be in Summer 2014, see how much there was last time.
Prerequisite. You must know how to create a class of Java objects, including methods with arguments and a return value. You must know how to create a Java object and call its methods with arguments and return value. You must know how to create a subclass of a Java class.
I am hopeful that NYU SCPS will let me teach this course in Summer 2014, meeting once per week for ten Wednesday nights, June 11 to August 18, 6:30 to 9:30pm at 7 East 12th Street. (The Fourth of July is on a Friday this year, so it doesn’t affect us.) If SCPS decides to go ahead, they will put my name, the Wednesday dates, and the above course description in their online catalog.
Catch my full-day Android course at the Agile Conference in Las Vegas on Monday June 2, and at QCon at the Brooklyn Marriott on Tuesday, June 10. It’s a condensed version of the first third of INFO1-CE9705.
Contact me:
mark.meretzky@nyu.edu
mark.meretzky@gmail.com
Install Eclipse, etc. After installing them, you should be able to run commands such as
adb helpin the Terminal window of your Mac or the Command Prompt widow of your PC.
Look at the online Android documentation for the Java classes
we mentioned in class:
View
and its subclasses
TextView
and
LinearLayout
.
(There’s even a
LinearLayout
tutorial.)
Look at the
flowchart
in the documentation for class
Activity
.
Read the
Hello,
World
document and take a peek at the
AndroidManifest.xml
documentation.
Create a
GitHub
account.
You’ll have to invent a username for yourself;
on October 25th, you’ll tell me what it is.
Install or set up the application
git
.
Create a repository named
INFO1-CE9705
Nothing to hand in this week,
but do the
Project
and its “Things to try”.
(What is the command on a Windows PC to recursively list a directory and
all the files and directories under it—the child,
grandchild, and great-grandchild directories, etc.?)
You can save your project as a
zip file
on your hard disk
and re-create the project from the zip file.
We’s going to have a two-minute presentation by a volunteer about
dragging a view (e.g., an
analog clock)
from the pallets into the
main.xml
file.
find
command I showed you in class was
find / -type f -name .asserts -print 2> /dev/nullI added pixel density to Debugging. I corrected the ApiDemos compilation instructions so that you don’t have to comment out all those
@Override
Java annotations.
I fixed the errors in
Listener,
and added a second button.
Here are the GitHub accounts (including mine). Please email me your loginname if I don’t have it yet.
Explore ApiDemos. We’ll have a brief in-class presentation about some of the other sample apps, e.g., Lunar Lander.
Write an app with one or more
Buttons
and
TextView
s.
Make something happen when you press the button(s).
The colors and dimensions should be stored in resource files; see
exercise #12 in
Project.
The strings should be stored in a resource file;
see exercise #8 in
Listener.
android:layout_weight
RatingBar
to work in the
Android
Emulator
without crashing the app?
Will
avenue.C
give you the correct cross streets for Park Avenue South
if you enter that avenue as the number 4?
(Park Avenue South used to be called Fourth Avenue.)
The animation lecture included
Ken Perlin’s
Fish Tales
animation.
To find the full pathname of the two
.xml
files plugged into an
ArrayAdapter<String>
on a Mac, give the following commands in the Terminal.,
find / -type f -name simple_spinner_item.xml -print 2> /dev/null find / -type f -name simple_spinner_dropdown_item.xml -print 2> /dev/null
Write (and upload to
Github)
an app with widgets,
and a second thread to make something keep happening
(a counter, a change of color, etc).
Have the Java code create at least some of the widgets;
call
addView
and maybe
removeView
.
Can’t think of what to write?
The coolest man who ever lived was
Derek Flint.
Create an app that Mr. Flint might carry in his pocket.
(He had the first
ringtone
ever.)
translate
?
You already have a
GitHub
repository named
INFO1-CE9705
.
Create another repository named
November16
(uppercase
N
,
digits 1 and 6).
Create a project named
November16
and upload it to the new repository.
The project should have your own subclass of
View
with an
onDraw
method that draws graphics.
Look at the other students’s projects.
ScaleGestureDetector
,
and it got a lot simpler.
Is there a simpler way to do
Animate?
How many seconds does
onSingleTapConfirmed
wait before it announces a single tap?
Can we change this number of seconds?
Does the
android:gestureStrokeType="multiple"
GestureOverlayView
actually allow us to recognize multiple-stroke views such as a plus sign?
Create an emulator with an SD card as we did
here.
Explore the inside of your phone or emulator with
adb
shell
.push
and
pull
a file?
Write a project named
November22
(not Nov22
)
with graphics and touch-sensitivity
and upload it to your
INFO1-CE9705
November16
to
November22
I removed the redundant creation of the array from
Pearl
and changed the parameters (mass, gravity, etc.) to static final fields of class
Pearl
.
I put
getRefreshRate
into the exercises.
(My Motorola XPRT MB612 has a refresh rate of 68 per second.)
But here’s what I’d really like to do.
iPhone has a way of calling a method with each hardware refresh of the screen;
see the
CADisplayLink
in
Pong.
If the
frameInterval
in the
view
controller
is 1 (which it is),
then the method
move:
in class
View
will be called each time the hardware refreshes the screen.
If the
frameInterval
is 2,
the method
move:
will be called every other time the hardware refreshes the screen.
If
frameInterval
is 3,
move:
will be called every third time the hardware refreshes the screen.
Is there anything like this in Android,
which will let us synchronize a method call with a hardware refresh?
Why does
Html5
believe that the window is 320 × 240?
Can we fix this with an HTML meta tag,
maybe something like
<meta name = "viewport" content = "width = device-width">
Rooting Android 2.2.2 on Motorola XPRT cell phone, with pleasant, new-agey background music. You have to Download Motorola 5.2.0 Driver with MotoHelper and download SuperOneClock from shortfuse.org. Thanks, Mike.
TimePicker
in the
TimePickerDialog example
now knows about 12- and 24-hour format.
The
onClick
method of the
DialogInterface.OnClickListener
How about Leonardo da Vinci’s The Last Supper—is that the most famous landscape-orientation painting of all time?
Write a project named
December6
(not Dec6
)
with at least one dialog
and upload it to your
INFO1-CE9705
On December 6, we’ll have a report about the JavaScript framework Sencha Touch. Home page. Wikipedia article. Tutorial. PhoneGap.
December13
with a menu (options menu and/or context menu)
that does something with an
Intent
.
On December 13, we’ll have a report about talking to the emulator
using
telnet
.
Observe that the spinner in
MenuInflateFromXml.java
.
Sencha Touch demos: they will work properly only on a mobile browser (though they work okish in Chrome). Here is probably the best one. These are web pages so you can access the source with right click→show source. Also they are packed with the Sencha SDK Download.
Breaking news (December 7): Apparently this technology is better than Sencha Touch. Where Sencha only gives you the front end, Phone Gap allows you to access native methods. See features.
Cursor
in
List2.java
)Contacts.CONTENT_URI
ContactsContract.Contacts.CONTENT_URI
Write (and upload to GitHub) a project named
December20
that does something interesting,
e.g., involving intents, cursors, tabs, gridviews, galleries, etc.
Fill out and return the course evaluations that NYU will email you;
maybe you’ll win the $500 raffle.
Next week: SQLite, GPS, and Google maps.
We also did
Busybox.
I installed Busybox into my Android Emulator;
what do I have to do to install it into my Motorola MB612 phone?
When I tried to make the directory
/data/busybox
mkdir
said “Permission denied”.
Please bring a cellphone to the first class to take the class photo.
mark.meretzky@nyu.edu
Install Eclipse, etc. After installing them, can you run the command
adb helpin the Terminal window of your Mac or the Command Prompt widow of your PC?
You created an AVD (a virtual device in the emulator) by pulling down the Eclipse Window menu and selecting Android SDK and AVD Manager. If you find the 3.1 tablet AVD too weird or too sluggish, you can make a more familiar 2.3.3 telephone AVD. Then when you create a project, specify 2.3.3 for the project’s Build Target.
Look at the documentation for the Java classes we mentioned in class:
View
and its subclasses
TextView
and
LinearLayout
.
Look at the
flowchart
in the documentation for class
Activity
.
Read the
Hello,
World
document and take a peek at the
AndroidManifest.xml
documentation.
NYU has created oit2.scps.nyu.edu accounts for almost everyone in the class.
Get your
loginname
(same as your NYU NetID)
and
secret password,
if you don’t already have them,
for our Solaris Unix server
oit2.scps.nyu.edu
.
If you couldn’t get a secret password from
start.nyu.edu,
contact the
accounts office.
One way to do this is by calling (212) 998-3333 option 1.
Make it clear to the accounts office that you are trying to get a password
for
oit2.scps.nyu.edu
,
not for Blackboard.
(They think everyone is a Blackboard user.)
Nothing to hand in this week,
but practice saving your project as a
zip file
and re-creating the project from the zip file.
For example, here is the
Project.zip
file I created in class on May 31 at 9:30 p.m.
Research projects: can you drag a view (e.g., an
analog clock)
from the pallets into the
main.xml
file?
How can we upload a zip file to
GitHub
so we can see each other’s homework?
View.OnClickListener
.)
I’m soliciting two-minute in-class oral reports on the following topics.
Can we create a
more
elaborate
piece of Toast?
Besides
ApiDemos,
which
sample
apps
would be educational and entertaining to play with
(e.g.,
LunarLander)?
How can we remember the sequence
v
,
d
,
i,
w,
e,
s?
Very Dark Icebergs…
To see the version of Android that is running on a phone,
Settings →
About phone →
Android version.
Does the Android version number determine the SDK version?
Explore
ApiDemos.
For example,
go to
Views/Buttons
.
Then go to the Package Explorer in the Java Perspective of Eclipse
and look at the files
src/com.example.android.apis.view/Buttons1.java
and
res/layout/buttons_1.xml
.
Write an app that displays text by means of a
Toast
,
a
TextView
or
Log.d
.
See
debugging output.
Save the app as a
.zip
file.
Upload the
.zip
file to
GitHub.
Charles Shen has kindly provided the following instructions for GitHub.
https://github.com/
.
Click the big blue button
“Plans, Pricing and Signup”.
Click the “Create a free account” button
on the right side of the “$0 Free for open source” option
on top to create an account.
~/Hello-World
.
In order to upload your homework file, e.g.,
Project.zip
at your home directory to GitHub,
execute the following commands:
$ mv Project.zip ~/Hello-World $ cd ~/Hello-World $ git add Project.zip $ git commit -m 'added Project.zip' $ git remote add origin git@github.com:yourusername/HelloWorld.git $ git push origin master(Use your real username for the “yourusername” parameter)
As an example, I have uploaded a zip file on GitHub using my Mac.
If you go to
https://github.com/
and search for
cs3212
,
you will find one result
cs3212
in the
“Users”
field.
Click on it, you will find a public repository called
HelloWorld
,
click on it and you can then download the
HelloWorld.zip
file.
The coolest man who ever lived was Derek Flint. (Here’s his ringtone.) Design a pocket device for Mr. Flint with lots of buttons and/or other widgets (kilotons, megatons, Moscow, Peking, London). Or make any other app with lots of buttons. Each widget should respond in some way, e.g., with a piece of toast.
.zip
file to GitHub.
Can the
Time
object in
TimePicker
know about DaylightSavings Time?
Why can’t the Safari and Firefox on the instructor’s Mac
go to
https://github.com/
?
Write an app with one or more dialogs and upload it to GitHub. Audio recording and/or playback would be a plus. Am I missing anybody’s GitHub username?
When I changed the style of the
Progress Dialog from
STYLE_HORIZONTAL
to
STYLE_SPINNER
here,
the spinner spun correctly every time I launched
the dialog in my 2.3.3 Emulator.
I added an exercise to
Don’t Tread On Me.
Write and app (and upload it to GitHub) with an options menu. Play with the other students’ apps and their most recent app.
translate
,
scale
,
rotate
,
and/or
skew
.
You can undo a transformation with
save
and
restore
.
Write an app that is touch-sensitive or that does something with an
sqlite database.
Save it in a zip file named
App.zip
.
Upload
App.zip
into a GitHub repository named
july26
(four lowecase letters, two digits).
If everyone has the same filename and the same repository name
for this homework,
I’m hoping I can easily create a shellscript that
will upload everyone’s project into Eclipse all at once,
and even downgrade all the projects to sdk version 8.