jwwallin / digit-koodikerho-android

Repository for teaching basics of Android development and environment in Digit ry's codeclub.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#Android - the basics

This is a guide through of basics Android environment. The tutorial is made for students in Digit ry's code club in the University of Turku. The README.md contains useful links to resources and guides for getting started with Android development.

The repository itself will contain a basic Android application which is structured by following various examples online and mainly using Google's Material design principles.

##Who?

My name is Sami Nieminen and I am a fourth year student in the Bachelor of Science in Technology Degree Programme in the University of Turku. I have worked with various programming technologies and frameworks besides Android like Angularjs and other libraries in MEAN-stack and with Python as well. I have worked almost a year in the Technology Research Center in Turku as an Android developer. My expertise has mainly come from books, online tutorials and blog posts. Here I try to give you guys an overview on marvelous Android. Remember that I am not an expert and don't hesitate to give any feedback about my code or my English spelling.

##What shall we do?

  1. First of all we'll learn to use Android Studio. It has plenty of great shortcuts and refactoring tools which helps developer to concentrate on thinking the logic rather than typing hundreds of lines of
  2. Few things about libraries and resource files
  3. Create application with multiple Fragments on top of one controller Activity
  4. Something something

##Android Studio shortkeys List of all Android Studio shortkeys

Can be accessed from within Android Studio: Top Toolbar -> Help -> Default Keymap Reference

Key maps with explanations (Win/Linux/Os)

###Most useful shorkeys

Key Definition
ctrl + / Comment/uncomment
ctrl + shift + / Comment/uncomment with block comment
ctrl + Q Quick documentation lookup
ctrl + alt + L Reformat code
ctrl + shift + N Search and open project file
ctrl + alt + T Surround with... (if..else, try..catch, for, synchronized, etc.)
ctrl + shift + I Quick lookup of the method
shift + F6 Rename (parameter, method, etc)

##Getting started Create new project with blank Activity

###Dependencies and libraries Inside the Project panel (usually on the left side of the view) select from the dropdown menu Android. It opens up App and Gradle Scripts. Inside App there are all project Java and XML files. Gradle Scritpsare automatically generated files and shouldn't be changed by default. Exception is when you want to add libraries to you project. External libraries can be added to the project by using Gradle.

// Include this to the build.gradle (Module: App) file
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'me.zhanghai.android.materialprogressbar:library:1.0.2'
}

These lines add nice set of support libraries to the project which basically allows programmer to create applications with new Material design components to smartphones with operating system earlier than Lollipop (Android 5.0).

###Resource files ####Colors Material design needs few certain preset colors:

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <color name="primary">#2196F3</color>
  <color name="primary_dark">#1976D2</color>
  <color name="primary_light">#BBDEFB</color>
  <color name="accent">#FFEB3B</color>
  <color name="primary_text">#212121</color>
  <color name="secondary_text">#727272</color>
  <color name="icons">#FFFFFF</color>
  <color name="divider">#B6B6B6</color>
</resources>

Material Pallette generates colors automatically.

####Strings I often use a lot of same words in my applications

<resources>
    <string name="app_name">KoodikerhoApp</string>
    <string name="cancel">Cancel</string>
    <string name="start">Start</string>
    <string name="stop">Stop</string>
    <string name="new_text">New</string>
    <string name="remove">Remove</string>
    <string name="add">Add</string>
    <string name="welcome">Welcome</string>
    <string name="getting_started">Let\'s Get Started</string>
</resources>

##Great Android resources Here are some of my favorite books and online resources that will get you started:

About

Repository for teaching basics of Android development and environment in Digit ry's codeclub.


Languages

Language:Java 100.0%