Welcome to Android Workshop

 

  1. Android Studio 2.3.3https://developer.android.com/studio/index.html
  2. Oracle-JDK8
    http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
  3. Android Platform API 26
    Use android-studio to install

 

 

 

Prerequisite 

Head over to this link to download the boilerplate

https://github.com/sunwaytechclub/AndroidWorkshop-Boilerplate

What will we achieve today?

In an Android Activity 

MainActivity.java

activity_main.xml

When you click on the + button

MainActivity.java

InputToDo.java

Alert Dialog

Android Activity Lifecycle

linear layout

To Navigate to other activity

  • We can start an activity by sending an Intent to Android
Intent intent= new Intent (MainActivity.this , InputToDo.class)
startActivity(intent)

Why do we need ListView?

  • To Display a List of scrollable items

How do ListView work?

Many would assume that the data is directly binded to the listview

The right way

  • The data do not know where to go!!
  • The adapter will bind the data source to the listview
  • The adapter converts an array item into a String object and putting it into a TextView. The TextView is then displayed in the ListView.

 

Table Visualization 

ID Name Done
1 Do Assignment 0 --> means not done
2 Wash Hair 1 --> Done
3 Exercise 0

To save data offline in Android

  • Shared Preferences

  • Internal Storage

  • External Storage

  • SQLite Database

  • Network Connection

SQLite Database

  • Lightweight
  • Optimized for a single user
  • Stable and fast

Each database contains of two files

  1.  Database file - all data is stored in this file
  2.  Journal file - Contains all the changes made to your database

To use a SQLite Database, we need a

  • SQLiteHelper
    • Helps to create and manage database
  • SQLiteDatabase
    • Gives access to the database
  • Cursors
    • Lets you read from and write to the database
Made with Slides.com