Your SlideShare is downloading. ×
Android Course - Lesson1
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Android Course - Lesson1

478
views

Published on

Lesson 1 of the Android Course by Callum Taylor …

Lesson 1 of the Android Course by Callum Taylor

Speaker notes here: https://github.com/scruffyfox/AndroidCourse/blob/Lesson-1/pdf/Lesson1-notes.pdf

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
478
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
17
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • My name is Callum Taylor I work for a company called
  • 3 SIDED CUBE. I’m the lead android developer (only because I was the only Android developer) and have been for the last 3 years.
  • This is a course that will hopefully teach you the fundamentals of Android development, mainly
  • So, why make an app?If we substitute “app” with “website” we’ll be where we were during the late 90’s. Companies asking, well why do we need a website? What is it going to bring for us?It’s very expensive, so why bother?
  • The answer is exactly the same. To get your brand/company/product out there!There is an incredible amount of users using mobile currently and that number is increasing every year, it will soon overtake computer usage. If you’re a company with a product, this is an incredible market to be tapping into.
  • Over 1 billion Android activations over the last 4 years.
  • In the last 4 years, we’ve had over 9 MILLION downloads over 7 apps. And there’s a whole bunch more that aren’t even included in this list.So this is a massive market to tap into.
  • There are many ways to develop an application nowadays, one of the most popular is using web technologies.Phone gapHTML 5/JSTitatniumjQuery mobile.Titanium may not necessarilyfit with the others because it compiles to ‘native’, but the others are all based on using Web Views, HTML and Javascript to create apps.
  • HTML Isn’t 100% bad, its actually very good at mocking up quick and dirty prototypes or proof of concepts.But it IS bad for creating an actual app that does more than just display content, and let me explain why
  • - It is slow. Especially on Android.Android as you know runs using a JVM called Dalvik. And as you may already know, java in itself, is slow. Its running on an extra layer of abstraction on top of the processor. Adding an additional layer such as Javascript, can make it *that much slower* especially when attempting to do large lists.Its expensive. Not as in cost wise, but in memory.You’re using a webview, which in Android is very memory expensive, having to deal with parsing HTML and executing heavy javascript (even vanilla JS) adds to the memory usage of your appWhen using webviews, you’re essentially changing what the user is used to.Especially if you’re making a cross platform app for iOS and Android, you’ll end up compromising on the look of the app (one way or the other, or both) which ultimately leads to a bad user experience It is VERY slowYou’ll come to understand how List Views work in Android, and when you do, you’ll see why javascript lists are slow compared to native.
  • The best way to create an Android app, or an app on any platform in this case, is to just use the tools that have been provided by the people who created the system.In Android’s case the primary framework uses Java. I say Java, its Java syntax, but the APIs are slightly different than Sun/Oracle’s java
  • We don’t like Oracle.
  • The framework also uses XML, but don’t worry, its not as bad as you may think.The framework, also has the option to use the NDK (Native development kit) which uses C++. But this is only used when creating low level things such as graphic intensive games, or image processing. You can’t create an app in C++ just because it’s a language you prefer. Unless you want to create a whole custom UI and behaviour for your app, in which case you may as well just fork Android,
  • Before we start anything, we need to make sure we’re all on the same page when it comes to understanding how an Java works, and what an Object-Orientated programming language is.
  • A very good analogy for OOP is something I learned during my Sixth form years, is the car.There are lots of different types of car, and each car has its own set of properties, much like how OOP works. Let’s brake (lol) this down.
  • A very good analogy for OOP is something I learned during my Sixth form years, is the car.There are lots of different types of car, and each car has its own set of properties, much like how OOP works. Let’s brake (lol) this down.We haveThe steering wheelTyresBrakesChassisEngine.These are all ‘properties’ of a car. Every car (I hope) has one of these properties, but the properties are slightly different for each car, such as the engine speed, tyre size, chassis colour etc. The property values are different, but the properties are still the same.
  • Let’s have a look at how that might look in Java code. Note I don’t actually use braces on the same line, I’m only doing it for compactibility sakes.You can see we have the 5 properties (currently they are just strings) of the car. We can now use this class to create different cars.
  • Here we’ve made a honda and a BMW and set what properties they have. We could do this a million times with different properties for the different types of car.
  • That was just a basic example. OOP Can become very complicated, in a good way. Say we wanted to have a motorbike, we could either create a new class with new properties, or we can find out what properties a car shares with a motorbike, and to make them share them.You can see that both have at least 2 wheels, 2 brakes, a chassis and an engine.
  • We can actually extend our object to create sub-objects. It’s worth noting that in every OOP language, *every* class extends another class. In Java, the top most class you can extend from (which is the default if you don’t provide one) is Object.You can see here that we now have 3 objects. Our automobile class contains all of the properties that a car and a bike would have. But we also have 2 sub classes which have properties specific to that type of vehicle. All properties in Automobile are available in both of the sub classes.
  • Here we can see in blue, the custom properties for that object specifically, and in orange, the inherited properties.
  • Not only can you do properties, but you can do methods/functions. They work in exactly the same way as a property.
  • The basic structure of an android app is as follows:You have your source files and your assets, assets being broken down into two main sections, drawables and layouts.
  • Or a more folder representation highlighted in blue, our basic folders. We’ll get into what the other folders mean another time.
  • For these lessons, we’re going to be using Android Studio, which is a fork of IntelliJ.Android Studio is currently in alpha release, but it is stable enough to start using.Here is your editor windowHere is your project structure windowAnd here is your debugging output window
  • Sothe most important part of android development is the Activity/context. So, what is an activity?A source file with a context which is responsible for displaying and interacting with the UI and UX of an appBut more specifically, its something that you see on your phone.
  • Here’s a visual example using the Twitter app.We can see here, this screen is an activity. It has 4 tabs which all hold different views (called fragments, we will get into this another time).When you click the menu icon and then settings, it opens another screen, the “settings” activity. This is another activity that has been opened up from the previous one.
  • (Read from above)
  • Everything highlighted in red, are views which make up this screen.Ranging from a TextView, to ImageView, to ButtonView. All have a specific job and do a specific task
  • (Read from above)The most common layouts you will be using will be Relative Layouts and Linear Layouts.A linear layout is a layout that lays its children out linearly, for example, left to right horizontally, or top to bottom vertically.A relative layout lays its children out relative to the other views, you can specify which views are laid out in relation to its surrounding, for example, making one view be to the right of another view etc.
  • Everything in red is probably a layout of some kind. I say probably because there’s a million and one ways to layout these views. My best guess would be that they have used a standard mixture of Relative Layouts and Linear Layouts.
  • What we’re going to make!
  • Transcript

    • 1. Android Lesson 1 by Callum Taylor Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 2. Introduction • All code and presentation slides can be found over at https://github.com/scruffyfox/AndroidCours e • Twitter/app.net/github: @scruffyfox • http://(blog.)callumtaylor.net Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 3. Introduction https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 4. Introduction – Who am I? Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 5. Introduction – Who am I? Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 6. Introduction – What is this? Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 7. Introduction – What is this? • How to create an app from scratch • The different technologies available + pros/cons • The different aspects of an app ranging from text views to list views Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 8. Introduction – So, why make an app? Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 9. Introduction – So, why make an app? Source: http://www.jana.com/assets/Mobile-web-vs-desktop-7-13.png Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 10. Introduction – Statistics OVER 1 BILLION Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 11. Introduction – Statistics Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 12. Introduction – Our apps Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 13. Introduction – Our apps (shameless plug) Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 14. Introduction – Ways to develop • Web technologies Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 15. Introduction – Ways to develop • Why HTML/JS is BAAAAAAAAAAAD Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 16. Introduction – Ways to develop • It‟s slow • It‟s expensive • It doesn‟t give a „native‟ feel • It‟s slow Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 17. Introduction – Ways to develop • Native Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 18. Oracle – Boo Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 19. Introduction – Ways to develop • Native Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 20. OOP – What is OOP? • Stands for Object orientated programming language • Often uses an “MVC” Style framework Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 21. OOP – What is OOP? Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 22. OOP – What is OOP? Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 23. OOP – What is OOP? Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 24. OOP – What is OOP? Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 25. OOP – What is OOP? Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 26. OOP – Extending Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 27. OOP – Extending Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 28. OOP – Methods Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 29. Android – Fundamentals Resources Source files Drawables Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 Layouts @scruffyfox
    • 30. Android – Fundamentals Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 31. Android – Fundamentals – IDE Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 32. Android – Fundamentals • An Android app is made up of Contexts, mainly Activities and Fragments, and layouts. • Layouts are made up of Views Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 33. Android – Fundamentals • What is an activity? A source file with a context which is responsible for displaying and interacting with the UI and UX of an app Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 34. Android – Fundamentals Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 35. Android – Fundamentals • What is a View? Something that is visible to the user and/or displayed on the screen which serves a specific purpose View • TextView • ImageView • Button • EditText • ListView • GridView • CheckBox • RadioButton • Spinner • VideoView • WebView • ProgressBar • ImageButton • SeekBar Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 36. Android – Fundamentals Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 37. Android – Fundamentals • What is a Layout? An extension of View which can contain one or more child views and arrange them in a specific layout ViewGroup • FrameLayout • RelativeLayout • LinearLayout • AbsoluteLayout • ScrollView (It should be ScrollLayout…) Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 38. Android – Fundamentals Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox
    • 39. Android – Demo Lesson 1 – https://github.com/scruffyfox/AndroidCourse/tree/Lesson-1 @scruffyfox