/Android-Lecture

Basic knowledge to build an android app.

Primary LanguageJava

Android Lecture

  • This repo is built to help you understand basic use of some Android APIs.
  • Need to have basic knowledge of Java and Android first before checking the content.
  • It includes the use of
    1. Fragment (using Tab to switch between fragments)
    2. SQLite (create, retrieve, update, delete)
    3. AsyncTask

App theme is generated by Android Action Bar Style Generator.
Make sure to update your minSdkVerion with 14 in AndroidManifest.xml

Fragment

Use tabs in ActionBar to view different Fragment.
Here we use 2 tabs called '1st' and '2nd' respectively.

Fragment used the following files:

  1. src/main/activity/MainActivity.java
  2. src/main/activity/FirstFragment.java
  3. src/main/activity/SecondFragment.java
  4. res/layout/one.xml
  5. res/layout/two.xml

You can find TabListener(used for Tab in ActionBar) here.

See document here.

SQLite

  • Input a 'name' and an 'email' to CREATE a data.
  • Input a 'name' to search the data you want to UPDATE.
    Then input another 'name' which you want to update with.
  • Input a 'name' which you want to DELETE.
  • It will RETRIEVE all data and display below.

SQLite used the following files:

  1. src/main/activity/SqliteActivity.java
  2. src/main/activity/DBHelper.java
  3. res/layout/sqlite.xml

See document here.

AsyncTask

Running through 4 methods used in AsyncTask.
Each will write some text in Log and Toast (except for doInBackground method).
When the method is done and success without exception, TextView will appear with the text '(method name) finished.'.

AsyncTask used the following files:

  1. src/main/activity/AsyncTaskActivity.java
  2. res/layout/asynctask.xml

See document here