0% found this document useful (0 votes)
78 views

3.3 Using The Android Support Libraries

This document provides an overview of the Android support libraries, which include more than 25 libraries that provide backward-compatible versions of Android components and additional features. It discusses what support libraries are, their main features like backward compatibility and additional UI elements, and how to set them up in an Android project by adding dependencies to the build.gradle file.

Uploaded by

Anser Pasha
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views

3.3 Using The Android Support Libraries

This document provides an overview of the Android support libraries, which include more than 25 libraries that provide backward-compatible versions of Android components and additional features. It discusses what support libraries are, their main features like backward compatibility and additional UI elements, and how to set them up in an Android project by adding dependencies to the build.gradle file.

Uploaded by

Anser Pasha
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Android Developer Fundamentals

Testing and
Debugging, and
Backwards
Compatibility

Lesson 3

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 1
mmercial 4.0 International License
3.3 The Android Support
Libraries

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 2
mmercial 4.0 International License
Contents

● What are the Android support libraries?


● Features
● Selected Libraries
● Setting up and using support libraries

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 3
mmercial 4.0 International License
What are the Android support libraries?

● More than 25 libraries in the Android SDK that provide


features not built into the Android framework

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 4
mmercial 4.0 International License
Features

Android Developer Fundamentals 5


Support library features
Support libraries provide:
● Backward-compatible versions of components
● Additional Layout and UI elements, such as RecyclerView
● Different form factors, such as TV, wearables
● Material design and other new UI components for older
Android versions
● and more….
This work is licensed under a
Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 6
mmercial 4.0 International License
Backward compatibility

Always use the the support library version of a component if


one is available
● No need to create different app versions for different
versions of Android
● System picks the best version of the component

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 7
mmercial 4.0 International License
Support libraries versions

● Libraries for Android 2.3 (API level 9) and higher


● Recommended you include the v4 support and
v7 appcompat libraries for the features your app uses

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 8
mmercial 4.0 International License
Libraries

Android Developer Fundamentals 9


v4 Support Libraries

● Largest set of APIs


● App components, UI features
● Data Handling
● Network connectivity
● Programming utilities

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 10
mmercial 4.0 International License
v4 Support Libraries

● compat—compatibility wrappers
● core-utils—utility classes (eg., AsyncTaskLoader)
● core-ui—variety of UI components
● media-compat—back ports of media framework
● fragment—UI component

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 11
mmercial 4.0 International License
v7 Support Libraries
● Backwards compatibility
● TV-specific components
● UI components and layouts
● Google Cast support
● Color palette
● Preferences
This work is licensed under a
Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 12
mmercial 4.0 International License
v7 Support Libraries
● appcompat—compatibility wrappers
● cardview— new UI component (material design)
● gridlayout—rectangular cell (matrix) Layout
● mediarouter—route A/V streams
● palette—extracting color from an image
● recyclerview—efficient scrolling view
● preference—modifying UI settings
This work is licensed under a
Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 13
mmercial 4.0 International License
v7 appcompat library

● ActionBar and sharing actions


● You should always include this library and make
AppCompatActivity the parent of your activities
com.android.support:appcompat-v7:24.2.1

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 14
mmercial 4.0 International License
Complete list of libraries

● … and many more


● For latest libraries and versions of libraries
○ Support Library Features documentation
○ API Reference (all packages that start with android.support)

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 15
mmercial 4.0 International License
Using
Android Support
Libraries

Android Developer Fundamentals 16


Support libraries

● Part of Android SDK and available through SDK Manager


● In Android Studio, locally stored in Android Support
Repository
● Include in build.gradle of module to use with your project

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 17
mmercial 4.0 International License
Start SDK Manager in Android Studio

1. Tools > Android > SDK Manager

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 18
mmercial 4.0 International License
Find the Android Support Library
1. SDK Tools tab
2. Find Android Support Repository
3. Must be Installed

If Not Installed or Update Available


4. Check checkbox and Apply
5. In dialog, confirm components
and click OK to install
6. When done, click Finish
7. Verify that it is Installed now

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 19
mmercial 4.0 International License
Find the dependency identifier
1. Open Support Library Features page
2. Find the feature you want
○ For example, the recommended v7 appcompat library
3. Copy the build script dependency identifier for the library
○ com.android.support:appcompat-v7:24.2.1

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 20
mmercial 4.0 International License
Add dependency to build.gradle
1. open build.gradle (Module: app)
2. In the dependencies section, add a dependency
for the support library
○ compile 'com.android.support:appcompat-v7:24.2.0'

3. Update the version number, if prompted


4. Sync Now when prompted

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 21
mmercial 4.0 International License
Updated build.gradle (Module: app)

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
}

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 22
mmercial 4.0 International License
Learn more
● Android Support Library (introduction)
● Support Library Setup
● Support Library Features
● API Reference (all packages that start with android.support

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 23
mmercial 4.0 International License
What's Next?

● Concept Chapter: 3.3 C The Android Support Library


● Practical: 3.3 P Using the Android Support Libraries

This work is licensed under a


Android Developer Fundamentals Support Libraries Creative Commons Attribution-NonCo 24
mmercial 4.0 International License
END

Android Developer Fundamentals 25

You might also like