<!DOCTYPE html>
<html class="no-js" dir="ltr" lang="en-US" xmlns="http://www.w3.org/1999/xhtml" xmlns:b="http://www.google.com/2005/gml/b" xmlns:data="http://www.google.com/2005/gml/data" xmlns:expr="http://www.google.com/2005/gml/expr">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link href="static/v1/widgets/55013136-widget_css_bundle.css" rel="stylesheet" type="text/css"/>
<title>
		Android Tutorials
      </title>
	<link rel="canonical" href="https://www.androprogrammer.com" />
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"/>
<meta content="public" http-equiv="Cache-control"/>
<meta content="max-age=86400" http-equiv="Cache-control"/>
<meta content="gzip" http-equiv="Content-Encoding"/>
<meta content="android tutorials, application development for android, mobile apps development,mobile application development, androprogrammer.com, wasim memon, android samples,tuts for android, new apps create,how to create apps,mobile apps code,how to android" name="keywords"/>
<meta content="To give all details of Android Programming and basics of it we are here with great tutorials." name="description"/>
<meta content="Wasim Memon" name="author"/>
<meta content="blogger" name="generator"/>
<link href="favicon.ico" rel="icon" type="image/x-icon"/>
<link rel="service.post" type="application/atom+xml" title="AndroProgrammer - Atom" href="https://www.blogger.com/feeds/1310888148096212123/posts/default"/>
<link rel="me" href="https://www.blogger.com/profile/02101887469831067177"/>
<!--Can't find substitution for tag [blog.ieCssRetrofitLinks]-->
<meta content="https://www.androprogrammer.com/" property="og:url"/>
<meta content="AndroProgrammer" property="og:title"/>
<meta content="" property="og:description"/>
<link href="//fonts.googleapis.com/css?family=PT+Serif:400,700,400italic,700italic" rel="stylesheet" type="text/css">
<link href="//fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic,700,700italic" rel="stylesheet" type="text/css">
<link href="//fonts.googleapis.com/css?family=Lato:300,400,700" media="all" rel="stylesheet" type="text/css">
<link href="font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"/>
<!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->
<style id="page-skin-1" type="text/css"><!--
/*
-----------------------------------------------
Created Date   : Saturday, January 10, 2015
License        : GNU General Public License v3.0
This template is free for both personal and commercial use, But to satisfy the 'attribution' clause of the license, you are required to keep the footer links intact which provides due credit to its authors.
----------------------------------------------- */
body#layout ul{list-style-type:none;list-style:none}
body#layout ul li{list-style-type:none;list-style:none}
body#layout #headerbwrap {height:auto;}
body#layout #content {}
body#layout .widget_searchnbt {display:none;}
/* Variable definitions
====================
*/
.section, .widget {
margin:0;
padding:0;
}
/*-----------------------------------[ RESET ]
*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font: inherit; font-size: 100%; vertical-align: baseline; }
html { line-height: 1; }
ol, ul { list-style: none; }
table { border-collapse: collapse; border-spacing: 0; }
caption, th, td { text-align: left; font-weight: normal; vertical-align: middle; }
q, blockquote { quotes: none; }
q:before, q:after, blockquote:before, blockquote:after { content: ""; content: none; }
a img { border: none; }
article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary { display: block; }
/*-----------------------------------[ BASIC STYLES ]
*/
html * { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html, body { height: 100%; }
*, *:before, *:after { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; text-rendering: optimizeLegibility; }
body { color: #737c7f; background-color: #f1f1f1; font-size: 100%; font-family: sans-serif, PT Serif, Helvetica, Arial; font-weight: 300; line-height: 1.6; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }
a { color: #5fccb2; text-decoration: none; }
a:hover { color: #3cbc9d; }
img, embed, object, video, svg, iframe { max-width: 100%; }
img, svg { height: auto; }
hr { display: block; height: 1px; border: solid #ddd; border-width: 1px 0 0; margin: 22px 0 21px; padding: 0; clear: both; }
::selection { background-color: #5fccb2; color: #fff; }
::-moz-selection { background-color: #5fccb2; color: #fff; }
.clearfix:before, .clearfix:after { content: " "; display: table; }
.clearfix:after { clear: both; }
/* For IE 6/7 only */
.clearfix { *zoom: 1; }
/*-----------------------------------[ CONTAINER ]
*/
.containernbt { width: 1200px; max-width: 100%; margin: 70px auto; }
@media (max-width: 47.938em) { .containernbt { margin: 80px auto; } }
@media (max-width: 47.938em) { aside { margin-top: 30px; } }
/*-----------------------------------[ VISIBILITY ]
*/
@media (max-width: 37.5em) { .hide-on-mobile { display: none; } }
@media (min-width: 37.5em) and (max-width: 62.5em) { .hide-on-tablet { display: none; } }
@media (min-width: 62.5em) { .hide-on-desktop { display: none; } }
/*-----------------------------------[ ALIGNMENT + POSITIONING ]
*/
.left { float: left; }
.right { float: right; }
.text-rightnbt { text-align: right; }
.text-centernbt { text-align: center; }
.text-justifynbt { text-align: justify; }
.centernbt { display: table-cell; vertical-align: middle; text-align: center; }
/*-----------------------------------[ AD POSITIONING ]
*/
.ad.right { margin: 0 0 10px 20px; }
.ad.left { margin: 0 20px 10px 0; }
.ad.middle { margin: 0 0 0 -9px; }
/*-----------------------------------[ BLOCKQUOTE ]
*/
blockquote { display: block; margin-bottom: 17px; padding-left: 20px; border-left: 2px solid #5fccb2; }
blockquote cite { font-size: .813em; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
blockquote cite:before { content: "\2014 \2009"; }
blockquote cite a, blockquote cite a:visited { color: #5fccb2; }
/*-----------------------------------[ TABLE ]
*/
table { width: 100%; margin: 18px 0; border: 1px solid #ddd; }
table thead, table tfoot { background: #f5f5f5; }
thead th, tbody th, tfoot th { padding: 5px 10px; font-weight: 400; text-transform: uppercase; font-size: 12px; text-align: left; }
table#wp-calendar tfoot, table#wp-calendar caption { letter-spacing: 1px; text-transform: uppercase; }
table#wp-calendar tfoot td#next { text-align: right; }
tr.even, tr:nth-child(even) { background: #f9f9f9; }
td { padding: 5px 10px; line-height: 1.4; font-size: 13px; }
td:first-child { font-weight: 400; }
/*-----------------------------------[ RESPONSIVE LAYOUT ]
*/
@media (max-width: 48em) { .rownbt { width: auto; min-width: 0; margin-left: 0; margin-right: 0; }
[class*=col-] { width: 100% !important; float: none; }
[class*=col-]:after, [class*=col-]:before { content: ""; display: table; }
[class*=col-]:after { clear: both; } }
/*-----------------------------------[ the GRID ]
*
* .row must precede .col-*
*
* @example
* <div class="row">
* 	<div class="col-6"></div>
* 	<div class="col-6"></div>
* </div>
*
*/
.col-1 { width: 8.333%; }
.col-2 { width: 16.666%; }
.col-3 { width: 25%; }
.col-4 { width: 31.333%; }
.col-5 { width: 41.666%; }
.col-6 { width: 50%; }
.col-7 { width: 58.333%; }
.col-8 { width: 68.666%; }
.col-9 { width: 75%; }
.col-10 { width: 83.333%; }
.col-11 { width: 91.666%; }
.col-12 { width: 100%; }
/*-----------------------------------[ /the GRID ]
*/
.rownbt { width: 100%; margin: 0 auto; }
.rownbt .rownbt, .rownbt .rownbt .rownbt { width: auto; max-width: none; min-width: 0; margin: -15px; }
.rownbt:after, .rownbt:before { content: " "; display: table; }
.rownbt:after { clear: both; }
[class*=col-] { float: left; min-height: 1px; padding: 0 15px; position: relative; }
/*-----------------------------------[ TYPOGRAPHY ]
*/
h1, h2, h3, h4, h5, h6 { color: #737c7f; font-family: "PT Serif", sans-serif; font-weight: 400; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 17px; }
h1 { font-size: 2em; }
h2 { font-size: 1.5em; }
h3, h4, h5 { font-size: 1em; }
h6 { font-size: .67em; }
p { /*font-size: 1em; line-height: 1.8; margin-bottom: 17px;*/ }
small { font-size: 80%; }
aside { /*font-size: .813em;*/ }
b, strong { font-weight: bold; }
i, em, dfn { font-style: italic; }
address { font-weight: 400; margin-bottom: 17px; }
tt, var, code, pre, kbd, ins, mark, samp { font-family: Menlo,monospace; font-size: 90%; }
pre { background: #f4f4f4; height: auto; outline: none; margin-bottom: 17px; padding: 6px 10px; vertical-align: middle; width: 100%; word-wrap: break-word; white-space: pre-wrap; }
abbr, acronym { border-bottom: 1px dotted #ddd; cursor: help; }
mark, ins { font-weight: 400; background: #fff9c0; text-decoration: none; }
sup, sub { font-size: 80%; font-weight: 400; height: 0; line-height: 0; position: relative; vertical-align: baseline; }
sup { bottom: 1ex; }
sub { top: .5ex; }
dt { font-weight: 700; text-decoration: underline; }
dd { margin: 0; padding: 0 0 0.5em 0; }
/*---------------- Customization ---------------*/
.hfeed .date-outer{
background: none repeat scroll 0 0 #fff;
margin-top: 10px;
padding: 15px;
}
.post-feeds {
padding: 10px;
text-align: center;
}
/*-----------------------------------[ FORM STYLES ]
*/
input, textarea { -webkit-appearance: none; -moz-appearance: none; -ms-appearance: none; appearance: none; box-shadow: none; outline: 0; border-radius: 0; font: inherit; color: #737c7f; background-color: inherit; border: 1px solid; border-color: #ddd; padding: 6px; margin: 3px 0 0; width: 100%; }
input:focus, textarea:focus { background-color: transparent; outline: 0 !important; }
textarea { vertical-align: top; resize: none; }
input[type="checkbox"] { display: inline; margin: 10px 10px 0 0; -webkit-appearance: checkbox; }
input[type="search"] { margin: 0; padding: 6px 10px; letter-spacing: 1px; text-transform: uppercase; }
input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { display: none; }
input[type="submit"] { font-size: .813em; font-weight: 700; display: inline-block; vertical-align: middle; white-space: nowrap; cursor: pointer; margin: 10px 0; padding: 10px 15px; border-radius: 0; overflow: visible; text-transform: uppercase; letter-spacing: 2px !important; background-color: #5fccb2; border: 1px solid #86d8c5; color: #fff !important; width: auto; }
input[type="submit"]:active, input[type="submit"]:focus { outline: none; }
input[type="submit"]::-moz-focus-inner { border: 0; padding: 0; }
input[type="submit"]:hover { border: 1px solid #86d8c5; background-color: transparent; color: #5fccb2 !important; }
/*-----------------------------------[ PLACEHOLDER ]
*/
::-webkit-input-placeholder { color: #737c7f; }
:-moz-placeholder { color: #737c7f; }
::-moz-placeholder { color: #737c7f; }
:-ms-input-placeholder { color: #737c7f; }
/*-----------------------------------[ IMAGE ]
*/
img { /*display: block; margin: 0 0 18px;*/ -webkit-transition-duration: 300ms; -moz-transition-duration: 300ms; -o-transition-duration: 300ms; transition-duration: 300ms; }
/*-----------------------------------[ VIDEO ]
*
* add class .video to your embeded code
*
*/
.video { position: relative; padding-bottom: 56.25%; /* 16:9 */ padding-top: 25px; height: 0; }
.video iframe, .video object, .video embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/*-----------------------------------[ NAVIGATION ]
*/
header { position: fixed; top: 0; left: 0; width: 100%; height: 50px; background-color: #5fccb2; z-index: 999; font-family: "PT Serif", sans-serif; letter-spacing: 2px; text-transform: uppercase; }
header::after { content: ""; display: table; clear: both; }
header a, header a:hover { color: #fff; font-weight: 700; }
.logonbt { float: left; margin: 0 0 0 1em; line-height: 50px; }
.logonbt img { display: block; max-height: 50px; }
.logonbt h1 { margin: 0; padding: 0; font-size: 1em;font-family: Lato; }
.menunbt { position: relative; float: right; }
.menunbt .menu-item { float: left; *display: inline; zoom: 1; position: relative; }
.menunbt .menu-item a { display: block; background-color: #5fccb2; font-size: .938em; line-height: 50px; padding: 0 15px; border-left: 1px solid rgba(255, 255, 255, 0.2);font-family:Lato; }
.menunbt .menu-item a:hover { background: #f2897f; }
.menu-item:hover .sub-menu { display: block; }
.menu-item.menu-item-has-children > a { padding-right: 2em; }
.menu-item.menu-item-has-children > a::after { content: ""; display: block; width: 0; height: 0; border: solid 5px; border-color: white transparent transparent transparent; margin-right: 15px; margin-top: -2.5px; position: absolute; right: 0; top: 50%; }
.sub-menu { display: none; position: absolute; right: 0; }
.sub-menu .menu-item { width: 16em; }
.sub-menu .menu-item a { font-family: "Helvetica Neue", Helvetica, PT Serif, Arial, sans-serif; text-transform: capitalize; letter-spacing: 0; border-top: 1px solid rgba(255, 255, 255, 0.2); }
.hamburgernbt, .menu-click { display: none; cursor: pointer; position: absolute; top: 0; right: 0; line-height: 45px; padding: 0 15px; color: #fff; font-size: 1.5em; }
.menu-click { line-height: 50px; }
.rotate { -webkit-transform: rotate(180deg); -moz-transform: rotate(180deg); -ms-transform: rotate(180deg); -o-transform: rotate(180deg); transform: rotate(180deg); }
@media (min-width: 769px) { .sub-menu .menu-item .sub-menu { display: none; }
.sub-menu .menu-item:hover .sub-menu { display: block; position: absolute; top: 0; right: 16em; } }
@media (max-width: 768px) {
.hamburgernbt { display: block; }
.menunbt { float: none; clear: both; width: 100%; /* to accomodate long menu */ max-height: 500px; overflow-y: auto; overflow-x: hidden; }
.menu-listnbt, .menu-item:hover .sub-menu { display: none; }
.menu-item { width: 100%; }
.menu-item > a { border-top: 1px solid rgba(255, 255, 255, 0.2); }
.menu-item.menu-item-has-children > a::after { border: none; }
.menu-click { display: block; border: 1px solid rgba(255, 255, 255, 0.2); }
.menu-click:hover { background-color: #f2897f; }
.sub-menu { position: static; }
.sub-menu .menu-item { width: 100%; }
.sub-menu .sub-menu { text-indent: 20px; }
.sub-menu .sub-menu .menu-item::before { position: absolute; left: -5px; top: 13px; content: "&#8212;"; color: #fff; font-weight: 700; } }
/*-----------------------------------[ ARTICLE ]
article.hentry {margin-bottom: 30px;} */
article ul, article ol { font-size: 15px; margin: 20px; }
article ul { list-style-type: circle; }
article ol { list-style-type: decimal; }
article li ul, article li ol { margin: 0; padding-left: 20px; }
article .entry-title { margin-bottom: 10px;font-size: 1.2em; }
article h1.entry-title { font-size: 1.5em; line-height: 1.4; }
article .entry-content { margin-bottom: 10px; }
/*article .entry-content p { font-size: .938em; line-height: 1.625; text-align: justify; }*/
article .entry-metanbt { font-family: "PT Serif", sans-serif; font-size: 0.688em; font-weight: 400; letter-spacing: 1px; text-transform: uppercase; margin: 0 0 20px 0; }
.thumbnail {
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
display: block;
line-height: 1.42857;
margin-bottom: 20px;
padding: 4px;
transition: border 0.2s ease-in-out 0s;
}
.postdivider {
margin-top: 15px;
border-bottom: 1px solid #e4e4e5;
}
/*-----------------------------------[ WIDGETS ]
*/
.widgetareanbt {
background: none repeat scroll 0 0 #fff;
margin-top: 10px;
}
.widgetareanbt .widget { margin-bottom: 30px; margin-top: 10px; }
.widgetareanbt .widget h2 { font-size: 1.125em; }
.widgetareanbt .widget h3 { font-size: 1.125em; }
.widgetareanbt .widget ul { list-style: none; }
.widgetareanbt .widget ul:not(.children) { border-bottom: 1px solid #e6e3e3; }
.widgetareanbt .widget ul.children { margin: 8px 0 -8px 20px; }
.widgetareanbt .widget li { padding: 8px 0; margin: 0; border-top: 1px solid #e6e3e3; }
.widgetareanbt .widget li a { color: #737c7f !important; }
/*-----------------------------------[ FOOTER ]
*/
#footernbt {
height: 53px;
font-family: "PT Serif", sans-serif;
font-weight: 400;
padding-top: 10px;
text-align: center;
text-transform: uppercase;
border-top: 1px solid #ddd;
}
h2.date-header{margin:10px 0;display:none}
.main .widget{margin:0 0 5px;padding:0 0 2px}
.main .Blog{border-bottom-width:0}
#header .description {}
/* Comments----------------------------------------------- */
#comments{padding:10px;margin-bottom:20px}
#comments h4{font-size:22px;margin-bottom:10px}
.deleted-comment{font-style:italic;color:gray}
#blog-pager-newer-link{float:left}
#blog-pager-older-link{float:right}
#blog-pager{text-align:center;padding:5px;margin:10px 0}
.feed-links{clear:both}
#navbar-iframe{height:0;visibility:hidden;display:none}
.author-profile{background:#f6f6f6;border:1px solid #eee;margin:10px 0;padding:8px;overflow:hidden}
.author-profile img{border:1px solid #ddd;float:left;margin-right:10px}
.post-iconspbt{margin:5px 0 0;padding:0}
.post-locationpbt{margin:5px 0;padding:0}
.related-postbwrap{margin:10px auto 0}
.related-postbwrap h4{font-weight:bold;margin:10px 0}
.related-post-style-2,.related-post-style-2 li{list-style:none;margin:0;padding:0}
.related-post-style-2 li{border-top:0 solid #eee;overflow:hidden;padding:10px 0}
.related-post-style-2 li:first-child{border-top:none}
.related-post-style-2 .related-post-item-thumbnail{width:80px;height:80px;max-width:none;max-height:none;background-color:transparent;border:none;float:left;margin:2px 10px 0 0;padding:0}
.related-post-style-2 .related-post-item-title{font-weight:normal;font-size:100%}
.related-post-style-2 .related-post-item-summary{display:block}
.pbtsharethisbutt { font-family: "PT Serif", sans-serif; font-weight: 400; letter-spacing: 1px; text-transform: uppercase; overflow:hidden;padding:2px 0 5px;margin:0 }
.pbtsharethisbutt ul{list-style:none;list-style-type:none;margin:0;padding:0;font-size: 0.688em; }
.pbtsharethisbutt ul li{float:left;margin:0;padding:0}
.pbtsharethisbutt ul li a{padding:0 10px;display:inline-block}
.pbtsharethisbutt ul li a:hover {}
.separator a[style="margin-left: 1em; margin-right: 1em;"] {margin-left: auto!important;margin-right: auto!important;}
.separator a[style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"] {clear: none !important; float: none !important; margin-bottom: 0em !important; margin-right: 0em !important;}
.separator a[style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"] img {float: left !important; margin: 0px 10px 10px 0px;}
.separator a[style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"] {clear: none !important; float: none !important; margin-bottom: 0em !important; margin-left: 0em !important;}
.separator a[style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"] img {float: right !important; margin: 0px 0px 10px 10px;}
.PopularPosts .widget-content ul li{}
.reaction-buttons table{border:none;margin-bottom:5px}
.reaction-buttons table,.reaction-buttons td{border:none!important}
.pbtthumbimg{float:left;margin:0 10px 5px 0;padding:4px;border:0 solid #eee;background:none;width:200px;height:auto}
.headernbt,.menunbt .menu-item a,.menunbt .menu-item a:hover,.sub-item .menu-item a,.sub-item .menu-item a:hover,.menu-click:hover,input[type="submit"]{background-color:#5fccb2}
.headernbt a{color:#fff}
a,a:hover{color:#5fccb2}
input[type="submit"]:hover{color:#5fccb2!important}
input[type="submit"],input[type="submit"]:hover{border:1px solid #5fccb2}
blockquote{border-left:2px solid #5fccb2}
input[type="submit"]:hover{background:transparent!important}
.menu-click:hover{border-top:1px solid rgba(255,255,255,0.2)}
::selection{background-color:#5fccb2}
::-moz-selection{background-color:#5fccb2}
.CSS_LIGHTBOX {z-index: 1000 !important;}
/*Cookie Consent Begin*/
#cookieConsent {
background-color: rgba(20,20,20,0.8);
min-height: 26px;
font-size: 14px;
color: #ccc;
line-height: 26px;
padding: 8px 0 8px 30px;
font-family: "Trebuchet MS",Helvetica,sans-serif;
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: none;
z-index: 9999;
}
#cookieConsent a {
color: #4B8EE7;
text-decoration: none;
}
#closeCookieConsent {
float: right;
display: inline-block;
cursor: pointer;
height: 20px;
width: 20px;
margin: -15px 0 0 0;
font-weight: bold;
}
#closeCookieConsent:hover {
color: #FFF;
}
#cookieConsent a.cookieConsentOK {
background-color: #F1D600;
color: #000;
display: inline-block;
border-radius: 5px;
padding: 0 20px;
cursor: pointer;
float: right;
margin: 0 60px 0 10px;
}
#cookieConsent a.cookieConsentOK:hover {
background-color: #E0C91F;
}
/*Cookie Consent End*/
--></style>
<script src="ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>
<script src="https://drive.google.com/file/d/0B5ODELs3mMtIeXQ2RHRvX2czc3c/view?usp=sharing" type="text/javascript"></script>
<script type="text/javascript">
      //<![CDATA[
      /*! jQuery Migrate v1.2.1 | (c) 2005, 2013 jQuery Foundation, Inc. and other contributors | jquery.org/license */
      jQuery.migrateMute===void 0&&(jQuery.migrateMute=!0),function(e,t,n){function r(n){var r=t.console;i[n]||(i[n]=!0,e.migrateWarnings.push(n),r&&r.warn&&!e.migrateMute&&(r.warn("JQMIGRATE: "+n),e.migrateTrace&&r.trace&&r.trace()))}function a(t,a,i,o){if(Object.defineProperty)try{return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){return r(o),i},set:function(e){r(o),i=e}}),n}catch(s){}e._definePropertyBroken=!0,t[a]=i}var i={};e.migrateWarnings=[],!e.migrateMute&&t.console&&t.console.log&&t.console.log("JQMIGRATE: Logging is active"),e.migrateTrace===n&&(e.migrateTrace=!0),e.migrateReset=function(){i={},e.migrateWarnings.length=0},"BackCompat"===document.compatMode&&r("jQuery is not compatible with Quirks Mode");var o=e("<input/>",{size:1}).attr("size")&&e.attrFn,s=e.attr,u=e.attrHooks.value&&e.attrHooks.value.get||function(){return null},c=e.attrHooks.value&&e.attrHooks.value.set||function(){return n},l=/^(?:input|button)$/i,d=/^[238]$/,p=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,f=/^(?:checked|selected)$/i;a(e,"attrFn",o||{},"jQuery.attrFn is deprecated"),e.attr=function(t,a,i,u){var c=a.toLowerCase(),g=t&&t.nodeType;return u&&(4>s.length&&r("jQuery.fn.attr( props, pass ) is deprecated"),t&&!d.test(g)&&(o?a in o:e.isFunction(e.fn[a])))?e(t)[a](i):("type"===a&&i!==n&&l.test(t.nodeName)&&t.parentNode&&r("Can't change the 'type' of an input or button in IE 6/7/8"),!e.attrHooks[c]&&p.test(c)&&(e.attrHooks[c]={get:function(t,r){var a,i=e.prop(t,r);return i===!0||"boolean"!=typeof i&&(a=t.getAttributeNode(r))&&a.nodeValue!==!1?r.toLowerCase():n},set:function(t,n,r){var a;return n===!1?e.removeAttr(t,r):(a=e.propFix[r]||r,a in t&&(t[a]=!0),t.setAttribute(r,r.toLowerCase())),r}},f.test(c)&&r("jQuery.fn.attr('"+c+"') may use property instead of attribute")),s.call(e,t,a,i))},e.attrHooks.value={get:function(e,t){var n=(e.nodeName||"").toLowerCase();return"button"===n?u.apply(this,arguments):("input"!==n&&"option"!==n&&r("jQuery.fn.attr('value') no longer gets properties"),t in e?e.value:null)},set:function(e,t){var a=(e.nodeName||"").toLowerCase();return"button"===a?c.apply(this,arguments):("input"!==a&&"option"!==a&&r("jQuery.fn.attr('value', val) no longer sets properties"),e.value=t,n)}};var g,h,v=e.fn.init,m=e.parseJSON,y=/^([^<]*)(<[\w\W]+>)([^>]*)$/;e.fn.init=function(t,n,a){var i;return t&&"string"==typeof t&&!e.isPlainObject(n)&&(i=y.exec(e.trim(t)))&&i[0]&&("<"!==t.charAt(0)&&r("$(html) HTML strings must start with '<' character"),i[3]&&r("$(html) HTML text after last tag is ignored"),"#"===i[0].charAt(0)&&(r("HTML string cannot start with a '#' character"),e.error("JQMIGRATE: Invalid selector string (XSS)")),n&&n.context&&(n=n.context),e.parseHTML)?v.call(this,e.parseHTML(i[2],n,!0),n,a):v.apply(this,arguments)},e.fn.init.prototype=e.fn,e.parseJSON=function(e){return e||null===e?m.apply(this,arguments):(r("jQuery.parseJSON requires a valid JSON string"),null)},e.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e.browser||(g=e.uaMatch(navigator.userAgent),h={},g.browser&&(h[g.browser]=!0,h.version=g.version),h.chrome?h.webkit=!0:h.webkit&&(h.safari=!0),e.browser=h),a(e,"browser",e.browser,"jQuery.browser is deprecated"),e.sub=function(){function t(e,n){return new t.fn.init(e,n)}e.extend(!0,t,this),t.superclass=this,t.fn=t.prototype=this(),t.fn.constructor=t,t.sub=this.sub,t.fn.init=function(r,a){return a&&a instanceof e&&!(a instanceof t)&&(a=t(a)),e.fn.init.call(this,r,a,n)},t.fn.init.prototype=t.fn;var n=t(document);return r("jQuery.sub() is deprecated"),t},e.ajaxSetup({converters:{"text json":e.parseJSON}});var b=e.fn.data;e.fn.data=function(t){var a,i,o=this[0];return!o||"events"!==t||1!==arguments.length||(a=e.data(o,t),i=e._data(o,t),a!==n&&a!==i||i===n)?b.apply(this,arguments):(r("Use of jQuery.fn.data('events') is deprecated"),i)};var j=/\/(java|ecma)script/i,w=e.fn.andSelf||e.fn.addBack;e.fn.andSelf=function(){return r("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),w.apply(this,arguments)},e.clean||(e.clean=function(t,a,i,o){a=a||document,a=!a.nodeType&&a[0]||a,a=a.ownerDocument||a,r("jQuery.clean() is deprecated");var s,u,c,l,d=[];if(e.merge(d,e.buildFragment(t,a).childNodes),i)for(c=function(e){return!e.type||j.test(e.type)?o?o.push(e.parentNode?e.parentNode.removeChild(e):e):i.appendChild(e):n},s=0;null!=(u=d[s]);s++)e.nodeName(u,"script")&&c(u)||(i.appendChild(u),u.getElementsByTagName!==n&&(l=e.grep(e.merge([],u.getElementsByTagName("script")),c),d.splice.apply(d,[s+1,0].concat(l)),s+=l.length));return d});var Q=e.event.add,x=e.event.remove,k=e.event.trigger,N=e.fn.toggle,T=e.fn.live,M=e.fn.die,S="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",C=RegExp("\\b(?:"+S+")\\b"),H=/(?:^|\s)hover(\.\S+|)\b/,A=function(t){return"string"!=typeof t||e.event.special.hover?t:(H.test(t)&&r("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),t&&t.replace(H,"mouseenter$1 mouseleave$1"))};e.event.props&&"attrChange"!==e.event.props[0]&&e.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),e.event.dispatch&&a(e.event,"handle",e.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),e.event.add=function(e,t,n,a,i){e!==document&&C.test(t)&&r("AJAX events should be attached to document: "+t),Q.call(this,e,A(t||""),n,a,i)},e.event.remove=function(e,t,n,r,a){x.call(this,e,A(t)||"",n,r,a)},e.fn.error=function(){var e=Array.prototype.slice.call(arguments,0);return r("jQuery.fn.error() is deprecated"),e.splice(0,0,"error"),arguments.length?this.bind.apply(this,e):(this.triggerHandler.apply(this,e),this)},e.fn.toggle=function(t,n){if(!e.isFunction(t)||!e.isFunction(n))return N.apply(this,arguments);r("jQuery.fn.toggle(handler, handler...) is deprecated");var a=arguments,i=t.guid||e.guid++,o=0,s=function(n){var r=(e._data(this,"lastToggle"+t.guid)||0)%o;return e._data(this,"lastToggle"+t.guid,r+1),n.preventDefault(),a[r].apply(this,arguments)||!1};for(s.guid=i;a.length>o;)a[o++].guid=i;return this.click(s)},e.fn.live=function(t,n,a){return r("jQuery.fn.live() is deprecated"),T?T.apply(this,arguments):(e(this.context).on(t,this.selector,n,a),this)},e.fn.die=function(t,n){return r("jQuery.fn.die() is deprecated"),M?M.apply(this,arguments):(e(this.context).off(t,this.selector||"**",n),this)},e.event.trigger=function(e,t,n,a){return n||C.test(e)||r("Global events are undocumented and deprecated"),k.call(this,e,t,n||document,a)},e.each(S.split("|"),function(t,n){e.event.special[n]={setup:function(){var t=this;return t!==document&&(e.event.add(document,n+"."+e.guid,function(){e.event.trigger(n,null,t,!0)}),e._data(this,n,e.guid++)),!1},teardown:function(){return this!==document&&e.event.remove(document,n+"."+e._data(this,n)),!1}}})}(jQuery,window);
      //]]>
    </script>
<script type="text/javascript">
      //<![CDATA[
      function showrecentcomments(json){for(var i=0;i<a_rc;i++){var b_rc=json.feed.entry[i];var c_rc;if(i==json.feed.entry.length)break;for(var k=0;k<b_rc.link.length;k++){if(b_rc.link[k].rel=='alternate'){c_rc=b_rc.link[k].href;break;}}c_rc=c_rc.replace("#","#comment-");var d_rc=c_rc.split("#");d_rc=d_rc[0];var e_rc=d_rc.split("/");e_rc=e_rc[5];e_rc=e_rc.split(".html");e_rc=e_rc[0];var f_rc=e_rc.replace(/-/g," ");f_rc=f_rc.link(d_rc);var g_rc=b_rc.published.$t;var h_rc=g_rc.substring(0,4);var i_rc=g_rc.substring(5,7);var j_rc=g_rc.substring(8,10);var k_rc=new Array();k_rc[1]="Jan";k_rc[2]="Feb";k_rc[3]="Mar";k_rc[4]="Apr";k_rc[5]="May";k_rc[6]="Jun";k_rc[7]="Jul";k_rc[8]="Aug";k_rc[9]="Sep";k_rc[10]="Oct";k_rc[11]="Nov";k_rc[12]="Dec";if("content" in b_rc){var l_rc=b_rc.content.$t;}else if("summary" in b_rc){var l_rc=b_rc.summary.$t;}else var l_rc="";var re=/<\S[^>]*>/g;l_rc=l_rc.replace(re,"");if(m_rc==true)document.write('On '+k_rc[parseInt(i_rc,10)]+' '+j_rc+' ');document.write('<a href="'+c_rc+'">'+b_rc.author[0].name.$t+'</a> commented');if(n_rc==true)document.write(' on '+f_rc);document.write(': ');if(l_rc.length<o_rc){document.write('<i>&#8220;');document.write(l_rc);document.write('&#8221;</i><br/><br/>');}else{document.write('<i>&#8220;');l_rc=l_rc.substring(0,o_rc);var p_rc=l_rc.lastIndexOf(" ");l_rc=l_rc.substring(0,p_rc);document.write(l_rc+'&hellip;&#8221;</i>');document.write('<br/><br/>');}}}
      function rp(json){document.write('<ul>');for(var i=0;i<numposts;i++){document.write('<li>');var entry=json.feed.entry[i];var posttitle=entry.title.$t;var posturl;if(i==json.feed.entry.length)break;for(var k=0;k<entry.link.length;k++){if(entry.link[k].rel=='alternate'){posturl=entry.link[k].href;break}}posttitle=posttitle.link(posturl);var readmorelink="(more)";readmorelink=readmorelink.link(posturl);var postdate=entry.published.$t;var cdyear=postdate.substring(0,4);var cdmonth=postdate.substring(5,7);var cdday=postdate.substring(8,10);var monthnames=new Array();monthnames[1]="Jan";monthnames[2]="Feb";monthnames[3]="Mar";monthnames[4]="Apr";monthnames[5]="May";monthnames[6]="Jun";monthnames[7]="Jul";monthnames[8]="Aug";monthnames[9]="Sep";monthnames[10]="Oct";monthnames[11]="Nov";monthnames[12]="Dec";if("content"in entry){var postcontent=entry.content.$t}else if("summary"in entry){var postcontent=entry.summary.$t}else var postcontent="";var re=/<\S[^>]*>/g;postcontent=postcontent.replace(re,"");document.write(posttitle);if(showpostdate==true)document.write(' - '+monthnames[parseInt(cdmonth,10)]+' '+cdday);if(showpostsummary==true){if(postcontent.length<numchars){document.write(postcontent)}else{postcontent=postcontent.substring(0,numchars);var quoteEnd=postcontent.lastIndexOf(" ");postcontent=postcontent.substring(0,quoteEnd);document.write(postcontent+'...'+readmorelink)}}document.write('</li>')}document.write('</ul>')}
      //]]>
    </script>
<script type="text/javascript">
      summary_noimg = 300;
      summary_img = 250;
      img_thumb_height = 150;
      img_thumb_width = 200; 
    </script>
<script type="text/javascript">
      //<![CDATA[
      function removeHtmlTag(strx,chop){ 
        if(strx.indexOf("<")!=-1)
                        {
                        var s = strx.split("<"); 
                        for(var i=0;i<s.length;i++){ 
                          if(s[i].indexOf(">")!=-1){ 
           s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length);
      } 
      } 
      strx =  s.join(""); 
      }
      chop = (chop < strx.length-1) ? chop : strx.length-2; 
      while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++; 
      strx = strx.substring(0,chop-1); 
      return strx+'...'; 
      }
      function createSummaryAndThumb(pID){
        var div = document.getElementById(pID);
        var imgtag = "";
        var img = div.getElementsByTagName("img");
        var summ = summary_noimg;
        if(img.length>=1) {	
          imgtag = '<img src="'+img[0].src+'" class="pbtthumbimg"/>';
          summ = summary_img;
        }else
        {
          imgtag = '<img src="img/b/R29vZ2xl/AVvXsEhE1zOOD2Yogs6DBs2IsWIVIO9zolzNG9FRmDqq5qQ26iyPoHt4Y0RvZG4_YQUG4NBy3bswEbGDKxy-5lPr9N1j53WJ0Z423N3ofFuVGIvLBA-8NnjoTuCOoiqYK5Jj6uOEWgOiYYOwPhc/s1600/no-img-100.png" class="pbtthumbimg"/>';
          summ = summary_img;
        }
        var summary = imgtag + '<div>' + removeHtmlTag(div.innerHTML,summ) + '</div>';
        div.innerHTML = summary;
      }
      //]]>
    </script>
<script type="text/javascript">
      //<![CDATA[ 
      /* var x=document.getElementsByTagName('pre');
      for (var i = 0; i < x.length; ++i) {
        var item = x[i];  
        console.log(item);
         $("<!--INFOLINKS_OFF-->").insertBefore(item); 
        $("<!–-INFOLINKS_ON–->").insertAfter(item);
      }*/
      //]]>
    </script>
<!-- Highlight.js Additions START <link rel="stylesheet" href="https://drive.google.com/file/d/0B5ODELs3mMtIQlptbHU4UzZWZ1U/view?usp=sharing" /> <script type='text/javascript' src="https://drive.google.com/file/d/0B5ODELs3mMtILTdPY0RReVJ4VjQ/view?usp=sharing"></script> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/styles/default.min.css" /> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/highlight.min.js"></script> <script type='text/javascript'> hljs.initHighlightingOnLoad(); /*$(document).ready(function() { $('pre').each(function(i, block) { hljs.highlightBlock(block); }); });*/</script>-->
<!-- Syntax Highlighter Additions START -->
<link href="ajax/libs/SyntaxHighlighter/3.0.83/styles/shCore.css" rel="stylesheet" type="text/css"/>
<link href="ajax/libs/SyntaxHighlighter/3.0.83/styles/shThemeDefault.css" rel="stylesheet" type="text/css"/>
<script src="ajax/libs/SyntaxHighlighter/3.0.83/scripts/shCore.js" type="text/javascript"></script>
<script src="ajax/libs/SyntaxHighlighter/3.0.83/scripts/shBrushJava.js" type="text/javascript"></script>
<script src="ajax/libs/SyntaxHighlighter/3.0.83/scripts/shBrushJScript.min.js" type="text/javascript"></script>
<script src="ajax/libs/SyntaxHighlighter/3.0.83/scripts/shBrushXml.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
      SyntaxHighlighter.config.bloggerMode = true;
      SyntaxHighlighter.defaults['smart-tabs'] = true;
                                 SyntaxHighlighter.defaults['toolbar'] = true;
                                 SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf';
                                 //SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.1.364/scripts/clipboard.swf';
                                 //dp.SyntaxHighlighter.ClipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.1.364/scripts/clipboard.swf';
                                 // dp.SyntaxHighlighter.HighlightAll('code');
                                 SyntaxHighlighter.all();
    </script>
<!-- Syntax Highlighter Additions END -->
<!-- Google Web Analytics Code Start -->
<script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
                                 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
         ga('create', 'UA-31672380-1', 'auto');
         ga('send', 'pageview');
    </script>
<!-- Google Web Analytics Code End -->
<!-- Google Page level Ads Code -->
	<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
  (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: "ca-pub-1848356197175383",
    enable_page_level_ads: true
  });
</script>
<script>
$(document).ready(function(){   
    setTimeout(function () {
if(localStorage.getItem('popState') != 'shown'){
        $("#cookieConsent").fadeIn(200);
localStorage.setItem('popState','shown')
}
     }, 4000);
    $("#closeCookieConsent, .cookieConsentOK").click(function() {
        $("#cookieConsent").fadeOut(200);
    }); 
});
    </script>
<link href="https://www.blogger.com/dyn-css/authorization.css?targetBlogID=1310888148096212123&amp;zx=8d90f4c0-e0f8-4e58-8652-07b60c5006f6" media="none" onload="if(media!='all')media='all'" rel="stylesheet"/><noscript><link href="https://www.blogger.com/dyn-css/authorization.css?targetBlogID=1310888148096212123&amp;zx=8d90f4c0-e0f8-4e58-8652-07b60c5006f6" rel="stylesheet"/></noscript>
<meta name="google-adsense-platform-account" content="ca-host-pub-1556223355139109"/>
<meta name="google-adsense-platform-domain" content="blogspot.com"/>
<!-- data-ad-client=ca-pub-1848356197175383 -->
</head>
<body>
<!--start:NAVIGATION -->
<header class="headernbt">
<div class="logonbt">
<div class="headersec section" id="headersec"><div class="widget Header" data-version="1" id="Header1">
<h1 class="site-titlenbt">
<a href="/">
AndroProgrammer
</a>
</h1>
</div></div>
</div>
<a class="hamburgernbt" href="#menu">
<i class="fa fa-bars"></i>
</a>
<nav class="menunbt" role="navigation">
<ul class="menu-listnbt">
<!--<li class='menu-item'> <a expr:href='data:blog.homepageUrl'> Home </a> </li> -->
<li class="menu-item">
<a href="p/blog-page_3">
              About us
            </a>
</li>
<li class="menu-item">
<a href="p/contact-us">
              Contact us
            </a>
</li>
<!-- <li class='menu-item'> <a href='http://www.androprogrammer.com/p/blog-page.html'> Read All Posts </a> </li> -->
<li class="menu-item">
<a href="p/privacy-policy">
              Privacy Policy
            </a>
</li>
</ul>
</nav>
</header>
<!--end: NAVIGATION -->
<!--start:CONTAINER -->
<div class="containernbt">
<div class="rownbt" role="main">
<div class="col-8">
<div class="mainblogsec section" id="mainblogsec"><div class="widget HTML" data-version="1" id="HTML1">
<div class="widget-content">
<center><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- 5th Add Horizontal -->
<ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-1848356197175383" data-ad-slot="6671652159"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></center>
</div>
<div class="clear"></div>
</div><div class="widget Blog" data-version="1" id="Blog1">
<div class="blog-posts hfeed">
<!--Can't find substitution for tag [defaultAdStart]-->
                        <div class="date-outer">
                        <div class="date-posts">
<div class="post-outer">
<article class="post hentry" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<meta content="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMNCBnE8AJ59UvhFwqFaYgfyivKhKBckZd_4gsWMSDCli1ekqb73orETH9w4Qwy3wdHFKb-A8joPr2ULcmtPJsyqvUiD7qWKtNkThYVDnGeMTYF0QDjJOnui0IZcSu5D5PBPZ3NcQuEV8/w400-h335/Screenshot+from+2020-09-07+22-05-38.png" itemprop="image"/>
<a name="7458798973073812248"></a>
<h3 class="post-title entry-title" itemprop="name">
<a href="2020/09/add-firebase-crashlytics-in-ionic">
Add Firebase Crashlytics In Ionic Application
</a>
</h3>
<p class="entry-metanbt">
<span class="post-author vcard">
                          by&nbsp;
<span class="fn" itemprop="author" itemscope="itemscope" itemtype="http://schema.org/Person">
<meta content="https://www.blogger.com/profile/02101887469831067177" itemprop="url"/>
<a class="g-profile" href="https://www.blogger.com/profile/02101887469831067177" rel="author" title="author profile">
<span itemprop="name">
Wasim Memon
</span>
</a>
</span>
</span>
                        / 
                        in 
<a href="search/label/Crashlytics" rel="tag">
Crashlytics
</a>
                            , 
<a href="search/label/Errorreporting" rel="tag">
Error reporting
</a>
                            , 
<a href="search/label/HybridApp" rel="tag">
Hybrid App
</a>
                            , 
<a href="search/label/Ionic" rel="tag">
Ionic
</a>
                            , 
<a href="search/label/ionicandroid" rel="tag">
ionic android
</a>
                        / 
                        with 
                        <a href="2020/09/add-firebase-crashlytics-in-ionic#comment-form" >
                            No comments
</a>
                        / 
</p>
<div class="post-header-line-1"></div>
<div class="post-body entry-content" id="post-body-7458798973073812248" itemprop="articleBody">
<div id="summary7458798973073812248">
<p>Firebase is combination of really nice tools/services for the developers like Crashlytics, Cloud messaging, Real time Database, Analytics and much more. From them Crashlytics is widely used by developers to get real time crash events and problem insights from the Mobile applications. Crashlytics was initially developed by Twitter and It was under the Fabric services. But From March 2020 Crashlytics have joined the Firebase services family.</p><p><br/></p><p>In this tutorial I am going to use this cordova plugin. Plugin has latest  AndroidX compatible firebase libraries. so app can support Android-29+ Api.</p><p><br/>Github Link - <a href="https://github.com/dpa99c/cordova-plugin-firebasex" rel="nofollow" target="_blank">dpa99c/cordova-plugin-firebasex</a></p><p></p><p><br/></p><p><b>Step - 1</b>&nbsp;</p><p>Create Project in Firebase console</p><p>Goto <a href="https://console.firebase.google.com/" rel="nofollow" target="_blank">Firebase</a> Console, then click on add project if it was not created prior to this. If its first time you will see form like below to create your project.</p><p>&nbsp;</p><div class="separator" style="clear: both; text-align: center;"><a href="images/s758/Screenshot-from-2020-09-07-22-05-38.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="636" data-original-width="758" height="335" src="images/w400-h335/Screenshot-from-2020-09-07-22-05-38.png" width="400"/></a></div><br/><p><b>Step - 2</b></p><p>Now project is created. So let's start crashlytics for the project. I<span>n side menu Quality &gt; Crashlytics or you can swipe down on main page till you can see crashlytics menu.&nbsp;</span></p><p><span>Enable crashlytics for project by filling form like below. You have fill few details of your project like Project name, Project application Id/ Bundle identifier and SHA-1 key for debug build. You can check <a href="https://stackoverflow.com/questions/55496090/how-to-get-sha1-of-android-app-in-vs-code" rel="nofollow" target="_blank">this Stackoverflow post</a> for SHA-1.&nbsp;</span></p><p><span>&nbsp;</span></p><p><span></span></p><div class="separator" style="clear: both; text-align: center;"><a href="images/s665/Screenshot-from-2020-09-07-22-07-25.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="604" data-original-width="665" height="364" src="images/w400-h364/Screenshot-from-2020-09-07-22-07-25.png" width="400"/></a></div>&nbsp;<p></p><p><span>After that step make sure you download <b>google-services.json. </b>This file contains configuration regarding project. complete all the steps and skip in last step as we need to code yet for logging events from the app. Make sure you put this json file in root directory of your project.</span></p><p><span></span><br/></p><p><b>Step - 3</b>&nbsp;</p><p>Add plugin into project</p><pre><code>cordova plugin add cordova-plugin-firebasex</code></pre><p><br/><b>Step - 4</b>&nbsp;</p><p>Create class to handle all errors at runtime</p><p><b>AppErrorHandler.ts</b><br/></p>
<pre class="brush:js;">import { Injectable, ErrorHandler } from '@angular/core';
import * as stacktrace from 'stacktrace-js';
import { FirebaseX } from "@ionic-native/firebase-x/ngx";
@Injectable({providedIn: 'root'})
export class AppErrorHandler implements ErrorHandler {
  public Tag = "AppErrorHandler"
  constructor (private firebase: FirebaseX) {}
  handleError(error: any): void {
      // do something with the error
      console.log(error);
      stacktrace.get().then(
          trace =&gt; this.firebase.logError(this.Tag + " Error =&gt;" + error + "Trace =&gt;" + trace)
      );
  }
}
</pre><p><b>Step - 5</b>&nbsp;</p><p>Define above class as Custom error handler in&nbsp;</p><p><b>App.module.ts</b><br/></p>
<pre class="brush:js;">import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy, ModalController } from '@ionic/angular';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { Diagnostic } from '@ionic-native/diagnostic/ngx';
import { FirebaseX } from "@ionic-native/firebase-x/ngx";
import { CommonUtilService } from './services/commonutil.service';
import { AppErrorHandler } from './services/apperrorhandler';
@NgModule({
  declarations: [AppComponent, NotificationsComponent],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    IonicModule.forRoot(),
    AppRoutingModule,
  ],
  providers: [
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
    { provide: ErrorHandler, useClass: AppErrorHandler },
    StatusBar,
    Diagnostic,
    FirebaseX
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
</pre><br/>Well setup and coding both done. now run the app in android emulator or device. As it has dependency on android platform. For testing put below code in your main page to simulate crash.<br/>
<pre class="brush:js;">this.firebase.sendCrash();
</pre> That's it from my side. Now run 
the app and see the result. If you have any query please let me know in 
below comment box.<br/>
<br/>
keep coding... :)
</div>
<script type="text/javascript">
                          createSummaryAndThumb("summary7458798973073812248");</script>
<div style="float:right;padding-right:10px;margin-top:10px;">
<a class="readmorenbt" href="2020/09/add-firebase-crashlytics-in-ionic">
                            Read More
                          </a>
</div>
<div style="clear: both;"></div>
</div>
<div class="pbtsharethisbutt">
<ul class="pbt-social-icons">
<li class="Share-this-arti">
                          Share This:&nbsp;&nbsp;
                        </li>
<li class="pbtfacebook">
<a href="https://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=https://www.androprogrammer.com/2020/09/add-firebase-crashlytics-in-ionic.html&amp;t=Add Firebase Crashlytics In Ionic Application" onclick="window.open(this.href,&quot;sharer&quot;,&quot;toolbar=0,status=0,width=626,height=436&quot;); return false;" rel="nofollow" target="_blank" title="Share this on Facebook">
<i class="fa fa-facebook-square"></i>
                            &nbsp;Facebook
                          </a>
</li>
<li class="pbttwitter">
<a href="https://twitter.com/home?status=Add Firebase Crashlytics In Ionic Application -- https://www.androprogrammer.com/2020/09/add-firebase-crashlytics-in-ionic.html" rel="nofollow" target="_blank" title="Tweet This!">
<i class="fa fa-twitter-square"></i>
                            &nbsp;Twitter
                          </a>
</li>
<li class="pbtgoogle">
<a href="https://plus.google.com/share?url=https://www.androprogrammer.com/2020/09/add-firebase-crashlytics-in-ionic.html" onclick="javascript:window.open(this.href,   &quot;&quot;, &quot;menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600&quot;);return false;" rel="nofollow" target="_blank" title="Share this on Google+">
<i class="fa fa-google-plus-square"></i>
                            &nbsp;Google+
                          </a>
</li>
<li class="pbtstumbleupon">
<a href="http://www.stumbleupon.com/submit?url=https://www.androprogrammer.com/2020/09/add-firebase-crashlytics-in-ionic.html&amp;title=Add Firebase Crashlytics In Ionic Application" rel="nofollow" target="_blank" title="Stumble upon something good? Share it on StumbleUpon">
<i class="fa fa-stumbleupon-circle"></i>
                            &nbsp;Stumble
                          </a>
</li>
<li class="pbtdigg">
<a href="http://digg.com/submit?phase=2&amp;url=https://www.androprogrammer.com/2020/09/add-firebase-crashlytics-in-ionic.html&amp;title=Add Firebase Crashlytics In Ionic Application" rel="nofollow" target="_blank" title="Digg this!">
<i class="fa fa-digg"></i>
                            &nbsp;Digg
                          </a>
</li>
</ul>
</div>
<div style="clear: both;"></div>
</article>
<div style="clear: both;"></div>
</div>
                          </div></div>
                        <div class="date-outer">
                        <div class="date-posts">
<div class="post-outer">
<article class="post hentry" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<meta content="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih0qCjIrDWXmAtOfHxH7nS_b0UuStqONmIX5G5mFTcrDV1NtK1K1qwyT5sfkzAbY_bjoK4F-C0x-beCXSKyZegILAlPvzlwxhhN3lo7Yl2nLkHHOxiXZp4-A7GgkY-I1H0rAHVuEpSSp8/s1600/espresso_web_demo.png" itemprop="image"/>
<a name="658840687311534658"></a>
<h3 class="post-title entry-title" itemprop="name">
<a href="2019/03/espresso-web-ui-test-framework-for">
Espresso Web - UI Test Framework For Android Webview  
</a>
</h3>
<p class="entry-metanbt">
<span class="post-author vcard">
                          by&nbsp;
<span class="fn" itemprop="author" itemscope="itemscope" itemtype="http://schema.org/Person">
<meta content="https://www.blogger.com/profile/02101887469831067177" itemprop="url"/>
<a class="g-profile" href="https://www.blogger.com/profile/02101887469831067177" rel="author" title="author profile">
<span itemprop="name">
Wasim Memon
</span>
</a>
</span>
</span>
                        / 
                        in 
<a href="search/label/Android" rel="tag">
Android
</a>
                            , 
<a href="search/label/AutomationTesting" rel="tag">
Automation Testing
</a>
                            , 
<a href="search/label/Espresso" rel="tag">
Espresso
</a>
                            , 
<a href="search/label/UITestcase" rel="tag">
UI Testcase
</a>
                        / 
                        with 
                        <a href="2019/03/espresso-web-ui-test-framework-for#comment-form" >
                            No comments
</a>
                        / 
</p>
<div class="post-header-line-1"></div>
<div class="post-body entry-content" id="post-body-658840687311534658" itemprop="articleBody">
<div id="summary658840687311534658">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;">
Espresso web library give you an Espresso-like feel to interacting with WebViews. From espresso 2.2 webview support module was added to the espresso lineup.<br/>
<br/>
<b>Prerequisite</b> - You must have used espresso for native UI test cases. otherwise some of the methods you don't know we have used in code.&nbsp; <br/>
<br/>
<a href="https://developer.android.com/training/testing/espresso/web">Espresso Web</a> allows to perform ViewActions using Web Driver Atoms. Atoms is a thin wrapper around javascript. So it turns out specifying element and action are executed by the atoms. DriverAtom is utils collection class with useful methods like clearElement, webClick, webKeys etc.</div>
<br/>
<div dir="ltr" style="text-align: left;">
<br/>
<div class="separator" style="clear: both; text-align: center;">
<a href="images/s1600/espresso_web_demo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Espresso Web - UI Test Framework For Android Webview  " border="0" data-original-height="512" data-original-width="1024" src="images/s1600/espresso_web_demo.png" title="Espresso Web - UI Test Framework For Android Webview  "/></a></div>
<br/>
Some time in mobile application we open web pages inside our app for some of features like login or registration or various payment methods etc. and those module required to test thoroughly so to do that espresso provide Espresso Web Api.<br/>
<!-- Adsense --><br/>
<br/>
There are many ways to identify HTML element to perform action on element like using its Id, Name, Tag ,XPath etc you can find more about in <a href="https://developer.android.com/reference/android/support/test/espresso/web/webdriver/Locator?hl=en">Locator</a> class in espresso web library. In this tutorial I am going to write the most used Locators for writing test cases for web pages in android.</div>
<br/>
<div dir="ltr" style="text-align: left;">
Gradle file change</div>
<br/>
<pre class="brush:java; toolbar:true">// For espresso web view testcases
androidTestImplementation 'com.android.support.test.espresso:espresso-web:3.0.2'
</pre>
<br/>
<div dir="ltr" style="text-align: left;">
OR if you are using androidx libraries add </div>
<pre class="brush:java; toolbar:true">androidTestImplementation 'androidx.test.espresso:espresso-web:3.1.0'
</pre>
<br/>
<pre class="brush:java; toolbar:true">private void withIdHasTextInWebView(int webViewId, String elementId, String text) {
    Web.onWebView(ViewMatchers.withId(webViewId))
            .withElement(DriverAtoms.findElement(Locator.ID, elementId))
            .withNoTimeout()
            .check(WebViewAssertions.webMatches(DriverAtoms.getText(),
             Matchers.equalTo(text)));
}
</pre>
<br/>
<div dir="ltr" style="text-align: left;">
In above code as you can see we are testing weather particular element has given text (label test) in HTML code in webview. To find element from HTML code we are using static <b>findElement()</b> method from DriverAtoms util class. &nbsp; <a href="https://developer.android.com/reference/android/support/test/espresso/web/sugar/Web.WebInteraction.html#withNoTimeout()" rel="nofollow" target="_blank">WithNoTimeout()</a> method disable wait of javascript thread. Javascript takes some time pause of few millisecond before delivering result but we don't want that to happen so we are using this method. After that we are using <b>check()</b> method same as we have in espresso core library. <br/>
<br/>
<pre class="brush:java; toolbar:true">private void withTagHasTextInWebView(int webViewId, String tagName, String text) {
    Web.onWebView(ViewMatchers.withId(webViewId))
            .withElement(DriverAtoms.findElement(Locator.TAG_NAME, tagName))
            .withNoTimeout()
            .check(WebViewAssertions.webMatches(DriverAtoms.getText(),
                Matchers.equalTo(text)));
}
</pre>
You can also perform above test on the basis of element tag also. If you know element tag instead of its Id or have same id used for multiple elements. So as you can see we are testing particular label with "xyz" tag have "xyz" text.<br/>
<br/>
<pre class="brush:java; toolbar:true">private void withXPathHasTextInWebView(int webViewId, String xpath, String text) {
    Web.onWebView(ViewMatchers.withId(webViewId))
            .withElement(DriverAtoms.findElement(Locator.XPATH, xpath))
            .withNoTimeout()
            .check(WebViewAssertions.webMatches(DriverAtoms.getText(),
                    Matchers.equalTo(text)));
}
</pre>
<br/>
Some time you don't know Id or even element have no Tag defined but still we need to test particular label has given text or not. so espresso even support XPath of the element from HTML code.<br/>
<br/>
That's it from my side. Now run the app and see the result. If you have any query please let me know in below comment box.<br/>
<br/>
keep coding... :)<br/>
<br/>
<span style="font-size: large;"><b><a href="https://github.com/WasimMemon/Myapplications/tree/master/Tutorials" rel="nofollow" target="_blank">Source code</a></b></span><br/>
<br/></div>
</div>
</div>
<script type="text/javascript">
                          createSummaryAndThumb("summary658840687311534658");</script>
<div style="float:right;padding-right:10px;margin-top:10px;">
<a class="readmorenbt" href="2019/03/espresso-web-ui-test-framework-for">
                            Read More
                          </a>
</div>
<div style="clear: both;"></div>
</div>
<div class="pbtsharethisbutt">
<ul class="pbt-social-icons">
<li class="Share-this-arti">
                          Share This:&nbsp;&nbsp;
                        </li>
<li class="pbtfacebook">
<a href="https://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=https://www.androprogrammer.com/2019/03/espresso-web-ui-test-framework-for.html&amp;t=Espresso Web - UI Test Framework For Android Webview  " onclick="window.open(this.href,&quot;sharer&quot;,&quot;toolbar=0,status=0,width=626,height=436&quot;); return false;" rel="nofollow" target="_blank" title="Share this on Facebook">
<i class="fa fa-facebook-square"></i>
                            &nbsp;Facebook
                          </a>
</li>
<li class="pbttwitter">
<a href="https://twitter.com/home?status=Espresso Web - UI Test Framework For Android Webview   -- https://www.androprogrammer.com/2019/03/espresso-web-ui-test-framework-for.html" rel="nofollow" target="_blank" title="Tweet This!">
<i class="fa fa-twitter-square"></i>
                            &nbsp;Twitter
                          </a>
</li>
<li class="pbtgoogle">
<a href="https://plus.google.com/share?url=https://www.androprogrammer.com/2019/03/espresso-web-ui-test-framework-for.html" onclick="javascript:window.open(this.href,   &quot;&quot;, &quot;menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600&quot;);return false;" rel="nofollow" target="_blank" title="Share this on Google+">
<i class="fa fa-google-plus-square"></i>
                            &nbsp;Google+
                          </a>
</li>
<li class="pbtstumbleupon">
<a href="http://www.stumbleupon.com/submit?url=https://www.androprogrammer.com/2019/03/espresso-web-ui-test-framework-for.html&amp;title=Espresso Web - UI Test Framework For Android Webview  " rel="nofollow" target="_blank" title="Stumble upon something good? Share it on StumbleUpon">
<i class="fa fa-stumbleupon-circle"></i>
                            &nbsp;Stumble
                          </a>
</li>
<li class="pbtdigg">
<a href="http://digg.com/submit?phase=2&amp;url=https://www.androprogrammer.com/2019/03/espresso-web-ui-test-framework-for.html&amp;title=Espresso Web - UI Test Framework For Android Webview  " rel="nofollow" target="_blank" title="Digg this!">
<i class="fa fa-digg"></i>
                            &nbsp;Digg
                          </a>
</li>
</ul>
</div>
<div style="clear: both;"></div>
</article>
<div style="clear: both;"></div>
</div>
                          </div></div>
                        <div class="date-outer">
                        <div class="date-posts">
<div class="post-outer">
<article class="post hentry" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<meta content="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoqmzC2mu4TPEODTTbm28b7LpuRlPyVePfbz0V7mJoYxPQJhcxxqZT91UFyjoU97ovGZDPehd7ZMs9nmSld3Sp59dSbo_4nsuxZ90dxmqypA2C599YAfG2EuhAUZRGK1PfHdDQRSIn-wA/s640/errorPageDemo.png" itemprop="image"/>
<a name="4928880250216571464"></a>
<h3 class="post-title entry-title" itemprop="name">
<a href="2018/09/load-custom-error-page-in-android">
Load Custom Error Page in Android WebView
</a>
</h3>
<p class="entry-metanbt">
<span class="post-author vcard">
                          by&nbsp;
<span class="fn" itemprop="author" itemscope="itemscope" itemtype="http://schema.org/Person">
<meta content="https://www.blogger.com/profile/02101887469831067177" itemprop="url"/>
<a class="g-profile" href="https://www.blogger.com/profile/02101887469831067177" rel="author" title="author profile">
<span itemprop="name">
Wasim Memon
</span>
</a>
</span>
</span>
                        / 
                        in 
<a href="search/label/Android" rel="tag">
Android
</a>
                            , 
<a href="search/label/AndroidWebView" rel="tag">
Android WebView
</a>
                            , 
<a href="search/label/Security" rel="tag">
Security
</a>
                        / 
                        with 
                        <a href="2018/09/load-custom-error-page-in-android#comment-form" >
                            No comments
</a>
                        / 
</p>
<div class="post-header-line-1"></div>
<div class="post-body entry-content" id="post-body-4928880250216571464" itemprop="articleBody">
<div id="summary4928880250216571464">
<div dir="ltr" style="text-align: left;" trbidi="on"><div class="tr_bq">Network connectivity is very fluctuating in mobile devices. User may be using your app in Hi-Speed internet or low-Speed internet. whenever there is low internet connection or no connection User device Android webview display actual URL with some error messages. So you have to check your app in all environments. Otherwise you may leak your website URL accidentally which may consist of URL parameters. You never know your user is normal user or hacker so this way you can leak some data to any one. So to make your app secure follow this tutorial and create your own error page for your application.<br/>
<br/>
<div class="separator" style="clear: both; text-align: center;"><a href="img/b/R29vZ2xl/AVvXsEjoqmzC2mu4TPEODTTbm28b7LpuRlPyVePfbz0V7mJoYxPQJhcxxqZT91UFyjoU97ovGZDPehd7ZMs9nmSld3Sp59dSbo_4nsuxZ90dxmqypA2C599YAfG2EuhAUZRGK1PfHdDQRSIn-wA/s1600/errorPageDemo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Load Custom Error Page" border="0" data-original-height="512" data-original-width="1024" height="320" src="img/b/R29vZ2xl/AVvXsEjoqmzC2mu4TPEODTTbm28b7LpuRlPyVePfbz0V7mJoYxPQJhcxxqZT91UFyjoU97ovGZDPehd7ZMs9nmSld3Sp59dSbo_4nsuxZ90dxmqypA2C599YAfG2EuhAUZRGK1PfHdDQRSIn-wA/s640/errorPageDemo.png" title="Load Custom Error Page in Android WebView" width="640"/></a></div></div><br/>
Android Webview widget have very handful methods which you can use to identify error types and display message accordingly. In this tutorial I am going to display my default error page in all cases and network message if internet connection is not available. But you can implement it as per your requirement with different error types like Unauthorized web page, SSL error etc.<br/>
<!-- Adsense --> <br/>
<br/>
<blockquote><b>WebViewCustomizationDemo.java</b></blockquote><pre class="brush:java; toolbar:true">package com.androprogrammer.tutorials.samples;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Bitmap;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;
import android.transition.Explode;
import android.transition.Transition;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.webkit.JavascriptInterface;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import com.androprogrammer.tutorials.R;
import com.androprogrammer.tutorials.activities.Baseactivity;
import com.androprogrammer.tutorials.util.Common;
import butterknife.Bind;
import butterknife.ButterKnife;
public class WebViewCustomizationDemo extends Baseactivity {
    @Bind(R.id.progress_loading)
    ProgressBar progressLoading;
    @Bind(R.id.wv_customization)
    WebView wvCustomization;
    private View viewLayout;
    private String pageUrl = "https://www.androprogrammer.com/errorPage.html";
    private String DEFAULT_ERROR_PAGE_PATH = "file:///android_asset/html/default_error_page.html";
    private static final String TAG = "WebViewCustomization";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
            //set the transition
            Transition ts = new Explode();
            ts.setDuration(5000);
            getWindow().setEnterTransition(ts);
            getWindow().setExitTransition(ts);
        }
        super.onCreate(savedInstanceState);
        setReference();
        setSimpleToolbar(true);
        setToolbarElevation(getResources().getDimension(R.dimen.elevation_normal));
        setToolbarSubTittle(this.getClass().getSimpleName());
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
    @Override
    public void setReference() {
        viewLayout = LayoutInflater.from(this).inflate(R.layout.activity_web_customization, container);
        ButterKnife.bind(this, viewLayout);
        wvCustomization.clearHistory();
        wvCustomization.getSettings().setAppCacheEnabled(false);
        wvCustomization.getSettings().setJavaScriptEnabled(true);
        wvCustomization.addJavascriptInterface(new SimpleWebJavascriptInterface(this), "Android");
        wvCustomization.setWebViewClient(new MyWebViewClient());
        wvCustomization.loadUrl(pageUrl);
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            // Respond to the action bar's Up/Home button
            case android.R.id.home:
                finish();
                break;
        }
        return super.onOptionsItemSelected(item);
    }
    @Override
    public void onBackPressed() {
        if (wvCustomization.canGoBack()) {
            wvCustomization.goBack();
        } else {
            finish();
        }
    }
    private class MyWebViewClient extends WebViewClient {
        @Override public boolean shouldOverrideUrlLoading(WebView view, String url) {
            Log.d(TAG, "--" + url);
            return true;
        }
        @Override
        public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
            String message = null;
            switch (error.getPrimaryError()) {
                case SslError.SSL_UNTRUSTED:
                    message = "The certificate authority is not trusted.";
                    break;
                case SslError.SSL_EXPIRED:
                    message = "The certificate has expired.";
                    break;
                case SslError.SSL_IDMISMATCH:
                    message = "The certificate Hostname mismatch.";
                    break;
                case SslError.SSL_INVALID:
                    message = "SSL connection is invalid.";
                    break;
            }
            // display error dialog with title and message
            Common.showDialog(WebViewCustomizationDemo.this, "SSL Certificate Error", message,
                    getResources().getString(android.R.string.ok),
                    null, null, 1);
        }
        @SuppressLint("NewApi")
        @Override
        public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
            if (request.isForMainFrame() && error != null) {
                view.loadUrl(DEFAULT_ERROR_PAGE_PATH);
            }
        }
        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            if (errorCode != WebViewClient.ERROR_UNSUPPORTED_SCHEME && errorCode != WebViewClient.ERROR_HOST_LOOKUP) {
                view.loadUrl(DEFAULT_ERROR_PAGE_PATH);
            }
        }
        @Override public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
            if (progressLoading != null) {
                progressLoading.setVisibility(View.VISIBLE);
                wvCustomization.setVisibility(View.GONE);
            }
        }
        @Override public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            if (progressLoading != null) {
                progressLoading.setVisibility(View.GONE);
                wvCustomization.setVisibility(View.VISIBLE);
            }
        }
    }
}
</pre><blockquote class="tr_bq"><b>layout/activity_web_customization_demo.xml</b></blockquote><!--INFOLINKS_OFF--><br/>
<pre class="brush:xml;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/layout_webView_loader"
    android:background="@android:color/transparent"
    tools:background="@android:color/black"
    android:fitsSystemWindows="false"&gt;
    &lt;ProgressBar
        android:id="@+id/progress_loading"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:layout_gravity="center"
        android:visibility="gone"
        style="?android:attr/progressBarStyle" /&gt;
    &lt;WebView
        android:id="@+id/wv_customization"
        android:layout_width="match_parent"
        android:layout_height="match_parent" /&gt;
&lt;/RelativeLayout&gt;
</pre><br/>
Android webview even allow custom javascript interface also which allow to instantiate our class method also from webpage. But this is only available after Android Kitkat (Android Api 19). Below code will allow you to listen java script actions in webview and on the basis of that you can&nbsp; call class methods. As you can see it display my custom html page insted of url and native UI for webview this way it won't leak any info of my website incase of any error.<br/>
<br/>
<pre class="brush:java; toolbar:true">public class SimpleWebJavascriptInterface {
 Activity activity;
 public SimpleWebJavascriptInterface(Activity activity) {
  this.activity = activity;
 }
 @JavascriptInterface
 public void reloadWebPage() {
  activity.runOnUiThread(new Runnable() {
   @Override public void run() {
    wvCommonViewer.loadUrl(pageUrl);
   }
  });
}
</pre><br/>
That's it from my side. for html code checkout my github repo. Now run the app and see the result. If you have any query please let me know in below comment box.<br/>
<br/>
keep coding... :)<br/>
<br/>
<span style="font-size: large;"><b><a href="https://github.com/WasimMemon/Myapplications/tree/master/Tutorials" rel="nofollow" target="_blank">Source code</a></b></span> </div>
</div>
<script type="text/javascript">
                          createSummaryAndThumb("summary4928880250216571464");</script>
<div style="float:right;padding-right:10px;margin-top:10px;">
<a class="readmorenbt" href="2018/09/load-custom-error-page-in-android">
                            Read More
                          </a>
</div>
<div style="clear: both;"></div>
</div>
<div class="pbtsharethisbutt">
<ul class="pbt-social-icons">
<li class="Share-this-arti">
                          Share This:&nbsp;&nbsp;
                        </li>
<li class="pbtfacebook">
<a href="https://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=https://www.androprogrammer.com/2018/09/load-custom-error-page-in-android.html&amp;t=Load Custom Error Page in Android WebView" onclick="window.open(this.href,&quot;sharer&quot;,&quot;toolbar=0,status=0,width=626,height=436&quot;); return false;" rel="nofollow" target="_blank" title="Share this on Facebook">
<i class="fa fa-facebook-square"></i>
                            &nbsp;Facebook
                          </a>
</li>
<li class="pbttwitter">
<a href="https://twitter.com/home?status=Load Custom Error Page in Android WebView -- https://www.androprogrammer.com/2018/09/load-custom-error-page-in-android.html" rel="nofollow" target="_blank" title="Tweet This!">
<i class="fa fa-twitter-square"></i>
                            &nbsp;Twitter
                          </a>
</li>
<li class="pbtgoogle">
<a href="https://plus.google.com/share?url=https://www.androprogrammer.com/2018/09/load-custom-error-page-in-android.html" onclick="javascript:window.open(this.href,   &quot;&quot;, &quot;menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600&quot;);return false;" rel="nofollow" target="_blank" title="Share this on Google+">
<i class="fa fa-google-plus-square"></i>
                            &nbsp;Google+
                          </a>
</li>
<li class="pbtstumbleupon">
<a href="http://www.stumbleupon.com/submit?url=https://www.androprogrammer.com/2018/09/load-custom-error-page-in-android.html&amp;title=Load Custom Error Page in Android WebView" rel="nofollow" target="_blank" title="Stumble upon something good? Share it on StumbleUpon">
<i class="fa fa-stumbleupon-circle"></i>
                            &nbsp;Stumble
                          </a>
</li>
<li class="pbtdigg">
<a href="http://digg.com/submit?phase=2&amp;url=https://www.androprogrammer.com/2018/09/load-custom-error-page-in-android.html&amp;title=Load Custom Error Page in Android WebView" rel="nofollow" target="_blank" title="Digg this!">
<i class="fa fa-digg"></i>
                            &nbsp;Digg
                          </a>
</li>
</ul>
</div>
<div style="clear: both;"></div>
</article>
<div style="clear: both;"></div>
</div>
                          </div></div>
                        <div class="date-outer">
                        <div class="date-posts">
<div class="post-outer">
<article class="post hentry" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<meta content="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6SGOZnNp_6mpNVCTiTEwWbGAqiws9v-Rpx1A9O3bTJ2nimBU_88t9a4SR5Gpkyu3uUlHeam8eN_hxlfB-SJVfG-BBdSqJCtPoleFcu0b4X-Q9z0_5v6aoup63murHeGxJ7zJ1L6fxYTY/s640/QrcodeDemo.png" itemprop="image"/>
<a name="6729631678975921504"></a>
<h3 class="post-title entry-title" itemprop="name">
<a href="2017/05/detect-qr-code-using-google-play">
Detect QR Code Using Google Play Service Library
</a>
</h3>
<p class="entry-metanbt">
<span class="post-author vcard">
                          by&nbsp;
<span class="fn" itemprop="author" itemscope="itemscope" itemtype="http://schema.org/Person">
<meta content="https://www.blogger.com/profile/02101887469831067177" itemprop="url"/>
<a class="g-profile" href="https://www.blogger.com/profile/02101887469831067177" rel="author" title="author profile">
<span itemprop="name">
Wasim Memon
</span>
</a>
</span>
</span>
                        / 
                        in 
<a href="search/label/Android" rel="tag">
Android
</a>
                            , 
<a href="search/label/LibrariesDemo" rel="tag">
Libraries Demo
</a>
                        / 
                        with 
                        <a href="2017/05/detect-qr-code-using-google-play#comment-form" >
                            No comments
</a>
                        / 
</p>
<div class="post-header-line-1"></div>
<div class="post-body entry-content" id="post-body-6729631678975921504" itemprop="articleBody">
<div id="summary6729631678975921504">
<div dir="ltr" style="text-align: left;" trbidi="on">
In Google play service v7.8 goole developers have provided Api for Barcode & QR Code detection. Now it as been improved with new features like OCR and Object tracking and Face detection. Recently usage of QR code and Barcode scan using smart phones has become so common. So google developers have come up with official solution as Mobile Vision Api. The Mobile vision api supports both 1D and 2D bar codes, in a number of sub formats. like EAN-13, EAN-8, UPC-A, QR Code, Data Matrix etc.<br/>
<br/>
Mobile vision api has following benefits. which makes it best available option for scanning QR and Barcode<br/>
<br/>
- Fast and reliable, <br/>
- Works Offline, <br/>
- Can read barcode in any orientation (Orientation free) and<br/>
- Multiple barcode scan feature at the same time.<br/>
<br/>
In one tutorial we can not cover all scanning options so we will create sample which scan QR code and Data Matrix using device's camera.<br/>
<br/>
<b>Note:</b><br/>
As this sample is part of my full project Tutorial. You may find some methods directly used from BaseActivity so please check out full project on Github.<br/>
<br/>
<br/>
<div class="separator" style="clear: both; text-align: center;">
<a href="img/b/R29vZ2xl/AVvXsEj6SGOZnNp_6mpNVCTiTEwWbGAqiws9v-Rpx1A9O3bTJ2nimBU_88t9a4SR5Gpkyu3uUlHeam8eN_hxlfB-SJVfG-BBdSqJCtPoleFcu0b4X-Q9z0_5v6aoup63murHeGxJ7zJ1L6fxYTY/s1600/QrcodeDemo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="androprogrammer.com" border="0" height="320" src="img/b/R29vZ2xl/AVvXsEj6SGOZnNp_6mpNVCTiTEwWbGAqiws9v-Rpx1A9O3bTJ2nimBU_88t9a4SR5Gpkyu3uUlHeam8eN_hxlfB-SJVfG-BBdSqJCtPoleFcu0b4X-Q9z0_5v6aoup63murHeGxJ7zJ1L6fxYTY/s640/QrcodeDemo.png" title="Detect QR code using Google play service library" width="640"/></a></div>
<br/>
<br/>
Please follow all steps to get expected outcome using Mobile vision api.<br/>
<b><br/>
Step - 1</b><br/>
Add Vision package only from google play service<br/>
<br/>
<div class="de1">
<pre class="brush:xml; toolbar:true">compile "com.google.android.gms:play-services-vision:10.2.4"</pre>
</div>
<div class="de1">
<br/>
<b><span class="st0">Step - 2</span></b></div>
<div class="de1">
<span class="st0">Add permission and meta in AndroidManifest file.</span></div>
<br/>
<pre class="brush:xml; toolbar:true">&lt;uses-feature android:name="android.hardware.camera" /&gt;
&lt;!-- put under application tag --&gt;
&lt;meta-data
    android:name="com.google.android.gms.vision.DEPENDENCIES"
    android:value="barcode" /&gt;
</pre>
<br/>
In value attribute you can use these 3 different values. <br/>
<br/>
- barcode<br/>
- face<br/>
- ocr<span class="st0">&nbsp;</span><br/>
<div class="de2">
<br/></div>
<div class="de2">
</div>
<div class="de2">
<b><span class="st0"><span class="st0">Step - 3</span></span></b></div>
<div class="de2">
As we have taken SurfaceView to display camera output you can add custom controls over camera preview.<span class="st0">&nbsp;</span><br/>
<br/></div>
<div class="de2">
<pre class="brush:xml; toolbar:true">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/layout_barcodeReader_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    &gt;
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      &gt;
    &lt;SurfaceView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/camera_view_barcode"
        /&gt;
  &lt;/LinearLayout&gt;
&lt;/android.support.design.widget.CoordinatorLayout&gt;
</pre>
<br/></div>
<div class="de2">
<b><span class="st0"><span class="st0">Step - 4</span></span></b><br/>
To read QR code or Barcode data we have to use BarcodeDetector class and BarcodeDetector.Builder class for configuration. Using Inbuilt camera, library scan QR codes and using native library for parsing it gives data from the QR code. In this tutorial i have set Barcode detector to read QR code and Barcode ISBN code using setBarcodeFormats() method of builder class. you can set different formats as per your requirement.</div>
<div class="de2">
<br/>
<blockquote>
<b>QRCodeScanDemo.java</b></blockquote>
<br/>
<pre class="brush:java; toolbar:true">package com.androprogrammer.tutorials.samples;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.transition.Explode;
import android.transition.Transition;
import android.util.Log;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.Window;
import com.androprogrammer.tutorials.R;
import com.androprogrammer.tutorials.activities.Baseactivity;
import com.androprogrammer.tutorials.util.Common;
import com.google.android.gms.vision.CameraSource;
import com.google.android.gms.vision.Detector;
import com.google.android.gms.vision.barcode.Barcode;
import com.google.android.gms.vision.barcode.BarcodeDetector;
import java.io.IOException;
import butterknife.Bind;
import butterknife.ButterKnife;
public class QRCodeScanDemo extends Baseactivity {
 // permission request codes need to be &lt; 256
 private static final int RC_HANDLE_CAMERA_PERM = 11;
 private View viewLayout;
 @Bind(R.id.layout_barcodeReader_container)
 CoordinatorLayout layoutBarcodeReaderContainer;
 @Bind(R.id.camera_view_barcode)
 SurfaceView cameraViewBarcode;
 private CameraSource mCameraSource;
 private static final String TAG = "BarcodeReaderActivity";
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
   getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
   //set the transition
   Transition ts = new Explode();
   ts.setDuration(5000);
   getWindow().setEnterTransition(ts);
   getWindow().setExitTransition(ts);
  }
  super.onCreate(savedInstanceState);
  // base class methods
  setSimpleToolbar(true);
  setToolbarElevation(getResources().getDimension(R.dimen.elevation_normal));
  setToolbarSubTittle(this.getClass().getSimpleName());
  // To display back arrow
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  setReference();
 }
 @Override
 public void setReference() {
  viewLayout = LayoutInflater.from(this).inflate(R.layout.activity_qr_codescan_demo, container);
  ButterKnife.bind(this, viewLayout);
  // Check for the camera permission before accessing the camera.  If the
  // permission is not granted yet, request permission.
  int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
  if (rc == PackageManager.PERMISSION_GRANTED) {
   createCameraSource(true);
  } else {
   requestCameraPermission();
  }
 }
 /**
  * Handles the requesting of the camera permission.  This includes
  * showing a "Snackbar" message of why the permission is needed then
  * sending the request.
  */
 private void requestCameraPermission() {
  Log.w(TAG, "Camera permission is not granted. Requesting permission");
  final String[] permissions = new String[]{Manifest.permission.CAMERA};
  if (!ActivityCompat.shouldShowRequestPermissionRationale(this,
    Manifest.permission.CAMERA)) {
   ActivityCompat.requestPermissions(this, permissions, RC_HANDLE_CAMERA_PERM);
   return;
  }
  View.OnClickListener listener = new View.OnClickListener() {
   @Override
   public void onClick(View view) {
    ActivityCompat.requestPermissions(QRCodeScanDemo.this, permissions, RC_HANDLE_CAMERA_PERM);
   }
  };
  layoutBarcodeReaderContainer.setOnClickListener(listener);
  Snackbar.make(layoutBarcodeReaderContainer, R.string.permission_camera_rationale,
    Snackbar.LENGTH_INDEFINITE).setAction(android.R.string.ok, listener).show();
 }
 /**
  * Callback for the result from requesting permissions. This method
  * is invoked for every call on {@link #requestPermissions(String[], int)}.
  * &lt;p&gt;
  * &lt;strong&gt;Note:&lt;/strong&gt; It is possible that the permissions request interaction
  * with the user is interrupted. In this case you will receive empty permissions
  * and results arrays which should be treated as a cancellation.
  * &lt;/p&gt;
  *
  * @param requestCode  The request code passed in {@link #requestPermissions(String[], int)}.
  * @param permissions  The requested permissions. Never null.
  * @param grantResults The grant results for the corresponding permissions
  *                     which is either {@link PackageManager#PERMISSION_GRANTED}
  *                     or {@link PackageManager#PERMISSION_DENIED}. Never null.
  * @see #requestPermissions(String[], int)
  */
 @Override
 public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
                                        @NonNull int[] grantResults) {
  if (requestCode != RC_HANDLE_CAMERA_PERM) {
   Log.d(TAG, "Got unexpected permission result: " + requestCode);
   super.onRequestPermissionsResult(requestCode, permissions, grantResults);
   return;
  }
  if (grantResults.length != 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
   Log.d(TAG, "Camera permission granted - initialize the camera source");
   // permission granted, so create the camera source
   createCameraSource(true);
   return;
  }
  Log.e(TAG,
    "Permission not granted: results len = " + grantResults.length + " Result code = "
      + (grantResults.length &gt; 0 ? grantResults[0] : "(empty)"));
 }
 /**
  * Creates and starts the camera.  Note that this uses a higher resolution in comparison
  * to other detection examples to enable the barcode detector to detect small barcodes
  * at long distances.
  * &lt;p&gt;
  * Suppressing InlinedApi since there is a check that the minimum version is met before using
  * the constant.
  */
 @SuppressLint("InlinedApi")
 private void createCameraSource(boolean autoFocus) {
  Context context = getApplicationContext();
  // A barcode detector is created to track barcodes.  An associated multi-processor instance
  // is set to receive the barcode detection results, track the barcodes, and maintain
  // graphics for each barcode on screen.  The factory is used by the multi-processor to
  // create a separate tracker instance for each barcode.
  BarcodeDetector barcodeDetector =
    new BarcodeDetector.Builder(context)
      .setBarcodeFormats(Barcode.QR_CODE | Barcode.ISBN)
      .build();
  if (!barcodeDetector.isOperational()) {
   Log.w(TAG, "Detector dependencies are not yet available.");
   // Check for low storage.  If there is low storage, the native library will not be
   // downloaded, so detection will not become operational.
   IntentFilter lowstorageFilter = new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW);
   boolean hasLowStorage = registerReceiver(null, lowstorageFilter) != null;
   if (hasLowStorage) {
    Common.showToast(this, getString(R.string.low_storage_error));
    Log.w(TAG, getString(R.string.low_storage_error));
   }
  }
  cameraViewBarcode.getHolder().addCallback(new SurfaceHolder.Callback() {
   @Override
   public void surfaceCreated(SurfaceHolder holder) {
    try {
     mCameraSource.start(cameraViewBarcode.getHolder());
    } catch (IOException ie) {
     Log.e("CAMERA SOURCE ERROR", ie.getMessage());
    }
   }
   @Override
   public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
   }
   @Override
   public void surfaceDestroyed(SurfaceHolder holder) {
    mCameraSource.stop();
   }
  });
  barcodeDetector.setProcessor(new Detector.Processor&lt;Barcode&gt;() {
   @Override
   public void release() {
   }
   @Override
   public void receiveDetections(Detector.Detections&lt;Barcode&gt; detections) {
    final SparseArray&lt;Barcode&gt; barcodes = detections.getDetectedItems();
    if (barcodes.size() != 0) {
     Snackbar.make(layoutBarcodeReaderContainer, barcodes.valueAt(0).displayValue,
       Snackbar.LENGTH_INDEFINITE).show();
    }
   }
  });
  // Creates and starts the camera.  Note that this uses a higher resolution in comparison
  // to other detection examples to enable the barcode detector to detect small barcodes
  // at long distances.
  CameraSource.Builder builder =
    new CameraSource.Builder(getApplicationContext(), barcodeDetector).setFacing(
      CameraSource.CAMERA_FACING_BACK)
      .setRequestedPreviewSize(640, 480)
      .setRequestedFps(15.0f);
  // make sure that auto focus is an available option
  if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
   builder.setAutoFocusEnabled(autoFocus);
  }
  mCameraSource = builder.build();
 }
}
</pre>
<br/></div>
<div class="de2">
<b>Final lines</b><br/>
<br/>
As google play services available on around 80-90% devices in the market it is easy and safe to use as compare to other options available to perform same task.<br/>
<br/>
That's it from my side. now run the app and see the result. if you have any query or suggestion please let me know in below comment box.<br/>
<br/>
keep coding... :)<span class="st0"><span class="st0">&nbsp;</span></span><br/>
<span class="st0"><span class="st0">&nbsp;</span> </span></div>
<span style="font-size: large;"><b><a href="https://github.com/WasimMemon/Myapplications/tree/master/Tutorials" rel="nofollow" target="_blank">Source code</a></b></span></div>
</div>
<script type="text/javascript">
                          createSummaryAndThumb("summary6729631678975921504");</script>
<div style="float:right;padding-right:10px;margin-top:10px;">
<a class="readmorenbt" href="2017/05/detect-qr-code-using-google-play">
                            Read More
                          </a>
</div>
<div style="clear: both;"></div>
</div>
<div class="pbtsharethisbutt">
<ul class="pbt-social-icons">
<li class="Share-this-arti">
                          Share This:&nbsp;&nbsp;
                        </li>
<li class="pbtfacebook">
<a href="https://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=https://www.androprogrammer.com/2017/05/detect-qr-code-using-google-play.html&amp;t=Detect QR Code Using Google Play Service Library" onclick="window.open(this.href,&quot;sharer&quot;,&quot;toolbar=0,status=0,width=626,height=436&quot;); return false;" rel="nofollow" target="_blank" title="Share this on Facebook">
<i class="fa fa-facebook-square"></i>
                            &nbsp;Facebook
                          </a>
</li>
<li class="pbttwitter">
<a href="https://twitter.com/home?status=Detect QR Code Using Google Play Service Library -- https://www.androprogrammer.com/2017/05/detect-qr-code-using-google-play.html" rel="nofollow" target="_blank" title="Tweet This!">
<i class="fa fa-twitter-square"></i>
                            &nbsp;Twitter
                          </a>
</li>
<li class="pbtgoogle">
<a href="https://plus.google.com/share?url=https://www.androprogrammer.com/2017/05/detect-qr-code-using-google-play.html" onclick="javascript:window.open(this.href,   &quot;&quot;, &quot;menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600&quot;);return false;" rel="nofollow" target="_blank" title="Share this on Google+">
<i class="fa fa-google-plus-square"></i>
                            &nbsp;Google+
                          </a>
</li>
<li class="pbtstumbleupon">
<a href="http://www.stumbleupon.com/submit?url=https://www.androprogrammer.com/2017/05/detect-qr-code-using-google-play.html&amp;title=Detect QR Code Using Google Play Service Library" rel="nofollow" target="_blank" title="Stumble upon something good? Share it on StumbleUpon">
<i class="fa fa-stumbleupon-circle"></i>
                            &nbsp;Stumble
                          </a>
</li>
<li class="pbtdigg">
<a href="http://digg.com/submit?phase=2&amp;url=https://www.androprogrammer.com/2017/05/detect-qr-code-using-google-play.html&amp;title=Detect QR Code Using Google Play Service Library" rel="nofollow" target="_blank" title="Digg this!">
<i class="fa fa-digg"></i>
                            &nbsp;Digg
                          </a>
</li>
</ul>
</div>
<div style="clear: both;"></div>
</article>
<div style="clear: both;"></div>
</div>
                          </div></div>
                        <div class="date-outer">
                        <div class="date-posts">
<div class="post-outer">
<article class="post hentry" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<meta content="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVKI9RYhFiAStAw_YkI0CtTL50XI0AWbanwInj7k_v2xMemlQDfW13I1HOTsnicc-QxHb7k5dNbNdZcOnC8UK0KFYJfDqa9W3IXQuq6UNdr4adaaBdQS_sgbr05HIoENOsfrKHzrDzl64/s640/tutorialimage_bottombar.png" itemprop="image"/>
<a name="1873650173054095253"></a>
<h3 class="post-title entry-title" itemprop="name">
<a href="2016/12/bottom-navigation-view-with-fragments">
Bottom Navigation View With Fragments
</a>
</h3>
<p class="entry-metanbt">
<span class="post-author vcard">
                          by&nbsp;
<span class="fn" itemprop="author" itemscope="itemscope" itemtype="http://schema.org/Person">
<meta content="https://www.blogger.com/profile/02101887469831067177" itemprop="url"/>
<a class="g-profile" href="https://www.blogger.com/profile/02101887469831067177" rel="author" title="author profile">
<span itemprop="name">
Wasim Memon
</span>
</a>
</span>
</span>
                        / 
                        in 
<a href="search/label/Android" rel="tag">
Android
</a>
                            , 
<a href="search/label/Materialdesign" rel="tag">
Material design
</a>
                        / 
                        with 
                        <a href="2016/12/bottom-navigation-view-with-fragments#comment-form" >
2
                            comments
</a>
                        / 
</p>
<div class="post-header-line-1"></div>
<div class="post-body entry-content" id="post-body-1873650173054095253" itemprop="articleBody">
<div id="summary1873650173054095253">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="tr_bq">
In March 2016 support design library update Google announced that there’s a new element to be added in Material Design components and it’s the <b>Bottom Navigation View</b>. As per documentation it should be used when application has three to five top-level destinations. Basically this is same as Tab Layout but with some more enhancement and animations. Although it is same but you can not use view pager with it. as it also explained as bad practice by google material design guidelines.</div>
<br/>
<b>Why we need Bottom Navigation View and Tab Layout both ?</b><br/>
This is really great question we should ask google support library developers. but according to me most of the people liked to use phone with just one hand. with that and huge size of mobile screen you can change tabs if they are at bottom not on top. so may be considering UIUX google may have added this beautiful component in support library so you can implement it with back word compatibility also.<br/>
<br/>
Today in this tutorial I am going to cover <a href="https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.html" rel="nofollow" target="_blank"><b>Bottom Navigation</b> <b>View</b></a> with <b>fragments</b>. In Bottom view you can provide options using menu resource file or using inflateMenu(int resId) method. For this tutorial i have used five (max) value so you can confirm how it looks.<br/>
<br/>
<br/>
<div class="separator" style="clear: both; text-align: center;">
<a href="images/s1600/tutorialimage_bottombar.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="androprogrammer.com" border="0" height="320" src="images/s640/tutorialimage_bottombar.png" title="Bottom Navigation View With Fragments" width="640"/></a></div>
<br/>
<br/>
To add Bottom navigation view you have to include support design library.<br/>
<pre class="brush:xml; toolbar:true">compile "com.android.support:design:25.0.1"
</pre>
<br/>
Now you have to put bellow code in your layout file.<br/>
<pre class="brush:xml; toolbar:true">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&gt;
  &lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
    &lt;FrameLayout
        android:id="@+id/fragmentContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/bottom_navigation"
        /&gt;
    &lt;android.support.design.widget.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        app:itemBackground="@color/primary_green"
        app:itemIconTint="@drawable/nav_item_color_state"
        app:itemTextColor="@drawable/nav_item_color_state"
        app:menu="@menu/bottom_navigation_main"
        app:layout_scrollFlags="scroll|enterAlways|snap"
        /&gt;
  &lt;/RelativeLayout&gt;
&lt;/android.support.design.widget.CoordinatorLayout&gt;
</pre>
<br/>
<b>app:menu :</b> Menu resource file (options to be displayed).<br/>
<br/>
<b>app:itemIconTint :</b> Change icon color when gets selected.<br/>
<br/>
<b>app:itemBackground :</b> background color by default it will be your app primary color.<br/>
<br/>
Now layout part is set. For color codes and images and other resources check out my repo on <a href="https://github.com/WasimMemon/Myapplications/tree/master/Tutorials" rel="nofollow" target="_blank">Github</a>.<br/>
<br/>
<blockquote>
<b>BottomBarDemo.java</b></blockquote>
<pre class="brush:java; toolbar:true">package com.androprogrammer.tutorials.samples;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.transition.Explode;
import android.transition.Transition;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import com.androprogrammer.tutorials.R;
import com.androprogrammer.tutorials.activities.Baseactivity;
import com.androprogrammer.tutorials.fragments.FragmentOne;
import com.androprogrammer.tutorials.fragments.FragmentThree;
import com.androprogrammer.tutorials.fragments.FragmentTwo;
import com.androprogrammer.tutorials.util.Common;
import butterknife.Bind;
import butterknife.ButterKnife;
public class BottomBarDemo extends Baseactivity {
 @Bind(R.id.bottom_navigation)
 BottomNavigationView bottomNavigation;
 private View viewLayout;
 private static final String TAG = "BottomBarDemo";
 private int[] bottomBarColors;
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
   getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
   //set the transition
   Transition ts = new Explode();
   ts.setDuration(5000);
   getWindow().setEnterTransition(ts);
   getWindow().setExitTransition(ts);
  }
  super.onCreate(savedInstanceState);
  setReference();
  setSimpleToolbar(true);
  setToolbarElevation(getResources().getDimension(R.dimen.elevation_normal));
  setToolbarSubTittle(this.getClass().getSimpleName());
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  int themeColor = Common.getThemeColor(this, R.attr.colorPrimary);
  bottomBarColors = new int[]{
    themeColor,
    R.color.color_skype1,
    R.color.color_blogger,
    R.color.color_gPlus,
    R.color.color_whatsApp
  };
  // For the first time setup
  changeBottomBarColor(bottomNavigation, 0);
  changeFragment(0);
  bottomNavigation.setOnNavigationItemSelectedListener(
    new BottomNavigationView.OnNavigationItemSelectedListener() {
     @Override
     public boolean onNavigationItemSelected(@NonNull MenuItem item) {
      switch (item.getItemId()) {
       case R.id.action_favorites:
        changeBottomBarColor(bottomNavigation, 0);
        changeFragment(0);
        break;
       case R.id.action_schedules:
        changeBottomBarColor(bottomNavigation, 1);
        changeFragment(1);
        break;
       case R.id.action_music:
        changeBottomBarColor(bottomNavigation, 2);
        changeFragment(2);
        break;
       case R.id.action_music1:
        changeBottomBarColor(bottomNavigation, 3);
        changeFragment(3);
        break;
       case R.id.action_favorites1:
        changeBottomBarColor(bottomNavigation, 4);
        changeFragment(4);
        break;
      }
      return true;
     }
    });
 }
 @Override
 public void setReference() {
  viewLayout = LayoutInflater.from(this).inflate(R.layout.activity_bottombar_demo, container);
  ButterKnife.bind(this, viewLayout);
 }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
  // Handle action bar item clicks here. The action bar will
  // automatically handle clicks on the Home/Up button, so long
  // as you specify a parent activity in AndroidManifest.xml.
  switch (item.getItemId()) {
   // Respond to the action bar's Up/Home button
   case android.R.id.home:
    finish();
    overridePendingTransition(0, R.anim.activity_close_scale);
    break;
  }
  return super.onOptionsItemSelected(item);
 }
 /**
  * To change bottom bar color on the basis of index
  * @param bottomNavigationView bottom bar object
  * @param index menu index
  */
 private void changeBottomBarColor(BottomNavigationView bottomNavigationView, int index) {
  if (bottomBarColors != null) {
   int colorCode = 0;
   if (index == 0) {
    colorCode = bottomBarColors[index];
   } else {
    colorCode = ContextCompat.getColor(BottomBarDemo.this, bottomBarColors[index]);
   }
   DrawableCompat.setTint(ContextCompat.getDrawable(BottomBarDemo.this,
     R.drawable.drawable_bottombar_color),
     colorCode);
   bottomNavigationView.setItemBackgroundResource(R.drawable.drawable_bottombar_color);
   if (android.os.Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
    // If you want to change status bar color
    //getWindow().setStatusBarColor(ContextCompat.getColor(BottomBarDemo.this, colorCode));
    // If you want to change bottom device navigation key background color
    getWindow().setNavigationBarColor(colorCode);
   }
  }
 }
 /**
  * To load fragments for sample
  * @param position menu index
  */
 private void changeFragment(int position) {
  Fragment newFragment = null;
  if (position == 0) {
   newFragment = new FragmentOne();
  } else if (position % 2 != 0) {
   newFragment = new FragmentTwo();
  } else {
   newFragment = new FragmentThree();
  }
  getFragmentManager().beginTransaction().replace(
    R.id.fragmentContainer, newFragment)
    .commit();
 }
}
</pre>
<br/>
That's it from my side. now run the app and see the result. if you have any query or suggestion please let me know in below comment box.<br/>
<br/>
keep coding... :)<br/>
<br/>
<span style="font-size: large;"><b><a href="https://github.com/WasimMemon/Myapplications/tree/master/Tutorials" rel="nofollow" target="_blank">Source code</a></b></span></div>
</div>
<script type="text/javascript">
                          createSummaryAndThumb("summary1873650173054095253");</script>
<div style="float:right;padding-right:10px;margin-top:10px;">
<a class="readmorenbt" href="2016/12/bottom-navigation-view-with-fragments">
                            Read More
                          </a>
</div>
<div style="clear: both;"></div>
</div>
<div class="pbtsharethisbutt">
<ul class="pbt-social-icons">
<li class="Share-this-arti">
                          Share This:&nbsp;&nbsp;
                        </li>
<li class="pbtfacebook">
<a href="https://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=https://www.androprogrammer.com/2016/12/bottom-navigation-view-with-fragments.html&amp;t=Bottom Navigation View With Fragments" onclick="window.open(this.href,&quot;sharer&quot;,&quot;toolbar=0,status=0,width=626,height=436&quot;); return false;" rel="nofollow" target="_blank" title="Share this on Facebook">
<i class="fa fa-facebook-square"></i>
                            &nbsp;Facebook
                          </a>
</li>
<li class="pbttwitter">
<a href="https://twitter.com/home?status=Bottom Navigation View With Fragments -- https://www.androprogrammer.com/2016/12/bottom-navigation-view-with-fragments.html" rel="nofollow" target="_blank" title="Tweet This!">
<i class="fa fa-twitter-square"></i>
                            &nbsp;Twitter
                          </a>
</li>
<li class="pbtgoogle">
<a href="https://plus.google.com/share?url=https://www.androprogrammer.com/2016/12/bottom-navigation-view-with-fragments.html" onclick="javascript:window.open(this.href,   &quot;&quot;, &quot;menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600&quot;);return false;" rel="nofollow" target="_blank" title="Share this on Google+">
<i class="fa fa-google-plus-square"></i>
                            &nbsp;Google+
                          </a>
</li>
<li class="pbtstumbleupon">
<a href="http://www.stumbleupon.com/submit?url=https://www.androprogrammer.com/2016/12/bottom-navigation-view-with-fragments.html&amp;title=Bottom Navigation View With Fragments" rel="nofollow" target="_blank" title="Stumble upon something good? Share it on StumbleUpon">
<i class="fa fa-stumbleupon-circle"></i>
                            &nbsp;Stumble
                          </a>
</li>
<li class="pbtdigg">
<a href="http://digg.com/submit?phase=2&amp;url=https://www.androprogrammer.com/2016/12/bottom-navigation-view-with-fragments.html&amp;title=Bottom Navigation View With Fragments" rel="nofollow" target="_blank" title="Digg this!">
<i class="fa fa-digg"></i>
                            &nbsp;Digg
                          </a>
</li>
</ul>
</div>
<div style="clear: both;"></div>
</article>
<div style="clear: both;"></div>
</div>
                          </div></div>
                        <div class="date-outer">
                        <div class="date-posts">
<div class="post-outer">
<article class="post hentry" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<meta content="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG8fyl0q9N4GxDwV5-EBhjccKsT31sGES8OIZTH5qZX0jld90Af79X6yZbs25ETF_2Ub5bynNEZUg3z9UsnCLiGDLzs_V45G9gJZ-E2UDaGkB6NmtX9gYGQeqUaOKgC6oYrq3Ru2A4AMw/s640/tutorialimage_dagger2.png" itemprop="image"/>
<a name="6956496002091726636"></a>
<h3 class="post-title entry-title" itemprop="name">
<a href="2016/09/dependency-injection-using-dagger2">
Dependency Injection Using Dagger2 
</a>
</h3>
<p class="entry-metanbt">
<span class="post-author vcard">
                          by&nbsp;
<span class="fn" itemprop="author" itemscope="itemscope" itemtype="http://schema.org/Person">
<meta content="https://www.blogger.com/profile/02101887469831067177" itemprop="url"/>
<a class="g-profile" href="https://www.blogger.com/profile/02101887469831067177" rel="author" title="author profile">
<span itemprop="name">
Wasim Memon
</span>
</a>
</span>
</span>
                        / 
                        in 
<a href="search/label/Android" rel="tag">
Android
</a>
                            , 
<a href="search/label/Dagger2" rel="tag">
Dagger2
</a>
                            , 
<a href="search/label/LibrariesDemo" rel="tag">
Libraries Demo
</a>
                        / 
                        with 
                        <a href="2016/09/dependency-injection-using-dagger2#comment-form" >
                            No comments
</a>
                        / 
</p>
<div class="post-header-line-1"></div>
<div class="post-body entry-content" id="post-body-6956496002091726636" itemprop="articleBody">
<div id="summary6956496002091726636">
<div dir="ltr" style="text-align: left;" trbidi="on">
Android Application depends on different different components or on modules. Yes your whole application have lots of dependency like you require network component in many screens (Activities or Fragments) or&nbsp; User data, Preference Data in app etc you get from some other class or object that can be dependency. your class depends upon some particular class which provide data to you and then you can process data or information. these are the just examples components you need to make better and best apps.<br/>
<br/>
But we developer know how painful it is to write code for declaration and initialization and then also check for <b>null </b>(nightmare for java developers). in every class or whenever you need some information from the other class you have to do these things.<br/>
What if this things done by some magic :).<br/>
<br/>
Well there is no such thing like magic in programming. So you have to do it by your own or you can use dependency injector library Dagger2. Which will create object graph and then inject required object in dependent class. If you don't know much more about Dagger2 check out my previous post <a href="2016/08/guide-for-dependency-injection-using">Guide For Dependency Injection Using Dagger2.&nbsp;</a><br/>
<br/>
<br/>
In this tutorial I am going to demonstrate sample app which i have created using Dagger2 , Volley and Gson.<br/>
<br/>
<b>Why volley ?</b><br/>
When you search for dagger2 samples on internet you will find lots of tutorials with Retrofit but what if i don't use retrofit. It is good library but require lots of boiler plate code for big apps (Too many interface when apps get bigger).<br/>
<br/>
<div class="separator" style="clear: both; text-align: center;">
<a href="images/s1600/tutorialimage_dagger2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="androprogrammer.com" border="0" height="320" src="images/s640/tutorialimage_dagger2.png" title="Dependency Injection Using Dagger2 " width="640"/></a></div>
<br/>
<br/>
<b>Ok Shut up and show me code...</b><br/>
<br/>
First of all create Module Class with whatever dependency you want to inject using this Module. Create methods and use <b>@Provides</b> annotation for methods so dagger2 will understand which object you want to provide.<br/>
<br/>
<pre class="brush:java; toolbar:true">package com.androprogrammer.dagger2sample.domain.di.modules;
import android.content.Context;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.androprogrammer.dagger2sample.domain.network.NetworkManager;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
@Module
public class NetModule {
    private Context context;
    public NetModule(Context ctx) {
        this.context = ctx;
    }
    @Provides  // Dagger will only look for methods annotated with @Provides
    @Singleton
    NetworkManager provideNetworkManager() {
        NetworkManager networkManager = NetworkManager.getInstance(context);
        return networkManager;
    }
    @Provides  // Dagger will only look for methods annotated with @Provides
    @Singleton
    Gson provideGson() {
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
        gsonBuilder.excludeFieldsWithoutExposeAnnotation();
        return gsonBuilder.create();
    }
}
</pre>
<br/>
Ok now create interface for this Module which will work as component for it. in the example i have created <b>DashboardActivityComponent </b>which having only one method inject. Inject method is require in component because in that you will pass context (Fragment or Activity) in which you want to perform injection. dependent classes which require object from different modules. check below code for further understanding.<br/>
<br/>
<br/>
<pre class="brush:java; toolbar:true">package com.androprogrammer.dagger2sample.domain.di.components;
import com.androprogrammer.dagger2sample.domain.di.modules.AppModule;
import com.androprogrammer.dagger2sample.domain.di.modules.NetModule;
import com.androprogrammer.dagger2sample.ui.fragments.UserListFragment;
import javax.inject.Singleton;
import dagger.Component;
@Singleton
@Component(modules =  {NetModule.class, AppModule.class})
public interface DashboardActivityComponent {
    void inject(UserListFragment fragment);
}
</pre>
<br/>
<blockquote class="tr_bq">
<b>UserListFragment.java</b></blockquote>
<pre class="brush:java; toolbar:true">package com.androprogrammer.dagger2sample.ui.fragments;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.volley.Request;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.androprogrammer.dagger2sample.AppController;
import com.androprogrammer.dagger2sample.R;
import com.androprogrammer.dagger2sample.domain.adapters.DashBoardListAdapter;
import com.androprogrammer.dagger2sample.domain.listeners.RequestListener;
import com.androprogrammer.dagger2sample.domain.listeners.RowItemElementClickListener;
import com.androprogrammer.dagger2sample.domain.network.NetworkManager;
import com.androprogrammer.dagger2sample.domain.network.RequestBuilder;
import com.androprogrammer.dagger2sample.domain.util.Utility;
import com.androprogrammer.dagger2sample.models.UserDataResponse;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
 * Created by wasim on 8/1/2016.
 */
public class UserListFragment extends BaseFragment implements RequestListener {
 @BindView(R.id.recycler_users)
 RecyclerView recyclerUsers;
 @BindView(R.id.tv_noData)
 TextView tvNoData;
 @BindView(R.id.layout_data)
 LinearLayout layoutData;
 @BindView(R.id.layout_progress)
 LinearLayout layoutProgress;
 private View view;
 @Inject
 SharedPreferences sharedPreferences;
 @Inject
 NetworkManager networkManager;
 @Inject
 Gson gsonParser;
 private List&lt;UserDataResponse&gt; mUserData;
 private DashBoardListAdapter mAdapter;
 private int reqId = -1;
 private static final String TAG = "UserListFragment";
 @Override
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  //Log.d(TAG, "oncreate");
 }
 @Override
 public View onCreateView(LayoutInflater inflater, ViewGroup container,
                          Bundle savedInstanceState) {
  // Inflate the layout for this fragment
  view = inflater.inflate(R.layout.fragment_userlist, container, false);
  initializeView();
  return view;
 }
 @Override
 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);
  userList();
 }
 @Override
 public void onStop() {
  networkManager.removeListeners(this);
  super.onStop();
 }
 private void initializeView() {
  ButterKnife.bind(this, view);
  ((AppController) getActivity().getApplication()).getmNetComponent().inject(this);
 }
 private void userList() {
  networkManager.addListener(this);
  networkManager.isProgressVisible(true);
  reqId = networkManager.addRequest(RequestBuilder.getRequestParameter(null), getActivity(),
    TAG, Request.Method.GET, RequestBuilder.SERVER_URL_API);
 }
 @Override
 public void onSuccess(int id, String response) {
  try {
   if (!TextUtils.isEmpty(response)) {
    if (id == reqId) {
     Log.d(TAG, response);
     Type listType = new TypeToken&lt;ArrayList&lt;UserDataResponse&gt;&gt;() {
     }.getType();
     mUserData = gsonParser.fromJson(response, listType);
     if (mUserData != null) {
      mAdapter = new DashBoardListAdapter(getActivity(), mUserData);
      mAdapter.setAnimateItems(true);
      recyclerUsers.setAdapter(mAdapter);
      mAdapter.setAnimateItems(false);
     } else {
      recyclerUsers.setVisibility(View.GONE);
      tvNoData.setVisibility(View.VISIBLE);
     }
    }
   }
  } catch (Exception e) {
   e.printStackTrace();
  }
 }
 @Override
 public void onError(int id, String message) {
  Utility.showToast(getContext(), message);
  //Log.d(TAG, "onError: " + message);
 }
 @Override
 public void onStartLoading(int id) {
  layoutData.setVisibility(View.GONE);
  layoutProgress.setVisibility(View.VISIBLE);
 }
 @Override
 public void onStopLoading(int id) {
  layoutProgress.setVisibility(View.GONE);
  layoutData.setVisibility(View.VISIBLE);
 }
}
</pre>
<br/>
I have used NetModule (Volley class object , Gson class object) and DashboardComponent in this fragment. I have created sample user list using some open api. For full application code you can check out below github link. as i am also learning about Dagger2 and its sub component and much more i will post more on Dagger2 in future. so if you find this helpful and don't want to miss about Dagger2 subscribe to my blog for more updates.<br/>
<br/>
Keep coding...<br/>
<br/>
<a href="https://github.com/WasimMemon/Dagger2Sample" rel="nofollow" target="_blank"><span style="font-size: large;"><b>Source Code</b></span></a></div>
</div>
<script type="text/javascript">
                          createSummaryAndThumb("summary6956496002091726636");</script>
<div style="float:right;padding-right:10px;margin-top:10px;">
<a class="readmorenbt" href="2016/09/dependency-injection-using-dagger2">
                            Read More
                          </a>
</div>
<div style="clear: both;"></div>
</div>
<div class="pbtsharethisbutt">
<ul class="pbt-social-icons">
<li class="Share-this-arti">
                          Share This:&nbsp;&nbsp;
                        </li>
<li class="pbtfacebook">
<a href="https://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=https://www.androprogrammer.com/2016/09/dependency-injection-using-dagger2.html&amp;t=Dependency Injection Using Dagger2 " onclick="window.open(this.href,&quot;sharer&quot;,&quot;toolbar=0,status=0,width=626,height=436&quot;); return false;" rel="nofollow" target="_blank" title="Share this on Facebook">
<i class="fa fa-facebook-square"></i>
                            &nbsp;Facebook
                          </a>
</li>
<li class="pbttwitter">
<a href="https://twitter.com/home?status=Dependency Injection Using Dagger2  -- https://www.androprogrammer.com/2016/09/dependency-injection-using-dagger2.html" rel="nofollow" target="_blank" title="Tweet This!">
<i class="fa fa-twitter-square"></i>
                            &nbsp;Twitter
                          </a>
</li>
<li class="pbtgoogle">
<a href="https://plus.google.com/share?url=https://www.androprogrammer.com/2016/09/dependency-injection-using-dagger2.html" onclick="javascript:window.open(this.href,   &quot;&quot;, &quot;menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600&quot;);return false;" rel="nofollow" target="_blank" title="Share this on Google+">
<i class="fa fa-google-plus-square"></i>
                            &nbsp;Google+
                          </a>
</li>
<li class="pbtstumbleupon">
<a href="http://www.stumbleupon.com/submit?url=https://www.androprogrammer.com/2016/09/dependency-injection-using-dagger2.html&amp;title=Dependency Injection Using Dagger2 " rel="nofollow" target="_blank" title="Stumble upon something good? Share it on StumbleUpon">
<i class="fa fa-stumbleupon-circle"></i>
                            &nbsp;Stumble
                          </a>
</li>
<li class="pbtdigg">
<a href="http://digg.com/submit?phase=2&amp;url=https://www.androprogrammer.com/2016/09/dependency-injection-using-dagger2.html&amp;title=Dependency Injection Using Dagger2 " rel="nofollow" target="_blank" title="Digg this!">
<i class="fa fa-digg"></i>
                            &nbsp;Digg
                          </a>
</li>
</ul>
</div>
<div style="clear: both;"></div>
</article>
<div style="clear: both;"></div>
</div>
                          </div></div>
                        <div class="date-outer">
                        <div class="date-posts">
<div class="post-outer">
<article class="post hentry" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<meta content="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgD3tLusWYIRFQHPYNNVm0j9IkxHjrcY13qT6rsnfMmxKgsK7Yz1eCH0hG4RhrukxcLksQ2ddCHMGHLwGcVXMYYhbazXaNs_Os4DtAD0T8XDmjG0kWv_XyomHPMuhw7zf-BhYpuBM73cxI/s640/dagger2Workflow.png" itemprop="image"/>
<a name="7294804416464107934"></a>
<h3 class="post-title entry-title" itemprop="name">
<a href="2016/08/guide-for-dependency-injection-using">
Guide For Dependency Injection Using Dagger2
</a>
</h3>
<p class="entry-metanbt">
<span class="post-author vcard">
                          by&nbsp;
<span class="fn" itemprop="author" itemscope="itemscope" itemtype="http://schema.org/Person">
<meta content="https://www.blogger.com/profile/02101887469831067177" itemprop="url"/>
<a class="g-profile" href="https://www.blogger.com/profile/02101887469831067177" rel="author" title="author profile">
<span itemprop="name">
Wasim Memon
</span>
</a>
</span>
</span>
                        / 
                        in 
<a href="search/label/Android" rel="tag">
Android
</a>
                            , 
<a href="search/label/Dagger2" rel="tag">
Dagger2
</a>
                            , 
<a href="search/label/LibrariesDemo" rel="tag">
Libraries Demo
</a>
                        / 
                        with 
                        <a href="2016/08/guide-for-dependency-injection-using#comment-form" >
                            No comments
</a>
                        / 
</p>
<div class="post-header-line-1"></div>
<div class="post-body entry-content" id="post-body-7294804416464107934" itemprop="articleBody">
<div id="summary7294804416464107934">
<div dir="ltr" style="text-align: left;" trbidi="on">
<br/>
Hey! Finally I decided that now a good time to get back to the blog and share what I have dealing with for last few weeks. Well I am working on Dependency injection using <b>Dagger 2</b>. So let's start with it what it is Dagger 2 ? and why you require to learn. during this process of learning i have googled it lot but i couldn't find proper explanation about this library and from where to start with it. So i thought it would be good if i write some thing simpler that helps others in understanding WTF going on.<br/>
<br/>
<br/>
<div class="separator" style="clear: both; text-align: center;">
<a href="#"><img alt="Dependency Injection Using Dagger2" border="0" height="320" src="images/s640/dagger2Workflow.png" title="Dependency Injection Using Dagger2" width="640"/></a></div>
<br/>
<br/>
<b><span style="font-size: large;">Quick Overview</span></b><br/>
<br/>
Dagger 2 is dependency injection framework. if you don't know about dependency injection you should check this <a href="https://youtu.be/IKD2-MAkXyQ" rel="nofollow" target="_blank">video</a>. Dagger2 is developed by Google and it is a forked from Dagger 1. which was created by Square.<br/>
<br/>
In Dagger 1 All this process happens at run time. while in case of Dagger 2 all: graph validation, configurations done at compile time.<br/>
<br/>
Dagger 2 generally for code generation and is based on annotations (explained below). During program execution object graph gets created by your application. And using abstraction your application create such a dynamic flow by observing object interactions.<br/>
<br/>
Dagger 1 and 2 are based on standard set of annotations (and one interface). use on injectable classes in order to to maximize re usability, test ability and maintainability of java code.<br/>
<br/>
I won't talk more about Dagger 1 because it is now no more in use because Dagger2 have increased speed in injection and also allows the use of proguard. <br/>
<br/>
<b><span style="font-size: large;">Annotations</span></b><br/>
<br/>
<b>@Scope: </b>Scopes are very useful and powerful way to define scope or let's say availability of any particular object. Dagger 2 has a more concrete way to do scoping through custom annotations. It can be @PerActivity, @PerFragment etc. By default it provide only @singletone scope for root component. We will see this in an example later on.<br/>
<br/>
<b>@Module:</b> Used in classes and methods which provide dependencies. Module class provide all the dependency objects when you require and when you use @Inject annotation. <br/>
<br/>
<b>@Provide:</b> Inside modules we define methods containing this annotation which tells Dagger how we want to construct and provide those mentioned dependencies. it i used in Module class to provide particular object.<br/>
<br/>
<b> @Inject:</b> Request dependencies. It an be used on a constructor, a field, or a method. Dagger2 will inject object into class from specific modules.<br/>
<br/>
<b> @Component:</b> It is main an interface from where dagger2 create object graph for module and injected classes. It enable selected modules and used for performing dependency injection. Such an interface is used by Dagger 2 to generate code.<br/>
<br/>
These are the common but not all annotations for Dagger2. but for starting with it you have to learn this much only. later on next part of tutorial i will go in deeper. this is just for staring and understanding purpose. because i think its good to know how library works and weather it is useful to you or not. in next tutorial i will explain how you can add Dagger2 into your project and from simple object injection to more complex structure for dependency injection.<br/>
<br/>
The official source for Dagger 2, with some documentation of it’s own:<br/>
<a class="markup--anchor markup--p-anchor" data-href="http://google.github.io/dagger/" href="http://google.github.io/dagger/" rel="nofollow">http://google.github.io/dagger/</a>. <br/>
<br/>
Keep coding...</div>
</div>
<script type="text/javascript">
                          createSummaryAndThumb("summary7294804416464107934");</script>
<div style="float:right;padding-right:10px;margin-top:10px;">
<a class="readmorenbt" href="2016/08/guide-for-dependency-injection-using">
                            Read More
                          </a>
</div>
<div style="clear: both;"></div>
</div>
<div class="pbtsharethisbutt">
<ul class="pbt-social-icons">
<li class="Share-this-arti">
                          Share This:&nbsp;&nbsp;
                        </li>
<li class="pbtfacebook">
<a href="https://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=https://www.androprogrammer.com/2016/08/guide-for-dependency-injection-using.html&amp;t=Guide For Dependency Injection Using Dagger2" onclick="window.open(this.href,&quot;sharer&quot;,&quot;toolbar=0,status=0,width=626,height=436&quot;); return false;" rel="nofollow" target="_blank" title="Share this on Facebook">
<i class="fa fa-facebook-square"></i>
                            &nbsp;Facebook
                          </a>
</li>
<li class="pbttwitter">
<a href="https://twitter.com/home?status=Guide For Dependency Injection Using Dagger2 -- https://www.androprogrammer.com/2016/08/guide-for-dependency-injection-using.html" rel="nofollow" target="_blank" title="Tweet This!">
<i class="fa fa-twitter-square"></i>
                            &nbsp;Twitter
                          </a>
</li>
<li class="pbtgoogle">
<a href="https://plus.google.com/share?url=https://www.androprogrammer.com/2016/08/guide-for-dependency-injection-using.html" onclick="javascript:window.open(this.href,   &quot;&quot;, &quot;menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600&quot;);return false;" rel="nofollow" target="_blank" title="Share this on Google+">
<i class="fa fa-google-plus-square"></i>
                            &nbsp;Google+
                          </a>
</li>
<li class="pbtstumbleupon">
<a href="http://www.stumbleupon.com/submit?url=https://www.androprogrammer.com/2016/08/guide-for-dependency-injection-using.html&amp;title=Guide For Dependency Injection Using Dagger2" rel="nofollow" target="_blank" title="Stumble upon something good? Share it on StumbleUpon">
<i class="fa fa-stumbleupon-circle"></i>
                            &nbsp;Stumble
                          </a>
</li>
<li class="pbtdigg">
<a href="http://digg.com/submit?phase=2&amp;url=https://www.androprogrammer.com/2016/08/guide-for-dependency-injection-using.html&amp;title=Guide For Dependency Injection Using Dagger2" rel="nofollow" target="_blank" title="Digg this!">
<i class="fa fa-digg"></i>
                            &nbsp;Digg
                          </a>
</li>
</ul>
</div>
<div style="clear: both;"></div>
</article>
<div style="clear: both;"></div>
</div>
                          </div></div>
                        <div class="date-outer">
                        <div class="date-posts">
<div class="post-outer">
<article class="post hentry" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<meta content="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguHdFqUeyP68hUSQeHE7ClZVgGZwyUtOj934-F2ggG6XswiNnGflQcDElPiZKIP_LoCZf-HMHdt4ZSyzMbxfSjWOxUqu1s47IUXVwkRPYfw5B4pubHIxu7VAwHINSZmcMDyhoZS-tOsaM/s1600/encryption-and-decryption-demo.png" itemprop="image"/>
<a name="8550349944431494044"></a>
<h3 class="post-title entry-title" itemprop="name">
<a href="2016/04/data-encryption-and-decryption-in">
Data Encryption and Decryption in Android
</a>
</h3>
<p class="entry-metanbt">
<span class="post-author vcard">
                          by&nbsp;
<span class="fn" itemprop="author" itemscope="itemscope" itemtype="http://schema.org/Person">
<meta content="https://www.blogger.com/profile/02101887469831067177" itemprop="url"/>
<a class="g-profile" href="https://www.blogger.com/profile/02101887469831067177" rel="author" title="author profile">
<span itemprop="name">
Wasim Memon
</span>
</a>
</span>
</span>
                        / 
                        in 
<a href="search/label/Android" rel="tag">
Android
</a>
                            , 
<a href="search/label/Encryption" rel="tag">
Encryption
</a>
                            , 
<a href="search/label/Security" rel="tag">
Security
</a>
                        / 
                        with 
                        <a href="2016/04/data-encryption-and-decryption-in#comment-form" >
                            No comments
</a>
                        / 
</p>
<div class="post-header-line-1"></div>
<div class="post-body entry-content" id="post-body-8550349944431494044" itemprop="articleBody">
<div id="summary8550349944431494044">
<div dir="ltr" style="text-align: left;" trbidi="on">
To store some of the user preference which are going to affect user login or any app module you should store it using some kind of encryption. Because with root permission if user will access your app preference your app will become vulnerable to attack or patch.<br/>
<br/>
In this tutorial i am going to use <a href="https://docs.oracle.com/javase/7/docs/api/javax/crypto/Cipher.html" rel="nofollow" target="_blank"><b>Cipher</b></a>. It is mechanism provided by Java to encrypt and decrypt data. Wit some <b>Cryptographic  algorithm</b> like Data Encryption Standard (DES) is symmetric and prone to brute-force attacks. It is a  old way of encrypting data. It is replaced by Advanced Encryption  Standard (AES). It is more stronger encryption standard. If you want to use a string as the key, then you should use a strong hash function like <a href="https://en.wikipedia.org/wiki/SHA-2" rel="nofollow" target="_blank">SHA-256</a> against that key string.  It is important to encode the binary data with Base64 to ensure it to  be intact without modification when it is stored or transferred.<br/>
<br/>
<div class="separator" style="clear: both; text-align: center;">
<a href="images/s1600/encryption-and-decryption-demo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="images/s1600/encryption-and-decryption-demo.png"/></a></div>
<br/>
<br/>
I have created <b>JavaEncryption </b>class to perform all encryption and decryption orations. For working sample code in activity check out <b><a href="https://github.com/WasimMemon/Myapplications/blob/master/Tutorials/app/src/main/java/com/androprogrammer/tutorials/samples/EncryptionDemo.java" rel="nofollow" target="_blank">EncryptionDemo </a></b>activity. which is sample activity created to display encryption and decryption result.<br/>
<br/>
<blockquote class="tr_bq">
<b>JavaEncryption.java</b></blockquote>
<pre class="brush:java; toolbar:true">package com.androprogrammer.tutorials.util;
import android.util.Base64;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.KeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
/**
 * Created by Wasim on 20-04-2016.
 */
public class JavaEncryption {
    /**
     * @param value data to encrypt
     * @param key a secret key used for encryption
     * @return String result of encryption
     * @throws UnsupportedEncodingException
     * @throws InvalidKeyException
     * @throws NoSuchAlgorithmException
     * @throws NoSuchPaddingException
     * @throws InvalidAlgorithmParameterException
     * @throws IllegalBlockSizeException
     * @throws BadPaddingException
     */
    public String encrypt(String value, String key)
            throws UnsupportedEncodingException, InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException
    {
        byte[] value_bytes = value.getBytes("UTF-8");
        byte[] key_bytes = getKeyBytes(key);
        return Base64.encodeToString(encrypt(value_bytes, key_bytes, key_bytes), 0);
    }
    public byte[] encrypt(byte[] paramArrayOfByte1, byte[] paramArrayOfByte2, byte[] paramArrayOfByte3)
            throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException
    {
        // setup AES cipher in CBC mode with PKCS #5 padding
        Cipher localCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
        // encrypt
        localCipher.init(1, new SecretKeySpec(paramArrayOfByte2, "AES"), new IvParameterSpec(paramArrayOfByte3));
        return localCipher.doFinal(paramArrayOfByte1);
    }
    /**
     *
     * @param value data to decrypt
     * @param key a secret key used for encryption
     * @return String result after decryption
     * @throws KeyException
     * @throws GeneralSecurityException
     * @throws GeneralSecurityException
     * @throws InvalidAlgorithmParameterException
     * @throws IllegalBlockSizeException
     * @throws BadPaddingException
     * @throws IOException
     */
    public String decrypt(String value, String key)
            throws GeneralSecurityException, IOException
    {
        byte[] value_bytes = Base64.decode(value, 0);
        byte[] key_bytes = getKeyBytes(key);
        return new String(decrypt(value_bytes, key_bytes, key_bytes), "UTF-8");
    }
    public byte[] decrypt(byte[] ArrayOfByte1, byte[] ArrayOfByte2, byte[] ArrayOfByte3)
            throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException
    {
        // setup AES cipher in CBC mode with PKCS #5 padding
        Cipher localCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
        // decrypt
        localCipher.init(2, new SecretKeySpec(ArrayOfByte2, "AES"), new IvParameterSpec(ArrayOfByte3));
        return localCipher.doFinal(ArrayOfByte1);
    }
    private byte[] getKeyBytes(String paramString)
            throws UnsupportedEncodingException
    {
        byte[] arrayOfByte1 = new byte[16];
        byte[] arrayOfByte2 = paramString.getBytes("UTF-8");
        System.arraycopy(arrayOfByte2, 0, arrayOfByte1, 0, Math.min(arrayOfByte2.length, arrayOfByte1.length));
        return arrayOfByte1;
    }
}
</pre>
<br/>
<br/>
Its not that much hard as it look or as its name suggest. you can use this with even server side also. if you want to send data to server with some encryption you can use cipher. you can do with little modification in it.<br/>
For more check this Stack overflow <a href="http://stackoverflow.com/questions/20929105/php-android-xml-encryption-decryption" rel="nofollow" target="_blank">link</a>.<br/>
<br/>
Keep coding... :)<br/>
<br/>
<br/>
<span style="font-size: large;"><b><a href="https://github.com/WasimMemon/Myapplications/tree/master/Tutorials" rel="nofollow" target="_blank">Source code</a></b></span></div>
</div>
<script type="text/javascript">
                          createSummaryAndThumb("summary8550349944431494044");</script>
<div style="float:right;padding-right:10px;margin-top:10px;">
<a class="readmorenbt" href="2016/04/data-encryption-and-decryption-in">
                            Read More
                          </a>
</div>
<div style="clear: both;"></div>
</div>
<div class="pbtsharethisbutt">
<ul class="pbt-social-icons">
<li class="Share-this-arti">
                          Share This:&nbsp;&nbsp;
                        </li>
<li class="pbtfacebook">
<a href="https://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=https://www.androprogrammer.com/2016/04/data-encryption-and-decryption-in.html&amp;t=Data Encryption and Decryption in Android" onclick="window.open(this.href,&quot;sharer&quot;,&quot;toolbar=0,status=0,width=626,height=436&quot;); return false;" rel="nofollow" target="_blank" title="Share this on Facebook">
<i class="fa fa-facebook-square"></i>
                            &nbsp;Facebook
                          </a>
</li>
<li class="pbttwitter">
<a href="https://twitter.com/home?status=Data Encryption and Decryption in Android -- https://www.androprogrammer.com/2016/04/data-encryption-and-decryption-in.html" rel="nofollow" target="_blank" title="Tweet This!">
<i class="fa fa-twitter-square"></i>
                            &nbsp;Twitter
                          </a>
</li>
<li class="pbtgoogle">
<a href="https://plus.google.com/share?url=https://www.androprogrammer.com/2016/04/data-encryption-and-decryption-in.html" onclick="javascript:window.open(this.href,   &quot;&quot;, &quot;menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600&quot;);return false;" rel="nofollow" target="_blank" title="Share this on Google+">
<i class="fa fa-google-plus-square"></i>
                            &nbsp;Google+
                          </a>
</li>
<li class="pbtstumbleupon">
<a href="http://www.stumbleupon.com/submit?url=https://www.androprogrammer.com/2016/04/data-encryption-and-decryption-in.html&amp;title=Data Encryption and Decryption in Android" rel="nofollow" target="_blank" title="Stumble upon something good? Share it on StumbleUpon">
<i class="fa fa-stumbleupon-circle"></i>
                            &nbsp;Stumble
                          </a>
</li>
<li class="pbtdigg">
<a href="http://digg.com/submit?phase=2&amp;url=https://www.androprogrammer.com/2016/04/data-encryption-and-decryption-in.html&amp;title=Data Encryption and Decryption in Android" rel="nofollow" target="_blank" title="Digg this!">
<i class="fa fa-digg"></i>
                            &nbsp;Digg
                          </a>
</li>
</ul>
</div>
<div style="clear: both;"></div>
</article>
<div style="clear: both;"></div>
</div>
                          </div></div>
                        <div class="date-outer">
                        <div class="date-posts">
<div class="post-outer">
<article class="post hentry" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<meta content="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTWNknLIg2Dn4NyOKNIXmuhmAHSwCTgSKnGu_vbu_YdIcZptWhKos5TclTpvh1CwXVxm5R_9r7FxOHyztt8iXOWoPXEUQGloD3a9ljs_7lR9wc2hSSBrgdVBj44RxKxGWAdsggldTaj7A/s640/twitterloginwithfabricsdk%25281%2529.png" itemprop="image"/>
<a name="3369055833989100231"></a>
<h3 class="post-title entry-title" itemprop="name">
<a href="2016/01/fabric-sdk-for-twitterlogin">
Social SignIn [Part - 2] - Fabric SDK For Twitter Login 
</a>
</h3>
<p class="entry-metanbt">
<span class="post-author vcard">
                          by&nbsp;
<span class="fn" itemprop="author" itemscope="itemscope" itemtype="http://schema.org/Person">
<meta content="https://www.blogger.com/profile/02101887469831067177" itemprop="url"/>
<a class="g-profile" href="https://www.blogger.com/profile/02101887469831067177" rel="author" title="author profile">
<span itemprop="name">
Wasim Memon
</span>
</a>
</span>
</span>
                        / 
                        in 
<a href="search/label/Android" rel="tag">
Android
</a>
                            , 
<a href="search/label/LibrariesDemo" rel="tag">
Libraries Demo
</a>
                        / 
                        with 
                        <a href="2016/01/fabric-sdk-for-twitterlogin#comment-form" >
                            No comments
</a>
                        / 
</p>
<div class="post-header-line-1"></div>
<div class="post-body entry-content" id="post-body-3369055833989100231" itemprop="articleBody">
<div id="summary3369055833989100231">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="tr_bq">
Fabric SDK is newer SDK introduced by Twitter for Mobile Integration. Fabric SDK comes with many combined projects like Twitter Authentication For Twitter API, Crashlytics For crash reports and analysis, MoPub for advertisement etc. Before this sdk or alternative of this is <b>Twitter4J </b>library for Twitter API.</div>
<div class="tr_bq">
<br/></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="images/s1600/twitterloginwithfabricsdk-281-29.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="androprogrammer.com" border="0" height="226" src="images/s640/twitterloginwithfabricsdk-281-29.png" title="Fabric SDK For Twitter Login " width="640"/></a></div>
<div class="tr_bq">
<br/></div>
<br/>
This is 2nd Part of tutorial series so i am not going through all project setup steps you can find it at <a href="2015/12/integrate-google-plus-in-android-app" target="_blank">Social SignIn [Part - 1] - Integrate Google plus in Android App</a>. To add Twitter authentication in your application you have to create application at <a href="https://www.fabric.io/" rel="nofollow" target="_blank">Fabric.io</a> and you can configure about which project you want to integrate into your project from Fabric sdk. Once you completely create application it will even help you to integrate Fabric sdk using Android Studio Plugins.<br/>
<br/>
<a href="img/b/R29vZ2xl/AVvXsEitrZdNa64Rsmp79wYMyfsspT_XZ1yiXpADUM9I4r5v6L7DbsiDQyiQs6Nofl7K_4_0ED0PeA3oDokNj7G0ybUEMP7Zo6rio8wnVrBOIOnsTxIdOv_HrfUwECklEpWyfdKr8wxSeRPGFC4/s1600/Fabric-icon.PNG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="115" src="img/b/R29vZ2xl/AVvXsEitrZdNa64Rsmp79wYMyfsspT_XZ1yiXpADUM9I4r5v6L7DbsiDQyiQs6Nofl7K_4_0ED0PeA3oDokNj7G0ybUEMP7Zo6rio8wnVrBOIOnsTxIdOv_HrfUwECklEpWyfdKr8wxSeRPGFC4/s200/Fabric-icon.PNG" width="200"/></a>Once it gets installed&nbsp; you can see icons like this image in toolbar.&nbsp; <br/>
<br/>
Just click on it and it will start like setup wizard you just have to click next. if you don't have developer account it will even create for you from Android Studio Plugin.<br/>
<br/>
<br/>
<b>Wow That's easy... right ?</b><br/>
<br/>
No, once you integrate all those things into project you might come across gradle error like this.<br/>
<blockquote class="tr_bq">
<b>Error:Execution failed for task ':app:fabricGenerateResourcesDebug'.<br/>
&gt; Crashlytics Developer Tools error.</b></blockquote>
Don't worry just comment this line in <b>app &gt; build.gradle</b> file. <br/>
<blockquote>
<b>apply plugin: 'io.fabric'</b></blockquote>
<br/>
If you only want to add Twitter login then only comment it. if you want other packages also then you have to use Fabric sdk. So now setup is done now let's see how you can add twitter button in your layout. If you want same twitter button added by Fabric sdk in your project you can skip this step. In this tutorial i have created <b>TwitterLoginHelper </b>class which actually does all things for me and for my view it just return result of that. But with&nbsp;<b>TwitterLoginButton </b>you don't have to do any thing. it has setCallBack method which allows you to get result into activity. but i am following MVP where my view don't know about callbacks and all it just consume result after all manipulation. Have look at my TwitterLoginHelper class.<br/>
<br/>
<blockquote class="tr_bq">
<b>TwitterLoginHelper.java</b>&nbsp; </blockquote>
<pre class="brush:java; toolbar:true">package com.androprogrammer.socialsignin.util.helpers;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import com.androprogrammer.socialsignin.listeners.SocialConnectListener;
import com.androprogrammer.socialsignin.model.UserLoginDetails;
import com.twitter.sdk.android.Twitter;
import com.twitter.sdk.android.core.Callback;
import com.twitter.sdk.android.core.Result;
import com.twitter.sdk.android.core.TwitterException;
import com.twitter.sdk.android.core.TwitterSession;
import com.twitter.sdk.android.core.identity.TwitterAuthClient;
import com.twitter.sdk.android.core.services.AccountService;
/**
 * Created by Wasim on 24-Jan-16.
 */
public class TwitterLoginHelper {
    private TwitterAuthClient client;
    private AppCompatActivity activity;
    private UserLoginDetails userData;
    private SocialConnectListener userCallbackListener;
    private int identifier;
    private static final String TAG = "TwitterLoginHelper";
    public void createConnection(AppCompatActivity mActivity) {
        this.activity = mActivity;
        userData = new UserLoginDetails();
        client = new TwitterAuthClient();
    }
    public TwitterAuthClient getClient() {
        return client;
    }
    public void onActivityResult(int requestCode,int resultCode, Intent data) {
        client.onActivityResult(requestCode,resultCode,data);
    }
    public void signIn(final int mIdentifier) {
        if (client != null)
        {
            identifier = mIdentifier;
            client.authorize(activity, new Callback &lt;twittersession&gt;() {
                @Override
                public void success(Result &lt;twittersession&gt; twitterSessionResult) {
                    Log.d(TAG, "Logged with twitter");
                    final TwitterSession session = twitterSessionResult.data;
                    AccountService ac = Twitter.getApiClient(twitterSessionResult.data).getAccountService();
                    ac.verifyCredentials(true, true, new Callback &lt;com .twitter.sdk.android.core.models.user&gt;() {
                        @Override
                        public void success(Result &lt;com .twitter.sdk.android.core.models.user&gt; result) {
                            userData.setIsSocial(true);
                            userData.setIsAndroid(true);
                            userData.setTwittersLogin(true);
                            userData.setTwitterID(String.valueOf(session.getUserId()));
                            userData.setFullName(result.data.name);
                            //userData.setEmail(result.data.email);
                            userData.setEmail(getUserEmail(session));
                            userData.setUserImageUrl(result.data.profileImageUrl);
                            if (userCallbackListener != null)
                            {
                                userCallbackListener.onUserConnected(identifier,userData);
                            }
                        }
                        @Override
                        public void failure(TwitterException e) {
                            if (userCallbackListener != null)
                            {
                                userCallbackListener.onConnectionError(identifier,e.getMessage());
                            }
                        }
                    });
                    /**/
                }
                @Override
                public void failure(TwitterException e) {
                    Log.e(TAG, "Failed login with twitter");
                    e.printStackTrace();
                    if (userCallbackListener != null)
                    {
                        userCallbackListener.onConnectionError(identifier,e.getMessage());
                    }
                }
            });
        }
    }
    public void signOut()
    {
        Twitter.getSessionManager().clearActiveSession();
    }
    public void setUserCallbackListener(SocialConnectListener userCallbackListener) {
        this.userCallbackListener = userCallbackListener;
    }
    private String getUserEmail(TwitterSession session)
    {
        final String[] userEmail = new String[1];
        client.requestEmail(session, new Callback &lt;string&gt;() {
            @Override
            public void success(Result &lt;string&gt; result) {
                // Do something with the result, which provides the email address
                Log.d(TAG,"Email found - " + result.toString());
                userEmail[0] = result.data;
            }
            @Override
            public void failure(TwitterException exception) {
                // Do something on failure
                Log.d(TAG,"Email not found - " + exception.getMessage());
                userEmail[0] = "";
            }
        });
        return userEmail[0];
    }
}
</pre>
<br/>
This class actually does every thing for me and it is like central class for all operation of Twitter. you can create method here for getTweets or user timeline etc. benefits of such way is you don't have to create Twitter client object for different task into different classes. To get user email your app has to be on their whitlist applications.&nbsp; To request email you have to submit <a href="https://support.twitter.com/forms/platform" rel="nofollow" target="_blank">this form</a>.<br/>
<br/>
Well now have look at below code where you can see how i have user this class.<br/>
<br/>
<pre class="brush:java; toolbar:true">private void startTwitterLogin() {
 Log.d("onclick", "clicked");
 if (Utility.isConnectivityAvailable(LoginActivity.this)) {
  runOnUiThread(new Runnable() {
   @Override
   public void run() {
    layout_full_twitter.setBackgroundColor(getResources().getColor(R.color.view_disable));
    layout_full_twitter.setEnabled(false);
    layout_twitter.setVisibility(View.GONE);
    pb_twitterLoader.setVisibility(View.VISIBLE);
   }
  });
  twitterHelper.createConnection(LoginActivity.this);
  twitterHelper.signIn(TWITTER_SIGN_IN);
 } else {
  Utility.showToast(LoginActivity.this,getString(R.string.msg_noInternet));
 }
}
</pre>
<br/>
So That's it from my side. this tutorial only covers Twitter authentication but for more like get tweets or timeline or post tweet etc subscribe to our news latter so you can get more tutorials in your inbox.<br/>
<br/>
I have created this project in <b>Kotlin</b> language also so if you want please check out <a href="https://github.com/WasimMemon/SocialSignIn_Demo/tree/master/SocialSignIn_kotlin" rel="nofollow" target="_blank">here</a>.<br/>
<br/>
<a href="https://github.com/WasimMemon/SocialSignIn_Demo/tree/master/SocialSignIn_java" rel="nofollow" target="_blank"><span style="font-size: large;"><b>Source Code</b></span></a><br/>
<br/>
Keep coding... :)</div>
</div>
<script type="text/javascript">
                          createSummaryAndThumb("summary3369055833989100231");</script>
<div style="float:right;padding-right:10px;margin-top:10px;">
<a class="readmorenbt" href="2016/01/fabric-sdk-for-twitterlogin">
                            Read More
                          </a>
</div>
<div style="clear: both;"></div>
</div>
<div class="pbtsharethisbutt">
<ul class="pbt-social-icons">
<li class="Share-this-arti">
                          Share This:&nbsp;&nbsp;
                        </li>
<li class="pbtfacebook">
<a href="https://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=https://www.androprogrammer.com/2016/01/fabric-sdk-for-twitterlogin.html&amp;t=Social SignIn [Part - 2] - Fabric SDK For Twitter Login " onclick="window.open(this.href,&quot;sharer&quot;,&quot;toolbar=0,status=0,width=626,height=436&quot;); return false;" rel="nofollow" target="_blank" title="Share this on Facebook">
<i class="fa fa-facebook-square"></i>
                            &nbsp;Facebook
                          </a>
</li>
<li class="pbttwitter">
<a href="https://twitter.com/home?status=Social SignIn [Part - 2] - Fabric SDK For Twitter Login  -- https://www.androprogrammer.com/2016/01/fabric-sdk-for-twitterlogin.html" rel="nofollow" target="_blank" title="Tweet This!">
<i class="fa fa-twitter-square"></i>
                            &nbsp;Twitter
                          </a>
</li>
<li class="pbtgoogle">
<a href="https://plus.google.com/share?url=https://www.androprogrammer.com/2016/01/fabric-sdk-for-twitterlogin.html" onclick="javascript:window.open(this.href,   &quot;&quot;, &quot;menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600&quot;);return false;" rel="nofollow" target="_blank" title="Share this on Google+">
<i class="fa fa-google-plus-square"></i>
                            &nbsp;Google+
                          </a>
</li>
<li class="pbtstumbleupon">
<a href="http://www.stumbleupon.com/submit?url=https://www.androprogrammer.com/2016/01/fabric-sdk-for-twitterlogin.html&amp;title=Social SignIn [Part - 2] - Fabric SDK For Twitter Login " rel="nofollow" target="_blank" title="Stumble upon something good? Share it on StumbleUpon">
<i class="fa fa-stumbleupon-circle"></i>
                            &nbsp;Stumble
                          </a>
</li>
<li class="pbtdigg">
<a href="http://digg.com/submit?phase=2&amp;url=https://www.androprogrammer.com/2016/01/fabric-sdk-for-twitterlogin.html&amp;title=Social SignIn [Part - 2] - Fabric SDK For Twitter Login " rel="nofollow" target="_blank" title="Digg this!">
<i class="fa fa-digg"></i>
                            &nbsp;Digg
                          </a>
</li>
</ul>
</div>
<div style="clear: both;"></div>
</article>
<div style="clear: both;"></div>
</div>
                      </div></div>
<!--Can't find substitution for tag [adEnd]-->
</div>
<div style="clear: both;"></div>
<div class="blog-pager" id="blog-pager">
<span id="blog-pager-older-link">
<a class="blog-pager-older-link" href="/" id="Blog1_blog-pager-older-link" title="Older Posts">
Older Posts
</a>
</span>
<a class="home-link" href="/">
Home
</a>
</div>
<div class="clear"></div>
<div class="blog-feeds">
<div class="feed-links">
Subscribe to:
<a class="feed-link" href="/" target="_blank" type="application/atom+xml">
Posts
                      (
                      Atom
                      )
                    </a>
</div>
</div>
</div></div>
</div>
<!--start:SIDEBAR -->
<aside class="col-4 widgetareanbt" role="complementary">
<div class="widget widget_searchnbt">
<form action="search" id="searchformnbt" method="get" role="search">
<input class="searchnbt" id="snbt" name="q" onblur="if (this.value == '') { this.value = 'Search article';}" onfocus="if (this.value == 'Search article') { this.value = '';}" type="search" value="Search article"/>
</form>
</div>
<div class="sidebarrightnbt section" id="sidebarrightnbt"><div class="widget HTML" data-version="1" id="HTML9">
<div class="widget-content">
<script type="text/javascript" charset="utf-8">
// Place this code snippet near the footer of your page before the close of the /body tag
// LEGAL NOTICE: The content of this website and all associated program code are protected under the Digital Millennium Copyright Act. Intentionally circumventing this code may constitute a violation of the DMCA.
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}(';q O=\'\',29=\'24\';1S(q i=0;i<12;i++)O+=29.X(D.J(D.K()*29.F));q 2H=8,2D=3R,2E=3j,2F=3B,2w=B(t){q o=!1,i=B(){z(k.1h){k.33(\'2M\',e);E.33(\'1W\',e)}R{k.2P(\'2T\',e);E.2P(\'1V\',e)}},e=B(){z(!o&&(k.1h||3z.2j===\'1W\'||k.2R===\'2S\')){o=!0;i();t()}};z(k.2R===\'2S\'){t()}R z(k.1h){k.1h(\'2M\',e);E.1h(\'1W\',e)}R{k.2W(\'2T\',e);E.2W(\'1V\',e);q n=!1;2Z{n=E.3o==3q&&k.1Z}2X(a){};z(n&&n.32){(B d(){z(o)G;2Z{n.32(\'16\')}2X(e){G 4X(d,50)};o=!0;i();t()})()}}};E[\'\'+O+\'\']=(B(){q t={t$:\'24+/=\',4Z:B(e){q d=\'\',r,n,o,c,s,l,i,a=0;e=t.e$(e);1f(a<e.F){r=e.19(a++);n=e.19(a++);o=e.19(a++);c=r>>2;s=(r&3)<<4|n>>4;l=(n&15)<<2|o>>6;i=o&63;z(2O(n)){l=i=64}R z(2O(o)){i=64};d=d+U.t$.X(c)+U.t$.X(s)+U.t$.X(l)+U.t$.X(i)};G d},13:B(e){q n=\'\',r,l,c,s,a,i,d,o=0;e=e.1B(/[^A-4b-4j-9\\+\\/\\=]/g,\'\');1f(o<e.F){s=U.t$.1H(e.X(o++));a=U.t$.1H(e.X(o++));i=U.t$.1H(e.X(o++));d=U.t$.1H(e.X(o++));r=s<<2|a>>4;l=(a&15)<<4|i>>2;c=(i&3)<<6|d;n=n+S.T(r);z(i!=64){n=n+S.T(l)};z(d!=64){n=n+S.T(c)}};n=t.n$(n);G n},e$:B(t){t=t.1B(/;/g,\';\');q n=\'\';1S(q o=0;o<t.F;o++){q e=t.19(o);z(e<1p){n+=S.T(e)}R z(e>4p&&e<4s){n+=S.T(e>>6|4t);n+=S.T(e&63|1p)}R{n+=S.T(e>>12|2L);n+=S.T(e>>6&63|1p);n+=S.T(e&63|1p)}};G n},n$:B(t){q o=\'\',e=0,n=4u=1u=0;1f(e<t.F){n=t.19(e);z(n<1p){o+=S.T(n);e++}R z(n>4A&&n<2L){1u=t.19(e+1);o+=S.T((n&31)<<6|1u&63);e+=2}R{1u=t.19(e+1);2o=t.19(e+2);o+=S.T((n&15)<<12|(1u&63)<<6|2o&63);e+=3}};G o}};q r=[\'4r==\',\'4q\',\'4o=\',\'4n\',\'4m\',\'4l=\',\'4k=\',\'4i=\',\'4h\',\'4f\',\'41=\',\'4e=\',\'4d\',\'4c\',\'4a=\',\'49\',\'48=\',\'47=\',\'46=\',\'45=\',\'44=\',\'43=\',\'42==\',\'4v==\',\'4g==\',\'4w==\',\'4N=\',\'52\',\'51\',\'4Y\',\'4W\',\'4V\',\'4U\',\'4T==\',\'4S=\',\'4R=\',\'53=\',\'4P==\',\'4O=\',\'4M\',\'4y=\',\'4L=\',\'4K==\',\'4J=\',\'4I==\',\'4H==\',\'4G=\',\'4F=\',\'4E\',\'4D==\',\'4C==\',\'4B\',\'3Z==\',\'4z=\'],f=D.J(D.K()*r.F),Y=t.13(r[f]),w=Y,C=1,g=\'#4x\',a=\'#40\',W=\'#3P\',v=\'#3Y\',L=\'\',b=\'3u!\',p=\'3t 3r 3p 3k\\\'3i 3h 3e 2C 2t. 3d\\\'s 3c.  3a 39\\\'t?\',y=\'3w 3l 3y-3x, 3X 3W\\\'t 3V 3U U 2f 3T.\',s=\'I 3S, I 3Q 3O 3N 2C 2t.  3J 3I 3G!\',o=0,u=1,n=\'3F.3E\',l=0,Z=e()+\'.2y\';B h(t){z(t)t=t.1D(t.F-15);q o=k.2q(\'3D\');1S(q n=o.F;n--;){q e=S(o[n].1E);z(e)e=e.1D(e.F-15);z(e===t)G!0};G!1};B m(t){z(t)t=t.1D(t.F-15);q e=k.3A;x=0;1f(x<e.F){1i=e[x].1P;z(1i)1i=1i.1D(1i.F-15);z(1i===t)G!0;x++};G!1};B e(t){q n=\'\',o=\'24\';t=t||30;1S(q e=0;e<t;e++)n+=o.X(D.J(D.K()*o.F));G n};B i(o){q i=[\'3C\',\'3H==\',\'3K\',\'3L\',\'2K\',\'3b==\',\'3g=\',\'38==\',\'3m=\',\'3n==\',\'3s==\',\'3v==\',\'4Q\',\'55\',\'5n\',\'2K\'],a=[\'2u=\',\'6t==\',\'6v==\',\'6x==\',\'6y=\',\'6s\',\'6E=\',\'6g=\',\'2u=\',\'6q\',\'6p==\',\'67\',\'54==\',\'6h==\',\'6l==\',\'6C=\'];x=0;1J=[];1f(x<o){c=i[D.J(D.K()*i.F)];d=a[D.J(D.K()*a.F)];c=t.13(c);d=t.13(d);q r=D.J(D.K()*2)+1;z(r==1){n=\'//\'+c+\'/\'+d}R{n=\'//\'+c+\'/\'+e(D.J(D.K()*20)+4)+\'.2y\'};1J[x]=1U 27();1J[x].1Y=B(){q t=1;1f(t<7){t++}};1J[x].1E=n;x++}};B Q(t){};G{35:B(t,a){z(6o k.N==\'6n\'){G};q o=\'0.1\',a=w,e=k.1b(\'1y\');e.1n=a;e.j.1m=\'1M\';e.j.16=\'-1o\';e.j.V=\'-1o\';e.j.1x=\'2d\';e.j.11=\'6m\';q r=k.N.2z,d=D.J(r.F/2);z(d>15){q n=k.1b(\'2c\');n.j.1m=\'1M\';n.j.1x=\'1s\';n.j.11=\'1s\';n.j.V=\'-1o\';n.j.16=\'-1o\';k.N.6k(n,k.N.2z[d]);n.1d(e);q i=k.1b(\'1y\');i.1n=\'2A\';i.j.1m=\'1M\';i.j.16=\'-1o\';i.j.V=\'-1o\';k.N.1d(i)}R{e.1n=\'2A\';k.N.1d(e)};l=6j(B(){z(e){t((e.1X==0),o);t((e.21==0),o);t((e.1L==\'2x\'),o);t((e.1O==\'2J\'),o);t((e.1I==0),o)}R{t(!0,o)}},28)},1G:B(e,c){z((e)&&(o==0)){o=1;E[\'\'+O+\'\'].1C();E[\'\'+O+\'\'].1G=B(){G}}R{q y=t.13(\'6f\'),u=k.66(y);z((u)&&(o==0)){z((2D%3)==0){q l=\'6e=\';l=t.13(l);z(h(l)){z(u.1F.1B(/\\s/g,\'\').F==0){o=1;E[\'\'+O+\'\'].1C()}}}};q f=!1;z(o==0){z((2E%3)==0){z(!E[\'\'+O+\'\'].2G){q r=[\'6c==\',\'6b==\',\'6a=\',\'69=\',\'68=\'],m=r.F,a=r[D.J(D.K()*m)],d=a;1f(a==d){d=r[D.J(D.K()*m)]};a=t.13(a);d=t.13(d);i(D.J(D.K()*2)+1);q n=1U 27(),s=1U 27();n.1Y=B(){i(D.J(D.K()*2)+1);s.1E=d;i(D.J(D.K()*2)+1)};s.1Y=B(){o=1;i(D.J(D.K()*3)+1);E[\'\'+O+\'\'].1C()};n.1E=a;z((2F%3)==0){n.1V=B(){z((n.11<8)&&(n.11>0)){E[\'\'+O+\'\'].1C()}}};i(D.J(D.K()*3)+1);E[\'\'+O+\'\'].2G=!0};E[\'\'+O+\'\'].1G=B(){G}}}}},1C:B(){z(u==1){q M=2I.6D(\'2r\');z(M>0){G!0}R{2I.6B(\'2r\',(D.K()+1)*28)}};q h=\'6z==\';h=t.13(h);z(!m(h)){q c=k.1b(\'6w\');c.23(\'6u\',\'6i\');c.23(\'2j\',\'1g/62\');c.23(\'1P\',h);k.2q(\'5Z\')[0].1d(c)};5v(l);k.N.1F=\'\';k.N.j.14+=\'P:1s !17\';k.N.j.14+=\'1A:1s !17\';q Z=k.1Z.21||E.37||k.N.21,f=E.5u||k.N.1X||k.1Z.1X,d=k.1b(\'1y\'),C=e();d.1n=C;d.j.1m=\'2i\';d.j.16=\'0\';d.j.V=\'0\';d.j.11=Z+\'1w\';d.j.1x=f+\'1w\';d.j.2l=g;d.j.26=\'5t\';k.N.1d(d);q r=\'<a 1P="5s://5r.5q" j="H-1c:10.5p;H-1l:1k-1j;1a:5o;">61 5m 5l 1T 5k 5i 56 5h 2f</a>\';r=r.1B(\'5g\',e());r=r.1B(\'5f\',e());q i=k.1b(\'1y\');i.1F=r;i.j.1m=\'1M\';i.j.1z=\'1K\';i.j.16=\'1K\';i.j.11=\'5e\';i.j.1x=\'5d\';i.j.26=\'2m\';i.j.1I=\'.6\';i.j.2p=\'2n\';i.1h(\'5c\',B(){n=n.5b(\'\').5a().59(\'\');E.2s.1P=\'//\'+n});k.1Q(C).1d(i);q o=k.1b(\'1y\'),Q=e();o.1n=Q;o.j.1m=\'2i\';o.j.V=f/7+\'1w\';o.j.5w=Z-5j+\'1w\';o.j.5x=f/3.5+\'1w\';o.j.2l=\'#5M\';o.j.26=\'2m\';o.j.14+=\'H-1l: "5Y 5X", 1q, 1r, 1k-1j !17\';o.j.14+=\'5W-1x: 5V !17\';o.j.14+=\'H-1c: 5U !17\';o.j.14+=\'1g-1v: 1t !17\';o.j.14+=\'1A: 5T !17\';o.j.1L+=\'1T\';o.j.2V=\'1K\';o.j.5S=\'1K\';o.j.5R=\'2h\';k.N.1d(o);o.j.5P=\'1s 5O 5N -5L 5z(0,0,0,0.3)\';o.j.1O=\'2v\';q w=30,Y=22,x=18,L=18;z((E.37<2N)||(5K.11<2N)){o.j.2Y=\'50%\';o.j.14+=\'H-1c: 5I !17\';o.j.2V=\'5G;\';i.j.2Y=\'65%\';q w=22,Y=18,x=12,L=12};o.1F=\'<34 j="1a:#5F;H-1c:\'+w+\'1N;1a:\'+a+\';H-1l:1q, 1r, 1k-1j;H-1R:5E;P-V:1e;P-1z:1e;1g-1v:1t;">\'+b+\'</34><2Q j="H-1c:\'+Y+\'1N;H-1R:5D;H-1l:1q, 1r, 1k-1j;1a:\'+a+\';P-V:1e;P-1z:1e;1g-1v:1t;">\'+p+\'</2Q><5C j=" 1L: 1T;P-V: 0.2U;P-1z: 0.2U;P-16: 2a;P-2g: 2a; 2e:5B 5A #6d; 11: 25%;1g-1v:1t;"><p j="H-1l:1q, 1r, 1k-1j;H-1R:2k;H-1c:\'+x+\'1N;1a:\'+a+\';1g-1v:1t;">\'+y+\'</p><p j="P-V:5H;"><2c 5J="U.j.1I=.9;" 5Q="U.j.1I=1;"  1n="\'+e()+\'" j="2p:2n;H-1c:\'+L+\'1N;H-1l:1q, 1r, 1k-1j; H-1R:2k;2e-57:2h;1A:1e;58-1a:\'+W+\';1a:\'+v+\';1A-16:2d;1A-2g:2d;11:60%;P:2a;P-V:1e;P-1z:1e;" 5y="E.2s.6A();">\'+s+\'</2c></p>\'}}})();E.36=B(t,e){q n=6G.6F,o=E.6r,d=n(),i,a=B(){n()-d<e?i||o(a):t()};o(a);G{3M:B(){i=1}}};q 2B;z(k.N){k.N.j.1O=\'2v\'};2w(B(){z(k.1Q(\'2b\')){k.1Q(\'2b\').j.1O=\'2x\';k.1Q(\'2b\').j.1L=\'2J\'};2B=E.36(B(){E[\'\'+O+\'\'].35(E[\'\'+O+\'\'].1G,E[\'\'+O+\'\'].3f)},2H*28)});',62,415,'|||||||||||||||||||style|document||||||var|||||||||if||function||Math|window|length|return|font||floor|random|||body|LCydhcEIDTis|margin||else|String|fromCharCode|this|top||charAt||||width||decode|cssText||left|important||charCodeAt|color|createElement|size|appendChild|10px|while|text|addEventListener|thisurl|serif|sans|family|position|id|5000px|128|Helvetica|geneva|0px|center|c2|align|px|height|DIV|bottom|padding|replace|dWkCZsFDai|substr|src|innerHTML|vHvjNIUQWf|indexOf|opacity|spimg|30px|display|absolute|pt|visibility|href|getElementById|weight|for|block|new|onload|load|clientHeight|onerror|documentElement||clientWidth||setAttribute|ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789||zIndex|Image|1000|JnEHQCnnfO|auto|babasbmsgx|div|60px|border|site|right|15px|fixed|type|300|backgroundColor|10000|pointer|c3|cursor|getElementsByTagName|babn|location|blocker|ZmF2aWNvbi5pY28|visible|sgcOqPwkGt|hidden|jpg|childNodes|banner_ad|TrXGcbLYKx|ad|HuXaLMVcDY|ZwqWcsYOqI|mKLQgCLsRQ|ranAlready|yZbJCabhEc|sessionStorage|none|cGFydG5lcmFkcy55c20ueWFob28uY29t|224|DOMContentLoaded|640|isNaN|detachEvent|h1|readyState|complete|onreadystatechange|5em|marginLeft|attachEvent|catch|zoom|try|||doScroll|removeEventListener|h3|tcEwRUmofS|pftqOVrQcW|innerWidth|YWR2ZXJ0aXNpbmcuYW9sLmNvbQ|doesn|Who|YS5saXZlc3BvcnRtZWRpYS5ldQ|okay|That|an|pbNKdfWILu|YWdvZGEubmV0L2Jhbm5lcnM|using|re|181|you|without|Y2FzLmNsaWNrYWJpbGl0eS5jb20|cHJvbW90ZS5wYWlyLmNvbQ|frameElement|like|null|looks|YWRzLnlhaG9vLmNvbQ|It|Welcome|YWRzLnp5bmdhLmNvbQ|But|income|advertising|event|styleSheets|244|YWRuLmViYXkuY29t|script|kcolbdakcolb|moc|in|YWQubWFpbC5ydQ|me|Let|anVpY3lhZHMuY29t|YWQuZm94bmV0d29ya3MuY29t|clear|my|disabled|adb8ff|have|154|understand|awesome|making|keep|can|we|FFFFFF|b3V0YnJhaW4tcGFpZA|777777|YWQtY29udGFpbmVyLTE|QWRzX2dvb2dsZV8wMQ|QWRMYXllcjI|QWRMYXllcjE|QWRGcmFtZTQ|QWRGcmFtZTM|QWRGcmFtZTI|QWRGcmFtZTE|QWRBcmVh|QWQ3Mjh4OTA|Za|QWQzMDB4MjUw|QWQzMDB4MTQ1|YWQtY29udGFpbmVyLTI|YWQtY29udGFpbmVy|QWRzX2dvb2dsZV8wMw|YWQtZm9vdGVy|YWQtbGI|z0|YWQtbGFiZWw|YWQtaW5uZXI|YWQtaW1n|YWQtaGVhZGVy|YWQtZnJhbWU|127|YWRCYW5uZXJXcmFw|YWQtbGVmdA|2048|192|c1|QWRzX2dvb2dsZV8wMg|QWRzX2dvb2dsZV8wNA|EEEEEE|YWRCYW5uZXI|c3BvbnNvcmVkX2xpbms|191|Z29vZ2xlX2Fk|YWRzZW5zZQ|cG9wdXBhZA|YWRzbG90|YmFubmVyaWQ|YWRzZXJ2ZXI|YWRfY2hhbm5lbA|IGFkX2JveA|YmFubmVyYWQ|YWRBZA|YWRiYW5uZXI|YmFubmVyX2Fk|RGl2QWQ|YWRUZWFzZXI|Z2xpbmtzd3JhcHBlcg|YWRzYXR0LmFiY25ld3Muc3RhcndhdmUuY29t|QWRCb3gxNjA|QWREaXY|QWRJbWFnZQ|RGl2QWRD|RGl2QWRC|RGl2QWRB|setTimeout|RGl2QWQz|encode||RGl2QWQy|RGl2QWQx|QWRDb250YWluZXI|YmFubmVyX2FkLmdpZg|YWRzYXR0LmVzcG4uc3RhcndhdmUuY29t|your|radius|background|join|reverse|split|click|40px|160px|FILLVECTID2|FILLVECTID1|own|on|120|adblock|to|way|YXMuaW5ib3guY29t|black|5pt|com|blockadblock|http|9999|innerHeight|clearInterval|minWidth|minHeight|onclick|rgba|solid|1px|hr|500|200|999|45px|35px|18pt|onmouseover|screen|8px|fff|24px|14px|boxShadow|onmouseout|borderRadius|marginRight|12px|16pt|normal|line|Black|Arial|head||Best|css||||querySelector|ZmF2aWNvbjEuaWNv|Ly93d3cuZG91YmxlY2xpY2tieWdvb2dsZS5jb20vZmF2aWNvbi5pY28|Ly9hZHMudHdpdHRlci5jb20vZmF2aWNvbi5pY28|Ly9hZHZlcnRpc2luZy55YWhvby5jb20vZmF2aWNvbi5pY28|Ly93d3cuZ3N0YXRpYy5jb20vYWR4L2RvdWJsZWNsaWNrLmljbw|Ly93d3cuZ29vZ2xlLmNvbS9hZHNlbnNlL3N0YXJ0L2ltYWdlcy9mYXZpY29uLmljbw|CCC|Ly9wYWdlYWQyLmdvb2dsZXN5bmRpY2F0aW9uLmNvbS9wYWdlYWQvanMvYWRzYnlnb29nbGUuanM|aW5zLmFkc2J5Z29vZ2xl|Q0ROLTMzNC0xMDktMTM3eC1hZC1iYW5uZXI|bGFyZ2VfYmFubmVyLmdpZg|stylesheet|setInterval|insertBefore|d2lkZV9za3lzY3JhcGVyLmpwZw|468px|undefined|typeof|c3F1YXJlLWFkLnBuZw|YWQtbGFyZ2UucG5n|requestAnimationFrame|MTM2N19hZC1jbGllbnRJRDI0NjQuanBn|YmFubmVyLmpwZw|rel|NDY4eDYwLmpwZw|link|NzIweDkwLmpwZw|c2t5c2NyYXBlci5qcGc|Ly95dWkueWFob29hcGlzLmNvbS8zLjE4LjEvYnVpbGQvY3NzcmVzZXQvY3NzcmVzZXQtbWluLmNzcw|reload|setItem|YWR2ZXJ0aXNlbWVudC0zNDMyMy5qcGc|getItem|YWRjbGllbnQtMDAyMTQ3LWhvc3QxLWJhbm5lci1hZC5qcGc|now|Date'.split('|'),0,{}));
</script>
</div>
<div class="clear"></div>
</div><div class="widget HTML" data-version="1" id="HTML2">
<div class="widget-content">
<style type="text/css">
.social-widget img {
    height: 40px;
margin-right: 10px;
    width: 40px;
}
</style>
<div align="center" class="social-widget"><a target="_blank" href="http://feeds.feedburner.com/AndroProgrammer"><img alt="Subcribe to our RSS feeds" src="img/b/R29vZ2xl/AVvXsEiGBncvQPUpqR_qy7mGa7yJsrGXMTdOVZuP7TiWC1rNY_I5wOl19CvZNGzsYvGoQUBDiPynK69lg8uB7QTtU4KBE814K_gHfIiRoSFdUViTrXpGKkt1z9fL8vTSMlasKWdwBBxF2Bzaz9g/s1600/ic_feed.png"/></a> <a target="_blank" href="https://www.facebook.com/androprogrammer"><img alt="Join Us on Facebook" src="img/b/R29vZ2xl/AVvXsEhXHf3OkYjv3QnauiR2kjeugBaUBf1hVyP9okCsT8YGabDhlZwE3Nh5Y4UcXi0sUAb-pRvYBLPepvx3qDXn-cpQ7Z9RaEOeoQtURaiZaWup6dGoTDMu29XITDru1Af32WJe0tMK9HcfMZY/s1600/ic_facebook.png"/></a> <a target="_blank" href="https://twitter.com/Androidblaze"><img alt="Follow us on Twitter" src="img/b/R29vZ2xl/AVvXsEj9x5RceSt15g-V1AuCgQcYIfknF64iQwapWEPcrbkYdXhLDRriHzmssGiD3PTqydhB8O1b6BZpF4xxcqdUzl2RRP8ZuMN8PAzk0hXbWfqSWzmiX2HK3k9b-h5BNRj7GHppRd-rj7TQW1w/s1600/ic_twitter.png"/></a>
<a target="_blank" href="https://www.linkedin.com/pub/wasim-memon/45/9a8/27a"><img alt="Connect on Linkdin" src="img/b/R29vZ2xl/AVvXsEgkO19aZsBR1puHrYhb6BQv3sxXeO9rVh5BUvxjT5ZdRzdbEC9q_K97hYi2ZfIGsoyFWsm334edNUS7RA5mIzalvsn1XZxmFVJYmOXuCyGt2xWr0b2wTfjJqNc4Bn-E7sAgdstc51Ru760/s1600/ic_linkdin.png"/></a>
<a target="_blank" href="https://github.com/WasimMemon/Myapplications"><img alt="Follow us on Github" src="img/b/R29vZ2xl/AVvXsEguuzFyNIOJsewREtFHX_9BMA-fuhTQy8XQLcqhhpFtzWvE084q5upxsuiO9cJTDNUBLAvsN56XC5Wpj70YLhQQWKYshzlSa65A361_jBk6fwO3eeXmnQJEDcSgenkUSDALk8xQEs1vLjg/s1600/ic_github.png"/></a> <br/></div>
</div>
<div class="clear"></div>
</div><div class="widget HTML" data-version="1" id="HTML7">
<div class="widget-content">
<center>
<a href="https://www.bluehost.com/track/wasim808/Myfirstadd" target="_blank">
                        <img border="0" src="media/partner/images/wasim808/300x250/bh-300x250-04-dy.png"/>
                        </a>
                    </center>
</div>
<div class="clear"></div>
</div><div class="widget HTML" data-version="1" id="HTML3">
<div class="widget-content">
<style>
.subscribe_outer {
    background: repeat scroll 0 0 transparent;
    margin: 0 -15px;
    padding: 5px 0;
}
.subscribe_wrapper {
    background: #333333 repeat scroll 0 0;
    color: #ccc;
    font-size: 14px;
    line-height: 20px;
    padding: 38px 50px 18px 38px;
}
#btntEmailsub {
    clear: both;
    display: block;
    margin: 10px 0;
}
form.btntEmailform {
    clear: both;
    display: block;
    margin: 20px 0 0;
    width: auto;
}
.emailText {
    background: #fff no-repeat scroll 10px center;
    border: 0 none;
    border-radius: 4px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.05) inset;
    margin: 0 0 15px;
    padding: 10px 20px;
    text-decoration: none;
    width: 100%;
}
</style>
<div class="subscribe_outer">
<div class="subscribe_wrapper">
<h5>Subscribe Via Email</h5>
<p>Enjoyed This Article? Get Free Updates ;-)</p>
<div id="btntEmailsub">
<form target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=AndroProgrammer', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true" method="post" class="btntEmailform" action="https://feedburner.google.com/fb/a/mailverify">
<input type="hidden" value="AndroProgrammer" name="uri"/>
<input type="hidden" value="en_US" name="loc"/>
<input type="text" value="Enter your email..." onfocus="if (this.value == &quot;Enter your email...&quot;) {this.value = &quot;&quot;}" onblur="if (this.value == &quot;&quot;) {this.value = &quot;Enter your email...&quot;;}" name="email" class="emailText"/>
<center>
<input type="submit" value="Signup Now!" title="" class="emailButton"/></center>
</form>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div><div class="widget HTML" data-version="1" id="HTML5">
<div class="widget-content">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- sidebar mobile add - 2 -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-1848356197175383" data-ad-slot="5409864156" data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<div class="clear"></div>
</div><div class="widget PopularPosts" data-version="1" id="PopularPosts1">
<h2>
Popular Posts
</h2>
<div class="widget-content popular-posts">
<ul>
<li>
<div class="item-thumbnail-only">
<div class="item-thumbnail">
<a href="2013/10/list-view-with-check-box-using-custom" target="_blank">
<img alt="" border="0" height="72" src="images/s72-c/listviewwithcheckbox-1.PNG" width="72"/>
</a>
</div>
<div class="item-title">
<b>
<a href="2013/10/list-view-with-check-box-using-custom">
List view with Check box Using Custom Adapter class
</a>
</b>
</div>
</div>
<div style="clear: both;"></div>
</li>
<li>
<div class="item-thumbnail-only">
<div class="item-thumbnail">
<a href="2015/06/view-pager-with-circular-indicator" target="_blank">
<img alt="" border="0" height="72" src="img/b/R29vZ2xl/AVvXsEj73BaZRVQxnm4-yI4zwixTMTi2wXjWf4yf-tvYVGOrhNPjxads_PSDTLFx4bHo0YEiirV10VhkbNVy5_a7JYRQEQgCvBpMX54TpNqpUFWsWA5ZCcEMe_1ZmrMJ28I2B5j96w2_cxxn9xI/s72-c/viewpagerdemo.png" width="72"/>
</a>
</div>
<div class="item-title">
<b>
<a href="2015/06/view-pager-with-circular-indicator">
View Pager With Circular Indicator (without any library)
</a>
</b>
</div>
</div>
<div style="clear: both;"></div>
</li>
<li>
<div class="item-thumbnail-only">
<div class="item-thumbnail">
<a href="2014/02/add-searching-in-list-view" target="_blank">
<img alt="" border="0" height="72" src="images/s72-c/ListViewSearchFunction.png" width="72"/>
</a>
</div>
<div class="item-title">
<b>
<a href="2014/02/add-searching-in-list-view">
Add Searching in List View.
</a>
</b>
</div>
</div>
<div style="clear: both;"></div>
</li>
<li>
<div class="item-thumbnail-only">
<div class="item-thumbnail">
<a href="2016/12/bottom-navigation-view-with-fragments" target="_blank">
<img alt="" border="0" height="72" src="images/s72-c/tutorialimage_bottombar.png" width="72"/>
</a>
</div>
<div class="item-title">
<b>
<a href="2016/12/bottom-navigation-view-with-fragments">
Bottom Navigation View With Fragments
</a>
</b>
</div>
</div>
<div style="clear: both;"></div>
</li>
<li>
<div class="item-thumbnail-only">
<div class="item-thumbnail">
<a href="2013/12/android-tutorial-frame-animation-with" target="_blank">
<img alt="" border="0" height="72" src="images/s72-c/FrameAnimation-1.PNG" width="72"/>
</a>
</div>
<div class="item-title">
<b>
<a href="2013/12/android-tutorial-frame-animation-with">
Android Tutorial: Frame Animation With Multiple Images
</a>
</b>
</div>
</div>
<div style="clear: both;"></div>
</li>
</ul>
<div class="clear"></div>
</div>
</div><div class="widget Label" data-version="1" id="Label1">
<h2>
Categories
</h2>
<div class="widget-content cloud-label-widget-content">
<span class="label-size label-size-2">
<a dir="ltr" href="search/label/Actionbar">
Action bar
</a>
</span>
<span class="label-size label-size-5">
<a dir="ltr" href="search/label/Android">
Android
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/AndroidWear">
Android Wear
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/AndroidWebView">
Android WebView
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/Animation">
Animation
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/AutomationTesting">
Automation Testing
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/Crashlytics">
Crashlytics
</a>
</span>
<span class="label-size label-size-2">
<a dir="ltr" href="search/label/Dagger2">
Dagger2
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/DataCaching">
Data Caching
</a>
</span>
<span class="label-size label-size-2">
<a dir="ltr" href="search/label/Database">
Database
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/Encryption">
Encryption
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/Errorreporting">
Error reporting
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/Espresso">
Espresso
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/Gps">
Gps
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/HybridApp">
Hybrid App
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/Ionic">
Ionic
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/ionicandroid">
ionic android
</a>
</span>
<span class="label-size label-size-3">
<a dir="ltr" href="search/label/LibrariesDemo">
Libraries Demo
</a>
</span>
<span class="label-size label-size-3">
<a dir="ltr" href="search/label/Listview">
Listview
</a>
</span>
<span class="label-size label-size-3">
<a dir="ltr" href="search/label/Materialdesign">
Material design
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/Monatize">
Monatize
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/Navigationdrawer">
Navigation drawer
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/Preference">
Preference
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/Review">
Review
</a>
</span>
<span class="label-size label-size-2">
<a dir="ltr" href="search/label/Security">
Security
</a>
</span>
<span class="label-size label-size-2">
<a dir="ltr" href="search/label/Settings">
Settings
</a>
</span>
<span class="label-size label-size-1">
<a dir="ltr" href="search/label/UITestcase">
UI Testcase
</a>
</span>
<div class="clear"></div>
</div>
</div><div class="widget Followers" data-version="1" id="Followers1">
<h2 class="title">Followers</h2>
<div class="widget-content">
<div id="Followers1-wrapper">
<div style="margin-right:2px;">
<div><script type="text/javascript" src="https://apis.google.com/js/platform.js"></script>
<div id="followers-iframe-container"></div>
<script type="text/javascript">
    window.followersIframe = null;
    function followersIframeOpen(url) {
      gapi.load("gapi.iframes", function() {
        if (gapi.iframes && gapi.iframes.getContext) {
          window.followersIframe = gapi.iframes.getContext().openChild({
            url: url,
            where: document.getElementById("followers-iframe-container"),
            messageHandlersFilter: gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER,
            messageHandlers: {
              '_ready': function(obj) {
                window.followersIframe.getIframeEl().height = obj.height;
              },
              'reset': function() {
                window.followersIframe.close();
                followersIframeOpen("https://www.blogger.com/followers/frame/1310888148096212123?colors\x3dCgt0cmFuc3BhcmVudBILdHJhbnNwYXJlbnQaByMwMDAwMDAiByMwMDAwMDAqByNGRkZGRkYyByMwMDAwMDA6ByMwMDAwMDBCByMwMDAwMDBKByMwMDAwMDBSByNGRkZGRkZaC3RyYW5zcGFyZW50\x26pageSize\x3d21\x26hl\x3den-GB\x26origin\x3dhttps://www.androprogrammer.com");
              },
              'open': function(url) {
                window.followersIframe.close();
                followersIframeOpen(url);
              },
              'blogger-ping': function() {
              }
            }
          });
        }
      });
    }
    followersIframeOpen("https://www.blogger.com/followers/frame/1310888148096212123?colors\x3dCgt0cmFuc3BhcmVudBILdHJhbnNwYXJlbnQaByMwMDAwMDAiByMwMDAwMDAqByNGRkZGRkYyByMwMDAwMDA6ByMwMDAwMDBCByMwMDAwMDBKByMwMDAwMDBSByNGRkZGRkZaC3RyYW5zcGFyZW50\x26pageSize\x3d21\x26hl\x3den-GB\x26origin\x3dhttps://www.androprogrammer.com");
  </script></div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<div class="widget HTML" data-version="1" id="HTML4">
<div class="widget-content">
<style>
.subscribe_outer {
    background: repeat scroll 0 0 transparent;
    margin: 0 -15px;
    padding: 5px 0;
}
.subscribe_wrapper {
    background: #333333 repeat scroll 0 0;
    color: #ccc;
    font-size: 14px;
    line-height: 20px;
    padding: 38px 50px 18px 38px;
}
#btntEmailsub {
    clear: both;
    display: block;
    margin: 10px 0;
}
.spanbtn {
border-radius: 0;
    color: #fff !important;
    cursor: pointer;
    display: inline-block;
    font-size: 0.813em;
    font-weight: 700;
    letter-spacing: 2px !important;
    margin: 10px 0;
    overflow: visible;
    padding: 10px 15px;
    text-transform: uppercase;
    vertical-align: middle;
    white-space: nowrap;
    width: 100%;
background-color: #5fccb2;
}
</style>
<div class="subscribe_outer">
<div class="subscribe_wrapper">
<h5>My free time work</h5>
<p>Offline Dictionary is basically offline dictionary which having more then 35000 english words. You can search any word by typing in any language. its easy to find what you want. so</p>
<div id="btntEmailsub">
<span class="spanbtn">
<a target="_blank" style="color:#fff;" href="https://play.google.com/store/apps/details?id=com.androprogrammer.dictionaryapp">
<img style="vertical-align:middle;" src="img/b/R29vZ2xl/AVvXsEhvEkDCv4SHVF8teHvQ2pSsGffBX4CHLG6iOssoLeng_TLNqrLjPfmbPaZjkpCRWvQIBigo_ueRYTBatdoWZ8Ij98c8AGPpgnPnzPAn8807ZgvE9KNs7-6_d0kwzOCHqgZ_X0PdvTnh5AE/s1600/ic_googleplay.png"/> Download & Share </a></span>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
</aside>
<!--END: SIDEBAR -->
</div>
<!-- row -->
</div>
<!--end: CONTAINER -->
<!--start:FOOTER -->
<footer class="rownbt" id="footernbt" role="contentinfo">
<div class="col-11">
        Copyright &#169; 
        <script type="text/javascript">
          var creditsyear = new Date();document.write(creditsyear.getFullYear());</script>
<a href="/">
AndroProgrammer
</a>
<br/>
        Powered by 
        <a href="https://www.blogger.com/">
          Blogger
        </a>
</div>
<div class="col-6 text-rightnbt1">
<!-- Do not edit or remove credits without our permission: newbloggerthemes.com -->
</div>
</footer>
<!--end: FOOTER -->
<script type="text/javascript">
      //<![CDATA[
      /*!
 * License:            GNU General Public License v3.0
 * License URI:        http://www.gnu.org/licenses/gpl-3.0.html
 * 
 */
      jQuery(document).ready(function($) {
        // toggle menu on mobile				
        $('.hamburgernbt').on('click', function(){
          $('.menu-listnbt').slideToggle(400);
        });
        $('.menu-item').has('ul').prepend('<span class="menu-click"><i class="fa fa-chevron-down"></i></span>');
        // toggle sub-menu		
        $('.menu-listnbt').on('click', '.menu-click', function(){
          $(this).siblings('.sub-menu').toggle();
          $(this).children('.fa').toggleClass('rotate');			
        });		
        // smooth scroll to top
        $('.top').click(function(){
          $('html,body').animate({scrollTop: 0}, 500);
          $(this).unbind("mouseenter mouseleave");
          return false;
        });
      });
      //]]>
    </script>
<!-- Adblock Script -->
<!-- cookie snack bar -->
<div id="cookieConsent">
<div id="closeCookieConsent">x</div>This site uses cookies. By countinue to browse the site you are agreering to our use of cookies. <a class="cookieConsentOK">That's Fine</a>
</div>
<script type="text/javascript" src="static/v1/widgets/3194816290-widgets.js"></script>
<script type="text/javascript">
window['__wavt'] = 'AOuZoY5sETu1uiNkzUj-aAgzgDaFEAgYvg:1734610946874';_WidgetManager._Init('https://www.blogger.com/rearrange?blogID\x3d1310888148096212123','https://www.androprogrammer.com/','1310888148096212123');
_WidgetManager._SetDataContext([{'name': 'blog', 'data': {'blogId': '1310888148096212123', 'title': 'AndroProgrammer', 'url': 'https://www.androprogrammer.com/', 'canonicalUrl': 'https://www.androprogrammer.com/', 'homepageUrl': 'https://www.androprogrammer.com/', 'searchUrl': 'https://www.androprogrammer.com/search', 'canonicalHomepageUrl': 'https://www.androprogrammer.com/', 'blogspotFaviconUrl': 'favicon.ico', 'bloggerUrl': 'https://www.blogger.com', 'hasCustomDomain': true, 'httpsEnabled': true, 'enabledCommentProfileImages': true, 'gPlusViewType': 'FILTERED_POSTMOD', 'adultContent': false, 'analyticsAccountNumber': 'UA-31672380-1', 'encoding': 'UTF-8', 'locale': 'en-GB', 'localeUnderscoreDelimited': 'en_gb', 'languageDirection': 'ltr', 'isPrivate': false, 'isMobile': false, 'isMobileRequest': false, 'mobileClass': '', 'isPrivateBlog': false, 'isDynamicViewsAvailable': true, 'feedLinks': '\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22AndroProgrammer - Atom\x22 href\x3d\x22https://www.androprogrammer.com/feeds/posts/default\x22 /\x3e\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/rss+xml\x22 title\x3d\x22AndroProgrammer - RSS\x22 href\x3d\x22https://www.androprogrammer.com/feeds/posts/default?alt\x3drss\x22 /\x3e\n\x3clink rel\x3d\x22service.post\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22AndroProgrammer - Atom\x22 href\x3d\x22https://www.blogger.com/feeds/1310888148096212123/posts/default\x22 /\x3e\n', 'meTag': '\x3clink rel\x3d\x22me\x22 href\x3d\x22https://www.blogger.com/profile/02101887469831067177\x22 /\x3e\n', 'adsenseClientId': 'ca-pub-1848356197175383', 'adsenseHostId': 'ca-host-pub-1556223355139109', 'adsenseHasAds': false, 'adsenseAutoAds': false, 'boqCommentIframeForm': true, 'loginRedirectParam': '', 'view': '', 'dynamicViewsCommentsSrc': 'dynamicviews/4224c15c4e7c9321/js/comments.js', 'dynamicViewsScriptSrc': 'https://www.blogblog.com/dynamicviews/361ce9cf7a112c52', 'plusOneApiSrc': 'https://apis.google.com/js/platform.js', 'disableGComments': true, 'interstitialAccepted': false, 'sharing': {'platforms': [{'name': 'Get link', 'key': 'link', 'shareMessage': 'Get link', 'target': ''}, {'name': 'Facebook', 'key': 'facebook', 'shareMessage': 'Share to Facebook', 'target': 'facebook'}, {'name': 'BlogThis!', 'key': 'blogThis', 'shareMessage': 'BlogThis!', 'target': 'blog'}, {'name': 'X', 'key': 'twitter', 'shareMessage': 'Share to X', 'target': 'twitter'}, {'name': 'Pinterest', 'key': 'pinterest', 'shareMessage': 'Share to Pinterest', 'target': 'pinterest'}, {'name': 'Email', 'key': 'email', 'shareMessage': 'Email', 'target': 'email'}], 'disableGooglePlus': true, 'googlePlusShareButtonWidth': 0, 'googlePlusBootstrap': '\x3cscript type\x3d\x22text/javascript\x22\x3ewindow.___gcfg \x3d {\x27lang\x27: \x27en_GB\x27};\x3c/script\x3e'}, 'hasCustomJumpLinkMessage': false, 'jumpLinkMessage': 'Read more', 'pageType': 'index', 'pageName': '', 'pageTitle': 'AndroProgrammer', 'metaDescription': ''}}, {'name': 'features', 'data': {}}, {'name': 'messages', 'data': {'edit': 'Edit', 'linkCopiedToClipboard': 'Link copied to clipboard', 'ok': 'Ok', 'postLink': 'Post link'}}, {'name': 'template', 'data': {'name': 'custom', 'localizedName': 'Custom', 'isResponsive': false, 'isAlternateRendering': false, 'isCustom': true}}, {'name': 'view', 'data': {'classic': {'name': 'classic', 'url': '?view\x3dclassic'}, 'flipcard': {'name': 'flipcard', 'url': '?view\x3dflipcard'}, 'magazine': {'name': 'magazine', 'url': '?view\x3dmagazine'}, 'mosaic': {'name': 'mosaic', 'url': '?view\x3dmosaic'}, 'sidebar': {'name': 'sidebar', 'url': '?view\x3dsidebar'}, 'snapshot': {'name': 'snapshot', 'url': '?view\x3dsnapshot'}, 'timeslide': {'name': 'timeslide', 'url': '?view\x3dtimeslide'}, 'isMobile': false, 'title': 'AndroProgrammer', 'description': '', 'url': 'https://www.androprogrammer.com/', 'type': 'feed', 'isSingleItem': false, 'isMultipleItems': true, 'isError': false, 'isPage': false, 'isPost': false, 'isHomepage': true, 'isArchive': false, 'isLabelSearch': false}}]);
_WidgetManager._RegisterWidget('_HeaderView', new _WidgetInfo('Header1', 'headersec', document.getElementById('Header1'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML1', 'mainblogsec', document.getElementById('HTML1'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_BlogView', new _WidgetInfo('Blog1', 'mainblogsec', document.getElementById('Blog1'), {'cmtInteractionsEnabled': false, 'lightboxEnabled': true, 'lightboxModuleUrl': 'static/v1/jsbin/2397084202-lbx__en_gb.js', 'lightboxCssUrl': 'static/v1/v-css/1964470060-lightbox_bundle.css'}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML9', 'sidebarrightnbt', document.getElementById('HTML9'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML2', 'sidebarrightnbt', document.getElementById('HTML2'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML7', 'sidebarrightnbt', document.getElementById('HTML7'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML3', 'sidebarrightnbt', document.getElementById('HTML3'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML5', 'sidebarrightnbt', document.getElementById('HTML5'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_PopularPostsView', new _WidgetInfo('PopularPosts1', 'sidebarrightnbt', document.getElementById('PopularPosts1'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_LabelView', new _WidgetInfo('Label1', 'sidebarrightnbt', document.getElementById('Label1'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_FollowersView', new _WidgetInfo('Followers1', 'sidebarrightnbt', document.getElementById('Followers1'), {}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML4', 'sidebarrightnbt', document.getElementById('HTML4'), {}, 'displayModeFull'));
</script>
</body>
</html>