1 / 29

Android Application Development

Lecture 01 Introduction. Android Application Development . Stephen Diniz sdiniz@umassd.edu Computer/Electrical Engineer. Setting Up Your IDE. An IDE is an I ntegrated D evelopment E nvironment and is made to aid developers in creating and debugging projects.

ilana
Télécharger la présentation

Android Application Development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 01 Introduction AndroidApplicationDevelopment Stephen Diniz sdiniz@umassd.edu Computer/Electrical Engineer

  2. Setting Up Your IDE • An IDE is an Integrated Development Environment and is made to aid developers in creating and debugging projects. • IDE’s typically include syntaxhighlighting, a debugger, auto-completion, and a solution builder.

  3. Java’s JDK • Like any programming language, development kits are required in order for your computer to compile and interpret your code. • Since Android is heavily based off Java, most concepts can be directly implemented during your development. http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html

  4. Eclipse • Eclipse is a very powerful IDE and is recommended by Google to use when developing for Android. http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/indigor

  5. Step 1: Install the Java JDK • Go to the provided link on slide 3 and download the version of the JDK that best fits your operating system. • For Windows Vista/7 users running the 64-bit operating system, make sure to download the Windows x64 version of the Java Development Kit.

  6. Step 2: Downloading Eclipse • Eclipse, like the Java JDK, comes in Linux/Window/Mac builds (32-bit/64-bit). • Choose the one that best fits you and unzip it. • The most convenient place to have Eclipse is in your root directory: C:\Eclipse -Windows /home/user/eclipse/ -Linux

  7. Step 3: Installing the ADT • The ADT, or Android Development Tools, is a plugin for Eclipse designed to give powerful integration to your environment. • The most recent version of the ADT (as of 9/21/11) is ADT 12.0.0 • The ADT installation instructions can be found here: http://developer.android.com/sdk/eclipse-adt.html

  8. The Java Programming Language • Primitive Data Types: (notice lowercase) • byte • short • int • long • float • double • boolean • char

  9. The Java Programming Language • Objects • String • BigDecimal • Require methods in order to do most things, such as finding out if two strings are equal. IncorrectCorrect

  10. Java “Hello world!” Program Java Tutorials: http://www.thenewboston.com/?cat=36&pOpen=tutorial

  11. Android “Hello world” Application • Programmatically:

  12. Android “Hello world” Application • Utilizing XML:

  13. Android “Hello world” Application • Utilizing XML (continued):

  14. The Result is identical

  15. Which Approach To Use? • Mostly preference, however… • For larger, more complex applications, I would highly recommend the XML approach • XML makes it easy to modify properties of Objects on the screen (Buttons, TextViews, etc) For larger, more complex applications, I would highly recommend the XML approach

  16. Do I have to choose? • No, for the most part, XML and the code play nicely together. • Accessing an object in an XML file requires one line of code and its attributes can be read and modified.

  17. For Example • Let’s return to the second Hello world example and modify the TextView’s content. • The XML file will go unchanged, but note the TextView’sandroid:id

  18. Binding to the TextView • The following code will bind to the Hello world’s TextView and change its contents to “Android is Awesome!” android:id

  19. The Android Developer Reference Website • This website contains all the information about Android methods and objects in order to do things programmatically. • Most methods (that refer to XML objects) can be altered via XML and Java relatively easily. http://developer.android.com/reference/android/provider/package-summary.html

  20. Using the Reference Website • Let’s look up how to create a text field, or in Android, an EditText • We’re going to search EditText in the search field and choose the android.widget.EditText option.

  21. Using the Reference Website • If you scroll down a bit you’ll find a section called Public Methods.

  22. Using the Reference Website • Let’s make a simple App that will get the content of an EditText, mirror the String, and set the EditText’s content to the new, mirrored String. • Any ideas?

  23. String Mirroring App Note: getText() returns an Editable object. If we click the Editable link and read up quickly, we’ll notice Editable “implements” GetChars, Spannable, Appendable, and most importantly (for this project), CharSequence

  24. String Mirroring App • Let’s scroll down to the Inherited Methods and see what methods are available “From interface android.text.CharSequence • In this case, the method of interest is toString() because of its return type String.

  25. String Mirroring App • Perfect, we have two functions, getText() and setText() to do that main operations we want to our EditText object. • The rest of the mirroring is purely Java and can be done in a few different ways.

  26. String Mirroring App

  27. String Mirroring App

More Related