1 / 25

Android Boot Camp

Android Boot Camp. Demo Application – Part 1. Development Environment Set Up. Download and install Java Development Kit (JDK) Download and unzip Android ADT, download SDK Manager packages Instructions are here:

edie
Download Presentation

Android Boot Camp

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. Android Boot Camp Demo Application – Part 1

  2. Development Environment Set Up • Download and install Java Development Kit (JDK) • Download and unzip Android ADT, download SDK Manager packages • Instructions are here: https://developer.motorolasolutions.com/community/developer-events/appforum-2014/android-boot-camp/blog/2014/09/07/appforum-android-boot-camp--hands-on-lab

  3. Create a new Android Project, in this case, the name is “Appforum1”

  4. Take Default Options

  5. Take Default Options

  6. Take Default Options, Create Blank Activity

  7. Take Default Options

  8. Basic “Hello world” Application is Generated

  9. Create a “Run Configuration”

  10. Run Configuration for Android Application

  11. Browse to your project

  12. Set the name of the Run Configuration to match your Application

  13. Select an AVD or Android Device

  14. Apply and Run

  15. Application runs in Emulator

  16. Go back into the graphical layout designer, Select Text Fields Tab

  17. Add a Text Input Field (editText1)

  18. Add a Button (button1) from “Form Widgets”

  19. Define a Listener for “On Click” for the Button

  20. Add the definitions for “textOutput” and “textInput” Add the code to get the references to the XML objects Add the code to get keystrokes, use “Ctl”-”Shift”-”O” to Organize Imports

  21. Add code for button and to move text from input to output fields

  22. Code Fragments 1 After: “public class MainActivity extends ActionBarActivity {” Insert:        private TextViewtextOutput;             private EditTexttextInput;

  23. Code Fragments 2 After: “protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);” Insert: textOutput = (TextView)findViewById(R.id.textView1);   textInput = (EditText)findViewById(R.id.editText1); textInput.setOnKeyListener(new EditText.OnKeyListener() {        public booleanonKey(View v, intkeyCode, KeyEvent event) {           if ((event.getAction() == KeyEvent.ACTION_DOWN)           && (keyCode == KeyEvent.KEYCODE_ENTER)) TransferInput();                                 return false; }        });

  24. Code Fragments 3 At the end of your application before the final “}”, insert :     public void Button1Clicked (View v)     { TransferInput();     }     public void TransferInput(){        String input;        input = textInput.getText().toString(); textOutput.setText(input); textInput.setText("");         }

  25. Congratulations, you have completed your first Application!

More Related