Changes

Jump to: navigation, search

BTC640/Mobile

1 byte removed, 11:50, 11 February 2012
no edit summary
We want to be able to test the app we create even if you don't have an Android phone, so we'll create an AVD.
* # Open up the Android SDK and AVD Manager in Eclipse* # Create a new virtual device* # Give it a name (whatever you want), select a target (there's only one choice)* # This is important: '''Do not create a large SD Card'''. Since everything is in RAM you only have a few hundred megs of disk space, so even though a 16MB SD card is unrealistic, we won't need more than that for anything we'll be doing. If you create a much larger SD card you will simply run out of virtual disk space and everything will crash.* # Start your device, and wait for it to boot. You can play around in there, this is what an Android phone is like.* # Leave the emulator running, and go back to eclipse. You can close the SDK and AVD Manager now.
== Sample App ==
We're going to create an app that does almost nothing, but that should be good enough for one lecture and one lab.
* # Create a new Android project in Eclipse. Give it a name and a package name such as ca.senecacollege.yourlearnid You do not need a test project.* # Have a look around, interesting parts are:** ## The src/ with the single Java file. This is all the source code your app has at this point.** ## XML files, which can be viewed using a pretty graphical viewer or a simple text/xml viewer by choosing the tab at the bottom after you double-click on the file in Eclipse.*** ### AndroidManifest.xml - information about your app, its platform and permission requirements.*** ### res/values/strings.xml is the collection of translatable strings, similar to a POT file. If you add a new string in your UI you should add it here.*** ### res/layout/main.xml is the XML definition of the current layout of your app. You can do quite a bit in here without knowing a lot about Android or even Java.*** ## Note that the R.java file under "gen" is automatically generated by the compiler from your xml files, don't be tempted to manually edit it.* # Select your package in the package explorer, and click the green Run button. Run it as an Android application. This will compile your app and run it on your phone (if it's connected) or on the emulator (if it's running).* # Go back to main.xml and make the app a login screen. Change the hello world text (using an existing or new @string resource) to "YourName's fancy app", add username/password textviews and fields, and a button. Make sure your new fields and button text are @string resources.
= Lab submission =

Navigation menu