Two Android Studio Projects, Library & Application – How to link them.

Prepare two projects as follows

1. Library

LibraryProject
+ LibraryModule

2. Application

ApplicationProject
+ ApplicationModule

Set the dependency relations as follows

1. In LibraryProject

in “build.gradle” inside your LibraryModule folder,
make sure to set it as library using plugin and disable proguard

apply plugin: 'com.android.library'
:
:
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
    }
}

2. In ApplicationProject

in “settings.gradle”

include ':ApplicationModule', '..:LibraryProject:yourLibraryModule'

in “build.gradle” inside your ApplicationModule folder

apply plugin: 'com.android.application'
:
:
compile project(':..:LibraryProject:yourLibraryModule')

Reference:

http://stackoverflow.com/questions/22243269/how-to-share-a-single-library-source-across-multiple-projects

http://stackoverflow.com/questions/20117884/android-studio-app-with-library-project-fails-to-build

Fragment lifecycle

Though a Fragment’s lifecycle is tied to its owning activity, it has its own wrinkle on the standard activity lifecycle. It includes basic activity lifecycle methods such as onResume(), but also important are methods related to interactions with the activity and UI generation.
The core series of lifecycle methods that are called to bring a fragment up to resumed state (interacting with the user) are:

  1. onAttach(Activity) called once the fragment is associated with its activity.
  2. onCreate(Bundle) called to do initial creation of the fragment.
  3. onCreateView(LayoutInflater, ViewGroup, Bundle) creates and returns the view hierarchy associated with the fragment.
  4. onActivityCreated(Bundle) tells the fragment that its activity has completed its own Activity.onCreate().
  5. onViewStateRestored(Bundle) tells the fragment that all of the saved state of its view hierarchy has been restored.
  6. onStart() makes the fragment visible to the user (based on its containing activity being started).
  7. onResume() makes the fragment interacting with the user (based on its containing activity being resumed).

As a fragment is no longer being used, it goes through a reverse series of callbacks:

  1. onPause() fragment is no longer interacting with the user either because its activity is being paused or a fragment operation is modifying it in the activity.
  2. onStop() fragment is no longer visible to the user either because its activity is being stopped or a fragment operation is modifying it in the activity.
  3. onDestroyView() allows the fragment to clean up resources associated with its View.
  4. onDestroy() called to do final cleanup of the fragment’s state.
  5. onDetach() called immediately prior to the fragment no longer being associated with its activity.

* Source

http://developer.android.com/reference/android/app/Fragment.html#Lifecycle

How to implement Navigation Drawer with toolbar in Material Design

1. Simpe Github project using ActionBarActivity and v7 support library

https://developer.android.com/tools/support-library/features.html)

https://github.com/Zlate87/material-navigation-drawer-example

2. Excellent explanation about using Material Design in pre-Lollipop

http://android-developers.blogspot.com/2014/10/appcompat-v21-material-design-for-pre.html

3. Official documentation about How to use Navigation Drawer

http://developer.android.com/training/implementing-navigation/nav-drawer.html

Search screens

Collection of Search screens in Google Apps

(as of 2014-11-30, Lollipop)

Search screen: Google Calendar
Google Calendar
Search screen: Google Contact
Google Contact
Search screen: Google Drive
Google Drive
Search screen: Google Gmail
Google Gmail
Search screen: Google Inbox
Google Inbox
Search screen: Google Keep
Google Keep
Search screen: Google Map
Google Map
Search screen: Google My Maps
Google My Maps
Search screen: Newsstand
Newsstand
Search screen: Youtube
Youtube
Search screen: Zagat
Zagat
Search screen: Google Play
Google Play

Navigation Drawers

Collection of Navigation Drawers in Google Apps

(as of 2014-11-25, Lollipop)

Navigation Drawer:  Google Zagat as of 2014-11-30
Zagat 
Navigation Drawer:  Google Calendar as of 2014-11-30
Google Calendar 
Navigation Drawer:  Google Drive as of 2014-11-30
 Google Drive 
Navigation Drawer:  Google Earth as of 2014-11-30
Google Earth 
Navigation Drawer:  Google Gmail as of 2014-11-30
Google Gmail 
Navigation Drawer:  Google Hangout as of 2014-11-30
Google Hangout 
Navigation Drawer:  Google Keep as of 2014-11-30
 Google Keep
Navigation Drawer:  Google News as of 2014-11-30
 Google News
Navigation Drawer:  Google Newsstand as of 2014-11-30
Google Newsstand
Navigation Drawer:  Google One as of 2014-11-30
Google One 
Navigation Drawer: Google Play as of 2014-11-30
Google Play
Navigation Drawer: Youtube
 Youtube