Chapters
39 ACRA
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
Table Of Contents
Getting started with Android
Creating a New Project
Setting up Android Studio
Android programming without an IDE
Filtering the logcat output
Application Fundamentals
Logging
Setting up an AVD Android Virtual Device
Working with strings.xml file
Layouts
LayoutParams
Gravity and layout gravity
CoordinatorLayout Scrolling Behavior
BottomSheetBehavior like Google maps
Percent Layouts
View Weight
Creating LinearLayout programmatically
LinearLayout
RelativeLayout
GridLayout
FrameLayout
CoordinatorLayout
Gradle for Android
A basic build.gradle file
Define and use Build Configuration Fields
Centralizing dependencies via dependencies.gradle file
Sign APK without exposing keystore password
Adding product flavor-specific dependencies
Specifying different application IDs for build types and product flavors
Versioning your builds via version.properties file
Defining product flavors
Changing output apk name and add version name
Adding product flavor-specific resources
Why are there two build.gradle files in an Android Studio project
Directory structure for flavor-specific resources
Enable Proguard using gradle
Ignoring build variant
Seeing dependency tree
Enable experimental NDK plugin support for Gradle and AndroidStudio
Display signing information
Executing a shell script from gradle
Show all gradle project tasks
Delete unaligned apk automatically
Disable image compression for a smaller APK file size
Debugging your Gradle errors
Use gradle.properties for central versionnumberbuildconfigurations
Defining build types
RecyclerView onClickListeners
Kotlin and RxJava example
RecyclerView Click listener
Another way to implement Item Click Listener
New Example
Easy OnLongClick and OnClick Example
Item Click Listeners
NavigationView
How to add the NavigationView
Add underline in menu elements
Add seperators to menu
Add menu Divider using default DividerItemDecoration.
Intent
Getting a result from another Activity
Passing data between activities
Open a URL in a browser
Starter Pattern
Clearing an activity stack
Start an activity
Open Google Play Store Listing for your app
Pass data from Activity to Fragment using Bundle
Sending emails
CustomTabsIntent for Chrome Custom Tabs
Intent URI
Start the dialer
Broadcasting Messages to Other Components
Passing custom object between activities
Share intent
Passing different data through Intent in Activity
Open Google map with specified latitude longitude
Showing a File Chooser and Reading the Result
Open Google Play Store with the list of all applications from your publisher account
Sharing Multiple Files through Intent
Start Unbound Service using an Intent
Implicit and Explicit Intents
Getting a result from Activity to Fragment
JSON in Android with org.json
Creating a simple JSON object
Create a JSON String with null value.
Parsing JSON with Gson
Add JSONArray to JSONObject
Parse simple JSON object
Parsing a ListString with Gson
Check for the existence of fields on JSON
Create nested JSON object
Parsing JSON to Generic Class Object with Gson
Parsing JSON property to enum with Gson
Using JsonReader to read JSON from a stream
Working with null-string when parsing json
Handling dynamic key for JSON response
Parsing json array to generic class using Gson
Custom JSON Deserializer using Gson
JSON SerializationDeserialization with AutoValue and Gson
Updating the elements in the JSON
Android Studio
Setup Android Studio
View And Add Shortcuts in Android Studio
Filter logs from UI
Custom colors of logcat message based on message importance
EnableDisable blank line copy
Android Studio useful shortcuts
Android Studio Improve performance tip
Create filters configuration
Gradle build project takes forever
Create assets folder
Resources
Define colors
Color TransparencyAlpha Level
Define strings
Define String Plurals
Define dimensions
Define integer array
Define a color state list
Getting resources without deprecated warnings
Patches
String formatting in strings.xml
Working with strings.xml file
Define a menu resource and use it inside ActivityFragment
Define integers
Define string array
Import array of objects defined in resources
Translate a string
Data Binding Library
Basic text field binding
Built-in two-way Data Binding
Custom event using lambda expression
Default value in Data Binding
Binding with an accessor method
Databinding in Dialog
Databinding in Fragment
Data binding in RecyclerView Adapter
Click listener with Binding
Referencing classes
DataBinding with custom variablesintboolean
Pass widget as reference in BindingAdapter
Exceptions
ActivityNotFoundException
NetworkOnMainThreadException
OutOfMemoryError
DexException
UncaughtException
Registering own Handler for unexpected exceptions
Getting Calculated View Dimensions
Calculating initial View dimensions in an Activity
AsyncTask
Basic Usage
Pass Activity as WeakReference to avoid memory leaks
Download Image using AsyncTask in Android
Canceling AsyncTask
AsyncTask Serial Execution and Parallel Execution of Task
Publishing progress
Order of execution
SharedPreferences
Implementing a Settings screen using SharedPreferences
Commit vs. Apply
Read and write values to SharedPreferences
Retrieve all stored entries from a particular SharedPreferences file
Reading and writing data to SharedPreferences with Singleton
Store Retrieve Remove and Clear Data from SharedPreferences
Listening for SharedPreferences changes
getPreferencesint VS getSharedPreferencesString int
Different ways of instantiating an object of SharedPreferences
Supported data types in SharedPreferences
Removing keys
Add filter for EditTextPreference
Support pre-Honeycomb with StringSet
Emulator
Taking screenshots
Open the AVD Manager
Simulate call
Resolving Errors while starting emulator
Material Design
Adding a Toolbar
Buttons styled with Material Design
Adding a FloatingActionButton FAB
RippleDrawable
Adding a TabLayout
Bottom Sheets in Design Support Library
Apply an AppCompat theme
Add a Snackbar
Add a Navigation Drawer
How to use TextInputLayout
Adding Material Design AlertDialog to your app using Appcompat
Lint Warnings
Using tools ignore in xml files
Configure LintOptions with gradle
Configuring lint checking in Java and XML source files
Importing resources without Deprecated error
How to configure the lint.xml file
Mark Suppress Warnings
Service
Lifecycle of a Service
Defining the process of a service
Creating an unbound service
Starting a Service
Creating Bound Service with help of Binder
Creating an IntentService
Creating Remote Service via AIDL
Storing Files in Internal External Storage
Android Internal and External Storage - Terminology Clarification
Using External Storage
Using Internal Storage
Save Database on SD Card Backup DB on SD
Fetch Device Directory
WebView
Troubleshooting WebView by printing console messages or by remote debugging
Communication from Javascript to Java Android
Communication from Java to Javascript
JavaScript alert dialogs in WebView - How to make them work
Open dialer example
Open Local File Create dynamic content in Webview
Project SDK versions
Defining project SDK versions
RecyclerView
Adding a RecyclerView
Smoother loading of items
RecyclerView with DataBinding
Animate data change
Popup menu with recyclerView
Adding header view to recyclerview with gridlayout manager
Filter items inside RecyclerView with a SearchView
Using several ViewHolders with ItemViewType
Add headerfooter to a RecyclerView
Drag Drop and Swipe with RecyclerView
Show default view till items load or when data is not available
Endless Scrolling in Recycleview.
Add divider to RecyclerView
Add divider lines to RecyclerView items
GridLayoutManager with dynamic span count
Per-item margins with ItemDecoration
Another way to implement Item Click Listener
Simple list with LinearLayoutManager
StaggeredGridLayoutManager
Item Click Listeners
Google Maps API v2 for Android
Custom Google Map Styles
Default Google Map Activity
Show Current Location in a Google Map
Adding markers to a map
MapView embedding a GoogleMap in an existing layout
Obtaining the SH1-Fingerprint of your certificate keystore file
Do not launch Google Maps when the map is clicked lite mode
UISettings
Get debug SHA1 fingerprint
InfoWindow Click Listener
Change Offset
PorterDuff Mode
Creating a PorterDuff ColorFilter
Creating a PorterDuff XferMode
Apply a radial mask vignette to a bitmap using PorterDuffXfermode
9-Patch Images
Basic rounded corners
Basic spinner
Optional padding lines
Android NDK
How to log in ndk
Building native executables for Android
How to call functions in a native library via the JNI interface
How to clean the build
How to use a makefile other than Android.mk
RecyclerView Decorations
Drawing a Separator
Add divider to RecyclerView
How to add dividers using and DividerItemDecoration
Per-item margins with ItemDecoration
ItemOffsetDecoration for GridLayoutManager in RecycleView
Camera 2 API
Preview the main camera in a TextureView
ViewPager
ViewPager with a dots indicator
Basic ViewPager usage with fragments
ViewPager with PreferenceFragment
Adding a ViewPager
ViewPager with TabLayout
Setup OnPageChangeListener
CardView
Getting Started with CardView
Adding Ripple animation
Customizing the CardView
Using Images as Background in CardView Pre-Lollipop device issues
Animate CardView background color with TransitionDrawable
HttpURLConnection
Creating an HttpURLConnection
Sending an HTTP GET request
Reading the body of an HTTP GET request
Sending an HTTP POST request with parameters
Use HttpURLConnection for multipartform-data
Upload POST file using HttpURLConnection
A multi-purpose HttpURLConnection class to handle all types of HTTP requests
SQLite
onUpgrade method
Reading data from a Cursor
Using the SQLiteOpenHelper class
Insert data into database
Bulk insert
Create a Contract Helper and Provider for SQLite in Android
Performing a Transaction
Delete rows from the table
Create Database from assets folder
Updating a row in a table
Store image into SQLite
Exporting and importing a database
ADB Android Debug Bridge
Connect ADB to a device via WiFi
Granting revoking API 23 permissions
Send text key pressed and touch events to Android Device via ADB
Direct ADB command to specific device in a multi-device setting
List packages
Taking a screenshot and video for kitkat only from a device display
Recording the display
Print verbose list of connected devices
Pull push files from to the device
View logcat
Clear application data
View and pull cache files of an app
View available devices
View an apps internal data datadatasample.package.id on a device
Connect device by IP
Sending broadcast
Install and run an application
Backup
Open Developer Options
Install ADB on Linux system
Set DateTime via adb
List all permissions that require runtime grant from users on Android 6.0
Turn onoff Wifi
View activity stack
Read device information
Startstop adb
Changing file permissions using chmod command
Uninstall an app
Print application data
Generating a Boot Complete broadcast
Reboot device
View externalsecondary storage content
Install all apk file in directory
Install an app
ButterKnife
Configuring ButterKnife in your project
Unbinding views in ButterKnife
Binding Listeners using ButterKnife
Android Studio ButterKnife Plugin
Binding Views using ButterKnife
Supporting Screens With Different Resolutions Sizes
Using configuration qualifiers
Converting dp and sp to pixels
Text size and different android screen sizes
Glide
Loading an image
Add Glide to your project
Glide circle transformation Load image in a circular ImageView
Default transformations
Glide rounded corners image with custom Glide target
Placeholder and Error handling
Preloading images
Handling Glide image load failed
Load image in a circular ImageView without custom transformations
Retrofit2
A Simple GET Request
Retrofit2 with RxJava
Add logging to Retrofit2
Debugging with Stetho
A simple POST request with GSON
Upload multiple file using Retrofit as multipart
Download a file from Server using Retrofit2
Retrofit with OkHttp interceptor
Header and Body an Authentication Example
Uploading a file via Multipart
Retrofit 2 Custom Xml Converter
Reading XML form URL with Retrofit 2
Dialog
Adding Material Design AlertDialog to your app using Appcompat
A Basic Alert Dialog
Alert Dialog
Custom Alert Dialog with EditText
DatePickerDialog
DatePicker
ListView in AlertDialog
Alert Dialog with Multi-line Title
Date Picker within DialogFragment
Fullscreen Custom Dialog with no background and no title
ACRA
ACRAHandler
Example manifest
Installation
GreenDAO
Helper methods for SELECT INSERT DELETE UPDATE queries
Creating an Entity with GreenDAO 3.X that has a Composite Primary Key
Getting started with GreenDao v3.X
Formatting Strings
Spannable TextView
Format a string resource
Strikethrough TextView
Formatting data types to String and vise versa
Format a timestamp to string
Textview with different Textsize
Notifications
Heads Up Notification with Ticker for older devices
Creating a simple Notification
Set custom notification - show full content text
Dynamically getting the correct pixel size for the large icon
Setting Different priorities in notification
Scheduling notifications
Set custom notification icon using Picasso library.
Ongoing notification with Action button
AlarmManager
How to Cancel an Alarm
Creating exact alarms on all Android versions
API23 Doze mode interferes with AlarmManager
Run an intent at a later time
Fragments
Pass data from Activity to Fragment using Bundle
The newInstance pattern
Navigation between fragments using backstack and static fabric pattern
Sending events back to an activity with callback interface
Animate the transition between fragments
Communication between Fragments
Handler
HandlerThreads and communication between Threads
Use Handler to create a Timer similar to javax.swing.Timer
Using a Handler to execute code after a delayed amount of time
Stop handler from execution
Creating Custom Views
Creating Custom Views
Adding attributes to views
CustomView performance tips
Creating a compound view
Compound view for SVGVectorDrawable as drawableRight
Make View with rounded corners
Responding to Touch Events
BroadcastReceiver
Using LocalBroadcastManager
BroadcastReceiver Basics
Introduction to Broadcast receiver
Sticky Broadcast
Enabling and disabling a Broadcast Receiver programmatically
Using ordered broadcasts
BroadcastReceiver to handle BOOT COMPLETED events
Example of a LocalBroadcastManager
Communicate two activities through custom Broadcast receiver
Bluetooth Broadcast receiver
Android stopped state
Activity
Activity launchMode
Exclude an activity from back-stack history
Android Activity LifeCycle Explained
End Application with exclude from Recents
Presenting UI with setContentView
Clear your current Activity stack and launch a new Activity
Up Navigation for Activities
Snackbar
Creating a simple Snackbar
Custom Snack Bar
Snackbar with Callback
Custom Snackbar
Snackbar vs Toasts Which one should I use
Custom Snackbar no need view
Runtime Permissions in API-23
Android 6.0 multiple permissions
Multiple Runtime Permissions From Same Permission Groups
Enforcing Permissions in Broadcasts URI
Using PermissionUtil
Include all permission-related code to an abstract base class and extend the activity of this base class to achieve cleanerreusable code
Logging and using Logcat
Filtering the logcat output
Logging
Using the Logcat
Log with link to source directly from Logcat
Generating Logging code
Android Studio usage
Clear logs
VectorDrawable and AnimatedVectorDrawable
Basic VectorDrawable
group tags
Basic AnimatedVectorDrawable
Using clip-path
Using Strokes
Vector compatibility through AppCompat
Tools Attributes
Designtime Layout Attributes
Toast
Creating a custom Toast
Set position of a Toast
Showing a Toast Message
Show Toast Message Above Soft Keyboard
Thread safe way of displaying Toast Application Wide
Thread safe way of displaying a Toast Message For AsyncTask
Interfaces
Custom Listener
Basic Listener
Animators
TransitionDrawable animation
Fade inout animation
ValueAnimator
Expand and Collapse animation of View
ObjectAnimator
ViewPropertyAnimator
Shake animation of an ImageView
Location
Fused location API
Get Address From Location using Geocoder
Requesting location updates using LocationManager
Requesting location updates on a separate thread using LocationManager
Register geofence
Getting location updates in a BroadcastReceiver
Theme Style Attribute
Define primary primary dark and accent colors
Multiple Themes in one App
Navigation Bar Color API 21
Use Custom Theme Per Activity
Light Status Bar API 23
Use Custom Theme Globally
Overscroll Color API 21
Translucent Navigation and Status Bars API 19
Theme inheritance
Theme and Style customization
Ripple Color API 21
The Manifest File
Declaring Components
Declaring permissions in your manifest file
Parcelable
Making a custom object Parcelable.
Parcelable object containing another Parcelable object
Using Enums with Parcelable
MediaPlayer
Basic creation and playing
Media Player with Buffer progress and play position
Asynchronous prepare
Getting system ringtones
Getting and setting system volume
Import audio into androidstudio and play it
Multidex and the Dex Method Limit
Enabling Multidex
Multidex by extending Application
Multidex by extending MultiDexApplication
Multidex by using MultiDexApplication directly
Counting Method References On Every Build Dexcount Gradle Plugin
Data Synchronization with Sync Adapter
Dummy Sync Adapter with Stub Provider
Menu
Options menu with dividers
Apply custom font to Menu
Creating a Menu in an Activity
Instant Run in Android Studio
Enabling or disabling Instant Run
Types of code Swaps in Instant Run
Unsupported code changes when using Instant Run
Picasso
Adding Picasso Library to your Android Project
Circular Avatars with Picasso
Placeholder and Error Handling
Re-sizing and Rotating
Disable cache in Picasso
Using Picasso as ImageGetter for Html.fromHtml
Loading Image from external Storage
Downloading image as Bitmap using Picasso
Cancelling Image Requests using Picasso
Try offline disk cache first then go online and fetch the image
Bluetooth and Bluetooth LE API
Permissions
Check if bluetooth is enabled
Make device discoverable
Find nearby Bluetooth Low Energy devices
Find nearby bluetooth devices
Connect to Bluetooth device
RoboGuice
Simple example
Installation for Gradle Projects
ContentView annotation
InjectResource annotation
InjectView annotation
Introduction to RoboGuice
Memory Leaks
Avoid leaking Activities with AsyncTask
Common memory leaks and how to fix them
Detect memory leaks with the LeakCanary library
Anonymous callback in activities
Activity Context in static classes
Avoid leaking Activities with Listeners
Avoid memory leaks with Anonymous Class Handler Timer Task Thread
Universal Image Loader
Basic usage
Initialize Universal Image Loader
Volley
Using Volley for HTTP requests
Basic StringRequest using GET method
Adding custom design time attributes to NetworkImageView
Request JSON
Adding custom headers to your requests e.g. for basic auth
Remote server authentication using StringRequest through POST method
Cancel a request
Helper Class for Handling Volley Errors
Boolean variable response from server with json request in volley
Use JSONArray as request body
Widgets
Manifest Declaration -
Metadata
AppWidgetProvider Class
Two widgets with different layouts declaration
CreateIntegrate Basic Widget using Android Studio
Date and Time Pickers
DatePickerDialog
DatePicker
Date Picker within DialogFragment
Material DatePicker
Date Picker Dialog
Integrate Google Sign In
Google Sign In with Helper class
In-app Billing
Consumable In-app Purchases
Third party In-App v3 Library
FloatingActionButton
How to add the FAB to the layout
Show and Hide FloatingActionButton on Swipe
Show and Hide FloatingActionButton on Scroll
Setting behaviour of FloatingActionButton
ContentProvider
Implementing a basic content provider class
Dagger 2
Component setup for Application and Activity injection
Custom Scopes
Constructor Injection
Using Subcomponent instead of Componentdependencies ...
How to add Dagger 2 in build.gradle
Creating a component from multiple modules
Realm
Sorted queries
Using Realm with RxJava
Basic Usage
List of primitives RealmListIntegerString...
Async queries
Adding Realm to your project
Realm Models
try-with-resources
Unit testing in Android with JUnit
Creating Local unit tests
Moving Business Logic Out of Android Componenets
Getting started with JUnit
Exceptions
Static import
Android Versions
Checking the Android Version on device at runtime
Wi-Fi Connections
Connect with WEP encryption
Connect with WPA2 encryption
Scan for access points
SensorManager
Decide if your device is static or not using the accelerometer
Retrieving sensor events
Sensor transformation to world coordinate system
Localization with resources in Android
Configuration types and qualifier names for each folder under the res directory
Currency
Adding translation to your Android app
Type of resource directories under the res folder
Change locale of android application programatically
ProgressBar
Material Linear ProgressBar
Tinting ProgressBar
Customized progressbar
Creating Custom Progress Dialog
Indeterminate ProgressBar
Determinate ProgressBar
Custom Fonts
Working with fonts in Android O
Custom font in canvas text
Custom font to whole activity
Using a custom font in a TextView
Apply font on TextView by xml Not required Java code
Efficient Typeface loading
Putting a custom font in your app
Initializing a font
Vibration
Getting Started with Vibration
Vibrate Indefinitely
Vibration Patterns
Stop Vibrate
Vibrate for one time
Google Awareness APIs
Get changes for location within a certain range using Fence API
Get current location using Snapshot API
Get changes in user activity with Fence API
Get headphone state with Snapshot API
Get nearby places using Snapshot API
Get current weather using Snapshot API
Get current user activity using Snapshot API
Text to SpeechTTS
Text to Speech Base
TextToSpeech implementation across the APIs
UI Lifecycle
Saving data on memory trimming
Spinner
Adding a spinner to your activity
Basic Spinner Example
Data EncryptionDecryption
AES encryption of data using password in a secure way
Testing UI with Espresso
Overall Espresso
Espresso simple UI test
Open Close DrawerLayout
Performing an action on a view
Finding a view with onView
Set Up Espresso
Create Espresso Test Class
Up Navigation
Group a collection of test classes in a test suite
Espresso custom matchers
Writing UI tests - Android
Espresso simple UI test
MockWebServer example
IdlingResource
Espresso custom matchers
GreenRobot EventBus
Passing a Simple Event
Receiving Events
Sending Events
Creating an Event object
OkHttp
Basic usage example
Logging interceptor
Setting up OkHttp
Rewriting Responses
Synchronous Get Call
Asynchronous Get Call
Posting form parameters
Posting a multipart request
Enhancing Android Performance Using Icon Fonts
How to integrate Icon fonts
TabLayout with icon fonts
Handling Deep Links
Retrieving query parameters
Simple deep link
Multiple paths on a single domain
Multiple domains and multiple paths
Both http and https for the same domain
Using pathPrefix
Canvas drawing using SurfaceView
SurfaceView with drawing thread
Firebase
Add Firebase to Your Android Project
Updating a Firebase userss email
Create a Firebase user
Change Password
How to report an error
Firebase Cloud Messaging
Firebase Storage Operations
Re-Authenticate Firebase user
Send Firebase password reset email
Sign In Firebase user with email and password
Firebase Realtime Database how to setget data
Demo of FCM based notifications
How to add Firebase Crash Reporting to your app
Firebase Sign Out
Crash Reporting Tools
Fabric - Crashlytics
Capture crashes using Sherlock
Crash Reporting with ACRA
Force a Test Crash With Fabric
Check Internet Connectivity
Check if device has internet connectivity
How to check network strength in android
How to check network strength
Facebook SDK for Android
How to add Facebook Login in Android
A minimalistic guide to Facebook loginsignup implementation
Create your own custom button for Facebook login
Setting permissions to access data from the Facebook profile
Logging out of Facebook
Unzip File in Android
Unzip file
Android Places API
Place Picker Usage Example
Getting Current Places by Using Places API
Place Autocomplete Integration
Adding more than one google auto complete activity.
Setting place type filters for PlaceAutocomplete
Creating your own libraries for Android applications
Create a library available on Jitpack.io
Creating library project
Using library in project as a module
Gson
Parsing JSON with Gson
Adding a custom Converter to Gson
Parsing a ListString with Gson
Adding Gson to your project
Parsing JSON to Generic Class Object with Gson
Parsing JSON property to enum with Gson
JSON SerializationDeserialization with AutoValue and Gson
Using Gson to load a JSON file from disk.
Using Gson as serializer with Retrofit
Custom JSON Deserializer using Gson
Parsing json array to generic class using Gson
Using Gson with inheritance
Device Display Metrics
Get the screens pixel dimensions
Get screen density
Formula px to dp dp to px conversation
TextView
Spannable TextView
Make RelativeSizeSpan align to top
TextView with image
Strikethrough TextView
Pinchzoom on TextView
Textview with different Textsize
Theme and Style customization
TextView customization
Single TextView with two different colors
ListView
Custom ArrayAdapter
A basic ListView with an ArrayAdapter
Filtering with CursorAdapter
Building Backwards Compatible Apps
How to handle deprecated API
Loader
Basic AsyncTaskLoader
AsyncTaskLoader with cache
Reloading
Pass parameters using a Bundle
ProGuard - Obfuscating and Shrinking your code
Rules for some of the widely used Libraries
Remove trace logging and other statements at build time
Protecting your code from hackers
Enable ProGuard for your build
Enabling ProGuard with a custom obfuscation configuration file
Detect Shake Event in Android
Shake Detector in Android Example
Using Seismic shake detection
Typedef Annotations IntDef StringDef
IntDef Annotations
Combining constants with flags
Capturing Screenshots
Capturing Screenshot via Android Studio
Capturing Screenshot via ADB and saving directly in your PC
Taking a screenshot of a particular view
Capturing Screenshot via Android Device Monitor
Capturing Screenshot via ADB
MVP Architecture
Login example in the Model View Presenter MVP pattern
Simple Login Example in MVP
Orientation Changes
Saving and Restoring Activity State
Retaining Fragments
Manually Managing Configuration Changes
Handling AsyncTask
Saving and Restoring Fragment State
Lock Screens rotation programmatically
Locking Screen Orientation
Xposed
Creating a Xposed Module
Hooking a method
Security
Verifying App Signature - Tamper Detection
PackageManager
Retrieve application version
Version name and version code
Install time and update time
Utility method using PackageManager
ImageView
Set tint
Set alpha
Set Scale Type
Set Image Resource
ImageView ScaleType - CenterInside
ImageView ScaleType - FitStart and FitEnd
ImageView ScaleType - FitCenter
ImageView ScaleType - Center
ImageView ScaleType - CenterCrop
ImageView ScaleType - FitXy
MLRoundedImageView.java
Gesture Detection
Swipe Detection
Basic Gesture Detection
Doze Mode
Whitelisting an Android application programmatically
Exclude app from using doze mode
Android Sound and Media
Play sounds via SoundPool
How to pick image and video for api 19
SearchView
Appcompat SearchView with RxBindings watcher
SearchView in Toolbar with Fragment
Setting Theme for SearchView
Camera and Gallery
Taking full-sized photo from camera
Take photo
How to start camera or gallery and save camera result to storage
Set camera resolution
Decode bitmap correctly rotated from the uri fetched with the intent
Callback URL
Callback URL example with Instagram OAuth
Twitter APIs
Creating login with twitter button and attach a callback to it
SqlCipher integration
Integration of code
Drawables
Tint a drawable
Custom Drawable
Circular View
Make View with rounded corners
Colors
Color Manipulation
ConstraintLayout
Adding ConstraintLayout to your project
Chains
RenderScript
Getting Started
Blur a View
Blur an image
Fresco
Getting Started with Fresco
Using OkHttp 3 with Fresco
JPEG Streaming with Fresco using DraweeController
Swipe to Refresh
Endless Scrolling in Recycleview.
How to add Swipe-to-Refresh To your app
Swipe To Refresh with RecyclerView
AutoCompleteTextView
AutoComplete with CustomAdapter ClickListener and Filter
Simple hard-coded AutoCompleteTextView
Installing apps with ADB
Uninstall an app
Install all apk file in directory
Install an app
IntentService
Creating an IntentService
Basic IntentService Example
Sample Intent Service
AdMob
Implementing
Implicit Intents
Implicit and Explicit Intents
Implicit Intents
Publish to Play Store
Minimal app submission guide
Firebase Realtime DataBase
Quick setup
Firebase Realtime DataBase event handler
Designing and understanding how to retrieve realtime data from the Firebase Database
Denormalization Flat Database Structure
Understanding firebase JSON database
Retrieving data from firebase
Listening for child updates
Retrieving data with pagination
Image Compression
How to compress image without size change
Email Validation
Email address validation
Email Address validation with using Patterns
Keyboard
Hide keyboard when user taps anywhere else on the screen
Register a callback for keyboard open and close
Button
Using the same click event for one or more Views in the XML
Customizing Button style
inline onClickListener
Defining external Listener
Using the layout to define a click action
Listening to the long click events
Custom Click Listener to prevent multiple fast clicks
TextInputLayout
Basic usage
Password Visibility Toggles
Adding Character Counting
Handling Errors
TextInputEditText
Customizing the appearance of the TextInputLayout
Bottom Sheets
Quick Setup
BottomSheetBehavior like Google maps
Modal bottom sheets with BottomSheetDialog
Modal bottom sheets with BottomSheetDialogFragment
Persistent Bottom Sheets
Open BottomSheet DialogFragment in Expanded mode by default.
CoordinatorLayout and Behaviors
Creating a simple Behavior
Using the SwipeDismissBehavior
Create dependencies between Views
EditText
Working with EditTexts
Customizing the InputType
Hiding SoftKeyboard
Icon or button inside Custom Edit Text and its action and click listeners.
inputype attribute
Android Paypal Gateway Integration
Setup paypal in your android code
Firebase App Indexing
Supporting Http URLs
Add AppIndexing API
Firebase Crash Reporting
How to report an error
How to add Firebase Crash Reporting to your app
Displaying Google Ads
Basic Ad Setup
Adding Interstitial Ad
Android Vk Sdk
Initialization and login
Localized DateTime in Android
Custom localized date format with DateUtils.formatDateTime
Standard datetime formatting in Android
Fully customized datetime
Count Down Timer
Creating a simple countdown timer
A More Complex Example
Barcode and QR code reading
Using QRCodeReaderView based on Zxing
Otto Event Bus
Passing an event
Receiving an event
TransitionDrawable
Add transition or Cross-fade between two images.
Animate views background color switch-color with TransitionDrawable
Port Mapping using Cling library in Android
Adding Cling Support to your Android Project
Mapping a NAT port
Creating Overlay always-on-top Windows
Popup overlay
Granting SYSTEM ALERT WINDOW Permission on android 6.0 and above
ExoPlayer
Add ExoPlayer to the project
Using ExoPlayer
Main steps to play video audio using the standard TrackRenderer implementations
Inter-app UI testing with UIAutomator
Prepare your project and write the first UIAutomator test
Writing more complex tests using the UIAutomatorViewer
Creating a test suite of UIAutomator tests
MediaSession
Receiving and handling button events
Speech to Text Conversion
Speech to Text With Default Google Prompt Dialog
Speech to Text without Dialog
FileProvider
Sharing a file
Publish .aar file to Apache Archiva with Gradle
Simple implementation example
XMPP register login and chat simple example
XMPP register login and chat basic example
Android Authenticator
Basic Account Authenticator Service
RecyclerView and LayoutManagers
RecyclerView with DataBinding
Adding header view to recyclerview with gridlayout manager
GridLayoutManager with dynamic span count
Simple list with LinearLayoutManager
StaggeredGridLayoutManager
AudioManager
Requesting Transient Audio Focus
Requesting Audio Focus
Job Scheduling
Basic usage
Accounts and AccountManager
Understanding custom accountsauthentication
Integrate OpenCV into Android Studio
Instructions
Split Screen Multi-Screen Activities
Split Screen introduced in Android Nougat implemented.
Thread
Thread Example with its description
Updating the UI from a Background Thread
MediaStore
Fetch AudioMP3 files from specific folder of device or fetch all files
Time Utils
Convert Date Format into Milliseconds
To check within a period
GetCurrentRealTime
Touch Events
How to vary between child and parent view group touch events
Fingerprint API in android
Adding the Fingerprint Scanner in Android application
How to use Android Fingerprint API to save user passwords
MVVM Architecture
MVVM Example using DataBinding Library
BottomNavigationView
Basic implemetation
Customization of BottomNavigationView
Handling Enabled Disabled states
Allowing more than 3 menus
ORMLite in android
Android OrmLite over SQLite example
Youtube-API
Activity extending YouTubeBaseActivity
Launching StandAlonePlayerActivity
Consuming YouTube Data API on Android
YoutubePlayerFragment in portrait Activty
YouTube Player API
TabLayout
Using a TabLayout without a ViewPager
Retrofit2 with RxJava
Retrofit2 with RxJava
Retrofit with RxJava to fetch data asyncronously
Nested requests example multiple requests combine results
DayNight Theme AppCompat v23.2 API 14
Adding the DayNight theme to an app
ShortcutManager
Dynamic Launcher Shortcuts
LruCache
Adding a BitmapResource to the cache
Initialising the cache
Getting a BitmapResouce from the cache
Jenkins CI setup for Android Projects
Step by step approach to set up Jenkins for Android
Zip file in android
Zip file on android
Vector Drawables
VectorDrawable Usage Example
VectorDrawable xml example
Importing SVG file as VectorDrawable
fastlane
Fastfile lane to build and install all flavors for given build type to a device
Fastfile to build and upload multiple flavors to Beta by Crashlytics
Define step value increment for custom RangeSeekBar
Define a step value of 7
Getting started with OpenGL ES 2.0
Setting up GLSurfaceView and OpenGL ES 2.0
Compiling and Linking GLSL-ES Shaders from asset file
Check Data Connection
Check data connection
Check connection using ConnectivityManager
Use network intents to perform tasks while data is allowed
Android Java Native Interface JNI
How to call functions in a native library via the JNI interface
How to call a Java method from native code
Utility method in JNI layer
FileIO with Android
Obtaining the working folder
Writing raw array of bytes
Serializing the object
Writing to external storage SD card
Solving Invisible MTP files problem.
Working with big files
Performance Optimization
Save View lookups with the ViewHolder pattern
Robolectric
Robolectric test
Configuration
Moshi
JSON into Java
serialize Java objects as JSON
Built in Type Adapters
Strict Mode Policy A tool to catch the bug in the Compile Time.
The below Code Snippet is to setup the StrictMode for Thread Policies. This Code is to be set at the entry points to our application.
The below code deals with leaks of memory like it detects when in SQLLite finalize is called or not.
Internationalization and localization I18N and L10N
Planning for localization enable RTL support in Manifest
Planning for localization Add RTL support in Layouts
Planning for localization Test layouts for RTL
Coding for Localization Creating default strings and resources
Coding for localization Providing alternative strings
Coding for localization Providing alternate layouts
Fast way to setup Retrolambda on an android project.
Setup and example how to use
How to use SparseArray
Basic example using SparseArray
Firebase Cloud Messaging
Set Up a Firebase Cloud Messaging Client App on Android
Receive Messages
Registration token
This code that i have implemnted in my app for pushing imagemessage and also link for opening in your webView
Subscribe to a topic
Shared Element Transitions
Shared Element Transition between two Fragments
Android Things
Controlling a Servo Motor
VideoView
Play video from URL with using VideoView
VideoView Create
ViewFlipper
ViewFlipper with image sliding
Library Dagger 2 Dependency Injection in Applications
Create Module Class and Singleton annotation for Object
Request Dependencies in Dependent Objects
Connecting Modules with Inject
Using Component Interface to Obtain Objects
Formatting phone numbers with pattern.
Patterns 1 786 1234 5678
How to store passwords securely
Using AES for salted password encryption
Android Kernel Optimization
Low RAM Configuration
How to add a CPU Governor
IO Schedulers
Paint
Creating a Paint
Setting up Paint for text
Setting up Paint for drawing shapes
Setting flags
AudioTrack
Generate tone of a specific frequency
What is ProGuard What is use in Android
Shrink your code and resources with proguard
Create Android Custom ROMs
Making Your Machine Ready for Building
Java on Android
Java 8 features subset with Retrolambda
Pagination in RecyclerView
MainActivity.java
Genymotion for android
Installing Genymotion the free version
Google framework on Genymotion
Handling touch and motion events
Buttons
Surface
Handling multitouch in a surface
Creating Splash screen
Splash screen with animation
A basic splash screen
ConstraintSet
ConstraintSet with ContraintLayout Programmatically
CleverTap
Setting the debug level
Get an instance of the SDK to record events
Publish a library to Maven Repositories
Publish .aar file to Maven
adb shell
Granting revoking API 23 permissions
Send text key pressed and touch events to Android Device via ADB
List packages
Recording the display
Set DateTime via adb
Open Developer Options
Changing file permissions using chmod command
Generating a Boot Complete broadcast
Print application data
View externalsecondary storage content
kill a process inside an Android device
Ping ICMP
Performs a single Ping
AIDL
AIDL Service
Android programming with Kotlin
Installing the Kotlin plugin
Configuring an existing Gradle project with Kotlin
Creating a new Kotlin Activity
Converting existing Java code to Kotlin
Starting a new Activity
Autosizing TextViews
Granularity
Preset Sizes
Sign your Android App for Release
Sign your App
Configure the build.gradle with signing configuration
Context
Basic Examples
Activity Recognition
Google Play ActivityRecognitionAPI
PathSense Activity Recognition
Secure SharedPreferences
Securing a Shared Preference
Secure SharedPreferences
Securing a Shared Preference
Bitmap Cache
Bitmap Cache Using LRU Cache
Android-x86 in VirtualBox
Virtual Machine setup
Virtual hard drive Setup for SDCARD Support
Installation in partition
JCodec
Getting Started
Getting frame from movie
Design Patterns
Observer pattern
Singleton Class Example
Okio
Download Implement
PNG decoder
ByteStrings and Buffers
Google signin integration on android
Integration of google Auth in your project. Get a configuration file
Code Implementation Google SignIn
TensorFlow
How to use
Android game development
Game using Canvas and SurfaceView
Notification Channel Android O
Notification Channel
Bluetooth Low Energy
Finding BLE Devices
Connecting to a GATT Server
Writing and Reading from Characteristics
Subscribing to Notifications from the Gatt Server
Advertising a BLE Device
Using a Gatt Server
Leakcanary
Implementing a Leak Canary in Android Application
Adding a FuseView to an Android Project
hikr app just another android.view.View
Accessing SQLite databases using the ContentValues class
Inserting and updating rows in a SQLite database
Enhancing Alert Dialogs
Alert dialog containing a clickable link
Hardware Button EventsIntents PTT LWP etc.
Sonim Devices
RugGear Devices
SpannableString
Add styles to a TextView
Multi string with multi color
Looper
Create a simple LooperThread
Run a loop with a HandlerThread
Optimized VideoView
Optimized VideoView in ListView
Google Drive API
Integrate Google Drive in Android
Create a File on Google Drive
Animated AlertDialog Box
Put Below code for Animated dialog...
Annotation Processor
NonNull Annotation
Types of Annotations
Creating and Using Custom Annotations
SyncAdapter with periodically do sync of data
Sync adapter with every min requesting value from server.
Create Singleton Class for Toast Message
Create own singleton class for toast massages
Fastjson
Parsing JSON with Fastjson
Convert the data of type Map to JSON String
Android Architecture Components
Using Lifecycle in AppCompatActivity
Add Architecture Components
ViewModel with LiveData transformations
Room peristence
Custom LiveData
Custom Lifecycle-aware component
Jackson
Full Data Binding Example
Google Play Store
Open Google Play Store Listing for your app
Open Google Play Store with the list of all applications from your publisher account
Loading Bitmaps Effectively
Load the Image from Resource from Android Device. Using Intents.
Getting system font names and using the fonts
Getting system font names
Applying a system font to a TextView
Smartcard
Smart card send and receive
Convert vietnamese string to english string Android
example
Chuyn chui Ting Vit thnh chui khng du
  ↑ ↓ to navigate     ↵ to select     Esc to close