Loaders


 

  1. Loader
  2. CursorLoader
  3. AsyncTaskLoader
  4. AsyncTaskLoader Cache and Data Changes
  5. AsyncTaskLoader Network Request

 

1. Loader

Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.

Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open src -> package -> Create new class, CustomListAdapter.java and add following code :

Step 5 : Open src -> package -> Create new class, MainActivity.java and add following code :

Step 6 : Open AndroidManifest.xml and add following code :

Step 7 : Open build.gradle(Module: app) and add following code :

ScreenShot:

 using loader

Download SourceCode

 

 

2. CursorLoader

Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.

Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open src -> package -> Create new class, MyProvider.java and add following code :

Step 5 : Open src -> package -> Create new class, DatabaseHelper.java and add following code :

Step 6 : Open AndroidManifest.xml and add following code :

Step 7 : Open build.gradle(Module: app) and add following code :

ScreenShot:

 using cursorloader

Download SourceCode

 

 

3. AsyncTaskLoader

Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.

Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open src -> package -> Create new class, MainActivity.java and add following code :

Step 5 : Open src -> package -> Create new class, MainActivity.java and add following code :

Step 6 : Open AndroidManifest.xml and add following code :

Step 7 : Open build.gradle(Module: app) and add following code :

ScreenShot:

using asynctaskloader

Download SourceCode

 

 

4. AsyncTaskLoader Cache and Data Changes

Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.

Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open src -> package -> Create new class, MainActivity.java and add following code :

Step 5 : Open src -> package -> Create new class, MainActivity.java and add following code :

Step 6 : Open AndroidManifest.xml and add following code :

Step 7 : Open build.gradle(Module: app) and add following code :

ScreenShot:

 asynctaskloader_cacheasynctaskloader_cache2asynctaskloader_cache3

Download SourceCode

 

 

5. AsyncTaskLoader Network Request

Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.

Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open src -> package -> Create new class, CustomListAdapter.java and add following code :

Step 5 : Open src -> package -> Create new class, NetworkCallLoader.java and add following code :

Step 6 : Open AndroidManifest.xml and add following code :

Step 7 : Open build.gradle(Module: app) and add following code :

ScreenShot:

asynctaskloader_network callbacks

Download SourceCode