Lecture 2 agenda Setting-up projects properly Review git config Java event model Anatomy of and Android Application Activity Lifecycle State Changes; saving.

Slides:



Advertisements
Similar presentations
Advanced Java Programming Adam Gerber, PhD, SCJP office: Ryerson CS Lab 4 th Floor office hrs: 3:30-5:30pm Wed.
Advertisements

An Introduction By Sonali and Rasika.  Required for the project  Show the versions of your code in the course of development  Show versions of your.
Git Branching What is a branch?. Review: Distributed - Snapshots Files are stored by SHA-1 hash rather than filename Stored in git database in compressed.
Filip Debelić What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,
Android Programming. Outline Preparation Create new project Build and Run a project Debug a project Deploy on devices.
Version Control with git. Version Control Version control is a system that records changes to a file or set of files over time so that you can recall.
Creating Android user interfaces using layouts 1Android user interfaces using layouts.
1 CSE 390 “Lecture 11” Version control with Git slides created by Ruth Anderson, images from
Git for Version Control These slides are heavily based on slides created by Ruth Anderson for CSE 390a. Thanks, Ruth! images taken from
Lecture 3 agenda Layouts Intents (both explicit and implicit) ListViews and Adapters.
Chapter 3 Navigating a Project Goals & Objectives 1.Get familiar with the navigation of the project. How is everything structured? What settings can you.
Android Application Development android.cs.uchicago.edu.
علیرضا فراهانی استاد درس: جعفری نژاد مهر Version Control ▪Version control is a system that records changes to a file or set of files over time so.
Chapter 2: Simplify! The Android User Interface
Tip Calculator App Building an Android App with Java © by Pearson Education, Inc. All Rights Reserved.
Peter Ogden and Josh Levine.  Motivation  High level overview  Walk through the common operations  How not to break things (too badly)
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 8-Oct-15.
Lecture 3 agenda revised setup Android Studio alt-views & shortcuts review layouts and resources debugging in Android Studio lifecycle in Android lab chapters.
Chapter 2 The Android User Interface. Objectives  In this chapter, you learn to:  Develop a user interface using the TextView, ImageView, and Button.
Version Control Systems academy.zariba.com 1. Lecture Content 1.What is Software Configuration Management? 2.Version Control Systems (VCS) 3.Basic Git.
…using Git/Tortoise Git
Git workflow and basic commands By: Anuj Sharma. Why git? Git is a distributed revision control system with an emphasis on speed, data integrity, and.
SWEN 302: AGILE METHODS Roma Klapaukh & Alex Potanin.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Android Boot Camp for Developers Using Java, 3E
Resources. Application Resources Resources are strings, images, and other pieces of application information that are stored and maintained (externalized)
Team 708 – Hardwired Fusion Created by Nam Tran 2014.
Piazza Piazza: 037/home Course website:
Git Basics. Git stores data as snapshots of the project over time When commit Save all the files If files have not changed, point to the previous identical.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Introduction to Android (Part.
Paul McGrath.  Speedy Input  Speedy Visualisation  Speedy Workflow.
1 GIT NOUN \’GIT\ A DISTRIBUTED REVISION CONTROL AND SOURCE CODE MANAGEMENT (SCM) SYSTEM WITH AN EMPHASIS ON SPEED. INITIALLY DESIGNED AND DEVELOPED BY.
Sofia Event Center May 2014 Martin Kulov Git For TFS Developers.
Intro to Git presented by Brian K. Vagnini Hosted by.
Introduction to Git Yonglei Tao GVSU. Version Control Systems  Also known as Source Code Management systems  Increase your productivity by allowing.
Lecture 2 agenda flip teaching install p4merge rename project packages review git review Android Studio (Vinny) layouts and resources java event model.
Intoduction to Andriod studio Environment With a hello world program.
INTRODUCTION TO GIT. Install Egit for eclipse Open eclipse->Help->Install New Software Search for one of the following -
Git How to 1. Why Git To resolve problems in lab exams (accidental deletions) Use existing Libraries with ease (Statistics and Computer) Prepare undergraduates.
Jake Ginnivan Git for TFS Version Control developers DEV32 4.
Installing git In Linux: sudo apt-get install git In Windows: download it from run the setuphttp://git-scm.com/download/win.
Git workflows: using multiple branches for parallel development SE-2800 Dr. Mark L. Hornick 1.
Git A distributed version control system Powerpoint credited to University of PA And modified by Pepper 28-Jun-16.
Git for bzr users October Aurélien Gâteau An attempt at making you comfortable when you have to work with a git repository.
Adam Young Presented by Senior Software Engineer, Red Hat License Licensed under PKI, Git and SVN.
Chapter 2: Simplify! The Android User Interface
Basics of GIT for developers and system administrators
Introduction to GitHub
Android Application Development gerber.cs.uchicago.edu/android/
L – Modeling and Simulating Social Systems with MATLAB
11 Version control (part 2)
Git Practice walkthrough.
Setting up Git, GitBash, and GitHub
SSE2034: System Software Experiment 3 Spring 2016
Lecture 3 agenda A tour of Android studio features
Version Control with Git and GitHub
Sign in on the attendance sheet!
Distributed Version Control with git
Akshay Narayan git up to speed with RCS Akshay Narayan
SIG: Open Week 1: GitHub Tim Choh.
Git-Github Tools Prepared for COP4331. Git-Github Tools Prepared for COP4331.
Android Developer Fundamentals V2 Lesson 1
Version Control System - Git
Git started with git: 2018 edition
Lecture 4 agenda Event Handling Fragments The Freemason Conspiracy
Git GitHub.
Introduction to The Git Version Control System
Advanced Git for Beginners
Presentation transcript:

Lecture 2 agenda Setting-up projects properly Review git config Java event model Anatomy of and Android Application Activity Lifecycle State Changes; saving and restoring state Model-View-Controller in Android Views, View Groups, Layouts A/S Designer Tool layouts and resources

git config --global user.name "Your Name" git config --global user. csgerber/proCapitalquiz3g csgerber/labLifeCycle3g

What's inside an APK

Git Review Basic Git Commands

add/reset/commit: move files from working-dir to stage-dir(aka index) git add. git add res/. git add src/. git add res/values/strings.xml move files from stage-dir(aka index) to working-dir git reset HEAD. git reset head res/. git reset head src/. git reset head res/values/strings.xml git commit -m “your commit message.”

Reverting (does the exact opposite) git revert 0da8 --no-edit git revert head --no-edit git revert head~3 --no-edit To clear all local changes since last push git reset --hard origin/master To delete a remote branch git push origin :branchName

Amending: Every commit is associated with a sha-1 hash. That hash is derived from 1/ the file changes in that commit and 2/ the previous commit. You can not change any commit unless that commit is at the head. Since no other commits depend on the head, you may safely change the head. To change the head, use git commit --amend -m “your message” git commit --amend --no-edit

Branching: To list the branches in a project: git branch git branch -r git branch --all To create a branch: git checkout -b branchName c39b git checkout -b branchName To delete a branch: git branch -D branchName To checkout a branch: git checkout 7afe git checkout master

Pushing to remotes: To see the remotes: git remote -v show To push to a remote: git push origin master git push --all To clear all local changes since last push git reset --hard origin/master

Android Studio Default keymap: File || settings || keymap

The Event Model

Event (onClick) No Event-Listener listening No Catcher Event-Source (Button) No Event Listener

Event (onClick) Event-Listener listening Catcher ready to catch Event-Source (Button) OnClick- Listener Any Object

Wrong Event

Event source not registered

Event (onClick) Event-Listener listening Catcher ready to catch OnClick- Listener Event-Source (Button) Any Object OnMouse -Listener Event (onMouse)

Resources in Android

Layouts and resources Code: Java (or C if you use NDK) Metafiles: AndroidManifest, project.properties,.gitignore. These all describe the project. Resources “anything in android that is not code or metafiles” Activities have one or more layouts, and all Layouts have a root-ViewGroup. This root-ViewGroup is the container for the Views. R.java (gen directory) is a bridge between your resources and your code. If you want to interact programmatically with a resource, it must have an id.

Inspecting layouts and resources You can view both xml and design mode in AS. You can see how it would look on multiple devices || preview all screens, and toggle with remove previews.

Layouts and resources res directories can have suffixes, such as layout-land, or drawable-hdpi, values-es, etc. These suffixes allow you to differentiate at RUNTIME depending on the settings, hardware, and configuration of the device. For example, if your device is in landscape mode, it'll try to fetch the layout from layout-land first, then it will try to fetch the layout from layout. Vice versa as well; if it's in portait mode, it'll try for layout-port, then layout. shown in preview mode of resource and rotate device

strings.xml

#eaeaea #00abd7 # #f00 #80ff0000 colors.xml #RGB #ARGB #RRGGBB #AARRGGBB

25dp 150dp 30dp 16sp dimens.xml

true true bools.xml

dp stands for density independent pixels It's relative to a 160 dpi screen. So 1dp is one pixel on a 160dpi screen. Don't worry about calculating the dp's. Android does that for you.

Add resources from the Add Resources from the graphical editor and also manually. #FFFFFF white getResources(). getStringArray(R.array.whatever)

Navigating in Android Studio alt-1 is project view (alt-F1 is show it in project view) alt-2 is favorites (including bookmarks and breakpoints) alt-3 is the search view (cntl-shift-F to find) alt-4 run-console alt-5 is debug alt-6 is android view (ddms, logcat) alt-7 is structure view (see members and methods) alt-9 is changes(VCS) view Look at the margin of your project

Get help cntl-shift-A (find anything in Android studio) Searching (on mac, replace cntrl with command) cntl-F (find something in the local file) cntl-shift-F (find something in the project) Go to file in code (on mac, replace cntrl with command) cntl-N (go to files typically in src) cntl-shift-n (go to any file, including res) cntl-E (open recent files) Go to file in project alt-F1

Go to definition cntl-B (go directly to the method definition) Javadocs cntl-Q (open the javadocs) Live Templates cntl-J adding your own Live Templates (cntl-shift-A “live template”)

Debugging Using the debugger (alt-5) See bookmarks and breakpoints (alt-2) F11 to toggle bookmark Using logcat (alt-6) Using lint and AS analyzer: Analyze || Inspect Code ///TODO this is my todo message

Lifecycle in Android

proCapitalQuiz (in class)

labLifeCycle (in class)

Layouts in Android

6/9/12

layout_margin (layout means in relation to parent) padding

6/9/12 (layout means in relation to parent)

6/9/12

weight

6/9/12 FrameLayout

6/9/12