tag:blogger.com,1999:blog-12723129817534100602024-03-21T02:05:11.595+06:00Android Help Help for Android DevelopmentAndroid-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.comBlogger131125tag:blogger.com,1999:blog-1272312981753410060.post-41846269473535903572018-10-07T11:02:00.002+06:002018-10-07T11:04:12.423+06:00Barcode Scan in Android<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: 20px;"><b>1. First Add this in yr Gradle</b></span><br />
<span style="font-size: 20px;"><b><br /></b></span>
<br />
<pre style="background-color: white; font-family: "Courier New"; font-size: 8.3pt;">compile <span style="color: green; font-weight: bold;">'me.dm7.barcodescanner:zxing:1.9.8'</span></pre>
<pre style="background-color: white; font-family: "Courier New"; font-size: 8.3pt;">compile <span style="color: green; font-weight: bold;">'com.edwardvanraak:MaterialBarcodeScanner:0.0.6-ALPHA'</span></pre>
<span style="font-size: 20px;"><b><br /></b></span>
<span style="font-size: 20px;"><b>2.Secondly Add this in Activity</b></span><br />
<span style="font-size: 20px;"><b><br /></b></span>
<br />
<pre style="background-color: white; font-family: "Courier New"; font-size: 8.3pt;"><span style="color: navy; font-weight: bold;">public static final </span>String <span style="color: #660e7a; font-style: italic; font-weight: bold;">BARCODE_KEY </span>= <span style="color: green; font-weight: bold;">"BARCODE"</span>;
<span style="color: navy; font-weight: bold;">private </span>Barcode <span style="color: #660e7a; font-weight: bold;">barcodeResult</span>;</pre>
<span style="font-size: 20px;"><b><br /></b></span>
<span style="font-size: 20px;"><b>Use This Method </b></span><br />
<span style="font-size: 20px;"><b><br /></b></span>
<br />
<pre style="background-color: white; font-family: "Courier New"; font-size: 8.3pt;"><span style="color: navy; font-weight: bold;">private void </span>startScan() {</pre>
<pre style="background-color: white; font-family: "Courier New"; font-size: 8.3pt;"><span style="color: navy; font-weight: bold;">final </span>MaterialBarcodeScanner materialBarcodeScanner = <span style="color: navy; font-weight: bold;">new </span>MaterialBarcodeScannerBuilder()
.withActivity(<span style="color: navy; font-weight: bold;">this</span>)
.withEnableAutoFocus(<span style="color: navy; font-weight: bold;">true</span>)
.withBleepEnabled(<span style="color: navy; font-weight: bold;">true</span>)
.withBackfacingCamera()
.withCenterTracker()
.withText(<span style="color: green; font-weight: bold;">"Scanning..."</span>)
.withResultListener(<span style="color: navy; font-weight: bold;">new </span>MaterialBarcodeScanner.OnResultListener() {
<span style="color: olive;">@Override</span><span style="color: olive;"> </span><span style="color: navy; font-weight: bold;">public void </span>onResult(Barcode barcode) {
<span style="color: #660e7a; font-weight: bold;">barcodeResult </span>= barcode;
<span style="color: grey; font-size: 8.3pt; font-style: italic;"> </span></pre>
<pre style="background-color: white; font-family: "Courier New"; font-size: 8.3pt;"> String Get_code_Text = barcode.<span style="color: #660e7a; font-weight: bold;">rawValue</span>.toString();
<span style="color: grey; font-style: italic;">
</span><span style="color: grey; font-style: italic;">
</span><span style="color: grey; font-style: italic;"> </span>}
})
.build();
materialBarcodeScanner.startScan();
}</pre>
<span style="font-size: 20px;"><b><br /></b></span>
<br />
<pre style="background-color: white; font-family: "Courier New"; font-size: 8.3pt;"></pre>
<pre style="background-color: white; font-family: "Courier New"; font-size: 8.3pt;"><span style="color: green; font-weight: bold;">
</span></pre>
<pre style="background-color: white; font-family: "Courier New"; font-size: 8.3pt;"><span style="color: green;"><b>
</b></span></pre>
<h2 style="background-color: white; font-family: "Courier New"; font-size: 8.3pt; text-align: left;">
</h2>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-41584503277078309452017-11-08T15:19:00.000+06:002017-11-08T16:24:36.618+06:00Send image from Android Application and Save image to my server direct from php file<div dir="ltr" style="text-align: left;" trbidi="on">
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; color: #393318; font-family: consolas, menlo, monaco, "lucida console", "liberation mono", "dejavu sans mono", "bitstream vera sans mono", "courier new", monospace, sans-serif; font-stretch: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;"><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"><b> Send image from Android Application use bellow code </b></span></code></pre>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; font-stretch: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;">a.Get picture from android</pre>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; font-stretch: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;">$OutLet_Picture = $_REQUEST['OutLet_Picture'];</pre>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; font-stretch: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;">b.Check Image isEmpty</pre>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; font-stretch: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;">$image_name1 = "none";
if(!empty($OutLet_Picture)){
@$base64Data1=$_REQUEST['OutLet_Picture'];
@$binary1=base64_decode($base64Data1);
$image_name1= $date_time2."1001"."1". ".jpg";</pre>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; font-stretch: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><div style="font-family: "Times New Roman"; white-space: normal;">
C.Save the Image</div>
<div style="font-family: "Times New Roman"; white-space: normal;">
</div>
<div>
<div style="font-family: "Times New Roman"; white-space: normal;">
//Get the file</div>
<div>
<span style="font-family: "times new roman";"><span style="white-space: normal;">$image_path='/var/www/example.com/public_html/New_Images/'.$image_name1;</span></span></div>
<div style="font-family: "Times New Roman"; white-space: normal;">
//$content = file_get_contents($binary1);</div>
<div style="font-family: "Times New Roman"; white-space: normal;">
//Store in the filesystem.</div>
<div style="font-family: "Times New Roman"; white-space: normal;">
$fp = fopen($image_path, "w");</div>
<div style="font-family: "Times New Roman"; white-space: normal;">
fwrite($fp, $binary1);</div>
<div style="font-family: "Times New Roman"; white-space: normal;">
fclose($fp); </div>
</div>
</pre>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; font-stretch: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"></pre>
<br />
<div>
</div>
<br />
<pre class="lang-php prettyprint prettyprinted" style="-webkit-text-stroke-width: 0px; background-color: #eff0f1; border: 0px; color: black; font-stretch: inherit; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; line-height: inherit; margin: 0px 0px 1em; max-height: 600px; orphans: 2; overflow: auto; padding: 5px; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; vertical-align: baseline; widows: 2; width: auto; word-spacing: 0px; word-wrap: normal;">}
</pre>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-32964015336771169882017-11-08T15:15:00.000+06:002017-11-08T16:25:26.745+06:00Save image to my server direct from php file<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h1 itemprop="name" style="background-color: white; border: 0px; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 22px; font-stretch: inherit; font-variant-numeric: inherit; font-weight: inherit; line-height: 1.3; margin: 0px 0px 0.5em; padding: 0px; vertical-align: baseline;">
<a class="question-hyperlink" href="https://stackoverflow.com/questions/6306935/php-copy-image-to-my-server-direct-from-url" style="border: 0px; color: #242729; cursor: pointer; font-family: inherit; font-size: 24px; font-stretch: inherit; font-style: inherit; font-variant: inherit; line-height: 1.35; margin: 0px 0px 0.5em; padding: 0px; text-decoration-line: none; vertical-align: baseline;">Copy image to my server direct from URL [duplicate]</a></h1>
<div>
1.Use bellow code.</div>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;"><span class="com" style="border: 0px; color: #858c93; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">//Get the file</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
$content </span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> file_get_contents</span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="str" style="border: 0px; color: #7d2727; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">"http://www.google.co.in/intl/en_com/images/srpr/logo1w.png"</span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="com" style="border: 0px; color: #858c93; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">//Store in the filesystem.</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
$fp </span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> fopen</span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="str" style="border: 0px; color: #7d2727; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">"/location/to/save/image.jpg"</span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="str" style="border: 0px; color: #7d2727; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">"w"</span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
fwrite</span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">$fp</span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> $content</span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
fclose</span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">$fp</span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">);</span></code></pre>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;"><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"><b>2. Send image from Android Application use bellow code</b></span></code></pre>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; text-align: left; vertical-align: baseline; width: auto; word-wrap: normal;">a.Get picture from android</pre>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; text-align: left; vertical-align: baseline; width: auto; word-wrap: normal;">$OutLet_Picture = $_REQUEST['OutLet_Picture'];</pre>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; text-align: left; vertical-align: baseline; width: auto; word-wrap: normal;">b.Check Image isEmpty</pre>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; text-align: left; vertical-align: baseline; width: auto; word-wrap: normal;">$image_name1 = "none";
if(!empty($OutLet_Picture)){
@$base64Data1=$_REQUEST['OutLet_Picture'];
@$binary1=base64_decode($base64Data1);
$image_name1= $date_time2."1001"."1". ".jpg";</pre>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; text-align: left; vertical-align: baseline; width: auto; word-wrap: normal;"><div style="font-family: "Times New Roman"; white-space: normal;">
C.Save the Image</div>
<div style="font-family: "Times New Roman"; white-space: normal;">
</div>
<div>
<div style="font-family: "Times New Roman"; white-space: normal;">
//Get the file</div>
<div>
<span style="font-family: "times new roman";"><span style="white-space: normal;">$image_path='/var/www/example.com/public_html/New_Images/'.$image_name1;</span></span></div>
<div style="font-family: "Times New Roman"; white-space: normal;">
//$content = file_get_contents($binary1);</div>
<div style="font-family: "Times New Roman"; white-space: normal;">
//Store in the filesystem.</div>
<div style="font-family: "Times New Roman"; white-space: normal;">
$fp = fopen($image_path, "w");</div>
<div style="font-family: "Times New Roman"; white-space: normal;">
fwrite($fp, $binary1);</div>
<div style="font-family: "Times New Roman"; white-space: normal;">
fclose($fp); </div>
</div>
</pre>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; text-align: left; vertical-align: baseline; width: auto; word-wrap: normal;"></pre>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; text-align: left; vertical-align: baseline; width: auto; word-wrap: normal;">}
</pre>
<div>
<br /></div>
<pre class="lang-php prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; text-align: left; vertical-align: baseline; width: auto; word-wrap: normal;"></pre>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-78556377590353757122017-10-08T14:03:00.001+06:002017-10-08T14:03:07.917+06:00barcode scanner in android programmatically<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="border-bottom: 1px solid rgb(234, 236, 239); box-sizing: border-box; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; line-height: 1.25; margin-bottom: 16px; margin-top: 24px; padding-bottom: 0.3em;">
Simple Usage</h2>
<div style="box-sizing: border-box; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px; margin-bottom: 16px;">
1.) Add camera permission to your AndroidManifest.xml file:</div>
<div class="highlight highlight-text-xml" style="box-sizing: border-box; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px; margin-bottom: 16px;">
<pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: 1.45; overflow: auto; padding: 16px; word-break: normal; word-wrap: normal;"><<span class="pl-ent" style="box-sizing: border-box; color: #22863a;">uses-permission</span> <span class="pl-e" style="box-sizing: border-box; color: #6f42c1;">android</span><span class="pl-e" style="box-sizing: border-box; color: #6f42c1;">:</span><span class="pl-e" style="box-sizing: border-box; color: #6f42c1;">name</span>=<span class="pl-s" style="box-sizing: border-box; color: #032f62;"><span class="pl-pds" style="box-sizing: border-box;">"</span>android.permission.CAMERA<span class="pl-pds" style="box-sizing: border-box;">"</span></span> /></pre>
</div>
<div style="box-sizing: border-box; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px; margin-bottom: 16px;">
2.) A very basic activity would look like this:</div>
<div class="highlight highlight-source-java" style="box-sizing: border-box; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; font-size: 16px; margin-bottom: 16px;">
<pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: 1.45; overflow: auto; padding: 16px; word-break: normal; word-wrap: normal;"><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">public</span> <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">class</span> <span class="pl-en" style="box-sizing: border-box; color: #6f42c1;">SimpleScannerActivity</span> <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">extends</span> <span class="pl-e" style="box-sizing: border-box; color: #6f42c1;">Activity</span> <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">implements</span> <span class="pl-e" style="box-sizing: border-box; color: #6f42c1;">ZXingScannerView</span>.<span class="pl-e" style="box-sizing: border-box; color: #6f42c1;">ResultHandler</span> {
<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">private</span> <span class="pl-smi" style="box-sizing: border-box;">ZXingScannerView</span> mScannerView;
<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">@Override</span>
<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">public</span> <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">void</span> <span class="pl-en" style="box-sizing: border-box; color: #6f42c1;">onCreate</span>(<span class="pl-smi" style="box-sizing: border-box;">Bundle</span> <span class="pl-v" style="box-sizing: border-box; color: #e36209;">state</span>) {
<span class="pl-c1" style="box-sizing: border-box; color: #005cc5;">super</span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>onCreate(state);
mScannerView <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">=</span> <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">new</span> <span class="pl-smi" style="box-sizing: border-box;">ZXingScannerView</span>(<span class="pl-c1" style="box-sizing: border-box; color: #005cc5;">this</span>); <span class="pl-c" style="box-sizing: border-box; color: #6a737d;"><span class="pl-c" style="box-sizing: border-box;">//</span> Programmatically initialize the scanner view</span>
setContentView(mScannerView); <span class="pl-c" style="box-sizing: border-box; color: #6a737d;"><span class="pl-c" style="box-sizing: border-box;">//</span> Set the scanner view as the content view</span>
}
<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">@Override</span>
<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">public</span> <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">void</span> <span class="pl-en" style="box-sizing: border-box; color: #6f42c1;">onResume</span>() {
<span class="pl-c1" style="box-sizing: border-box; color: #005cc5;">super</span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>onResume();
mScannerView<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>setResultHandler(<span class="pl-c1" style="box-sizing: border-box; color: #005cc5;">this</span>); <span class="pl-c" style="box-sizing: border-box; color: #6a737d;"><span class="pl-c" style="box-sizing: border-box;">//</span> Register ourselves as a handler for scan results.</span>
mScannerView<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>startCamera(); <span class="pl-c" style="box-sizing: border-box; color: #6a737d;"><span class="pl-c" style="box-sizing: border-box;">//</span> Start camera on resume</span>
}
<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">@Override</span>
<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">public</span> <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">void</span> <span class="pl-en" style="box-sizing: border-box; color: #6f42c1;">onPause</span>() {
<span class="pl-c1" style="box-sizing: border-box; color: #005cc5;">super</span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>onPause();
mScannerView<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>stopCamera(); <span class="pl-c" style="box-sizing: border-box; color: #6a737d;"><span class="pl-c" style="box-sizing: border-box;">//</span> Stop camera on pause</span>
}
<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">@Override</span>
<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">public</span> <span class="pl-k" style="box-sizing: border-box; color: #d73a49;">void</span> <span class="pl-en" style="box-sizing: border-box; color: #6f42c1;">handleResult</span>(<span class="pl-smi" style="box-sizing: border-box;">Result</span> <span class="pl-v" style="box-sizing: border-box; color: #e36209;">rawResult</span>) {
<span class="pl-c" style="box-sizing: border-box; color: #6a737d;"><span class="pl-c" style="box-sizing: border-box;">//</span> Do something with the result here</span>
<span class="pl-smi" style="box-sizing: border-box;">Log</span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>v(<span class="pl-c1" style="box-sizing: border-box; color: #005cc5;">TAG</span>, rawResult<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>getText()); <span class="pl-c" style="box-sizing: border-box; color: #6a737d;"><span class="pl-c" style="box-sizing: border-box;">//</span> Prints scan results</span>
<span class="pl-smi" style="box-sizing: border-box;">Log</span><span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>v(<span class="pl-c1" style="box-sizing: border-box; color: #005cc5;">TAG</span>, rawResult<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>getBarcodeFormat()<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>toString()); <span class="pl-c" style="box-sizing: border-box; color: #6a737d;"><span class="pl-c" style="box-sizing: border-box;">//</span> Prints the scan format (qrcode, pdf417 etc.)</span>
<span class="pl-c" style="box-sizing: border-box; color: #6a737d;"><span class="pl-c" style="box-sizing: border-box;">//</span> If you would like to resume scanning, call this method below:</span>
mScannerView<span class="pl-k" style="box-sizing: border-box; color: #d73a49;">.</span>resumeCameraPreview(<span class="pl-c1" style="box-sizing: border-box; color: #005cc5;">this</span>);
}
}</pre>
</div>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com1tag:blogger.com,1999:blog-1272312981753410060.post-19728746338386278842017-03-07T12:59:00.002+06:002017-03-07T12:59:32.265+06:00How to get the SHA-1 fingerprint certificate in Android Studio for debug mode?<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;">Easiest ways ever:</strong></div>
<h2 style="background-color: white; border: 0px; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 19px; font-weight: 400; line-height: 1.3; margin: 0px 0px 1em; padding: 0px; word-wrap: break-word;">
Update added for Android Studio V 2.2 in last step</h2>
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; margin-bottom: 1em; padding: 0px;">
There are two ways to do this.</div>
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;">1. Faster way</strong>:</div>
<ol style="background-color: white; border: 0px; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; margin: 0px 0px 1em 30px; padding: 0px;">
<li style="border: 0px; margin: 0px 0px 0.5em; padding: 0px; word-wrap: break-word;">Open Android Studio</li>
<li style="border: 0px; margin: 0px 0px 0.5em; padding: 0px; word-wrap: break-word;">Open your Project</li>
<li style="border: 0px; margin: 0px 0px 0.5em; padding: 0px; word-wrap: break-word;">Click on Gradle (From Right Side Panel, you will see <strong style="border: 0px; margin: 0px; padding: 0px;">Gradle Bar</strong>)</li>
<li style="border: 0px; margin: 0px 0px 0.5em; padding: 0px; word-wrap: break-word;">Click on Refresh (Click on Refresh from <strong style="border: 0px; margin: 0px; padding: 0px;">Gradle Bar</strong>, you will see <strong style="border: 0px; margin: 0px; padding: 0px;">List</strong> Gradle scripts of your Project)</li>
<li style="border: 0px; margin: 0px 0px 0.5em; padding: 0px; word-wrap: break-word;">Click on Your Project (Your Project Name form <strong style="border: 0px; margin: 0px; padding: 0px;">List</strong> (root))</li>
<li style="border: 0px; margin: 0px 0px 0.5em; padding: 0px; word-wrap: break-word;">Click on Tasks</li>
<li style="border: 0px; margin: 0px 0px 0.5em; padding: 0px; word-wrap: break-word;">Click on Android</li>
<li style="border: 0px; margin: 0px; padding: 0px; word-wrap: break-word;">Double Click on signingReport (You will get <strong style="border: 0px; margin: 0px; padding: 0px;">SHA1</strong> and <strong style="border: 0px; margin: 0px; padding: 0px;">MD5</strong> in <strong style="border: 0px; margin: 0px; padding: 0px;">Run Bar</strong>)</li>
</ol>
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;">Check the screenshot below:</strong></div>
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; margin-bottom: 1em; padding: 0px;">
<a href="https://i.stack.imgur.com/GUFbd.png" style="border: 0px; color: #005999; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;"><img alt="Enter image description here" src="https://i.stack.imgur.com/GUFbd.png" style="border: 0px; margin: 0px; max-width: 100%; padding: 0px;" /></a></div>
<h2 style="background-color: white; border: 0px; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 19px; font-weight: 400; line-height: 1.3; margin: 0px 0px 1em; padding: 0px; word-wrap: break-word;">
Android Studio V 2.2 Update</h2>
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; margin-bottom: 1em; padding: 0px;">
There is an issue with <strong style="border: 0px; margin: 0px; padding: 0px;">Execution</strong>.</div>
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;">Solution:</strong></div>
<ul style="background-color: white; border: 0px; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; margin: 0px 0px 1em 30px; padding: 0px;">
<li style="border: 0px; margin: 0px; padding: 0px; word-wrap: break-word;">Click on <strong style="border: 0px; margin: 0px; padding: 0px;">Toggle tasks execution/text mode</strong> from <strong style="border: 0px; margin: 0px; padding: 0px;">Run bar</strong></li>
</ul>
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;">Check Screenshot below:</strong></div>
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; margin-bottom: 1em; padding: 0px;">
<a href="https://i.stack.imgur.com/UG1vW.png" style="border: 0px; color: #005999; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;"><img alt="enter image description here" src="https://i.stack.imgur.com/UG1vW.png" style="border: 0px; margin: 0px; max-width: 100%; padding: 0px;" /></a></div>
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; margin-bottom: 1em; padding: 0px;">
<strong style="border: 0px; margin: 0px; padding: 0px;">Done.</strong></div>
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; margin-bottom: 1em; padding: 0px;">
<br /></div>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-70132669699712006342016-12-05T17:51:00.000+06:002016-12-05T17:51:57.327+06:00Write CSV files onto SD Card Storage<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
add this permission in manifest</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="tag" style="border: 0px; color: #7d2727; margin: 0px; padding: 0px;"><uses-permission</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> </span><span class="atn" style="border: 0px; color: #e64320; margin: 0px; padding: 0px;">android:name</span><span class="pun" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">=</span><span class="atv" style="border: 0px; color: #0f74bd; margin: 0px; padding: 0px;">"android.permission.WRITE_EXTERNAL_STORAGE"</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> </span><span class="tag" style="border: 0px; color: #7d2727; margin: 0px; padding: 0px;">/></span></code></pre>
<br />
<div style="background-color: white; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; padding: 0px; vertical-align: baseline;">
This example shows how to create a CSV file on removable storage in Android. CSV files are a convenient storage format for data to be easily viewed in programs like Excel or OpenOffice.</div>
<div style="background-color: white; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="background-color: white; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; padding: 0px; vertical-align: baseline;">
In this example, my goal is to create a CSV file having the following text:</div>
<table border="0" class="pbNoBorder" style="background-color: #eeeeee; border-collapse: collapse; border-spacing: 0px; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; margin: 0px; padding: 0px; vertical-align: baseline;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"><td style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 2px 4px; vertical-align: top;"><div style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5em; padding: 0px; vertical-align: baseline;">
---------------------------------------------</div>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-spacing: 0px; border: 0px; font-family: inherit; font-size: 13px; font-style: inherit; font-weight: inherit; margin: 0px; padding: 0px; vertical-align: baseline; width: 192px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; height: 15pt; margin: 0px; padding: 0px; vertical-align: baseline;"><td height="20" style="border: 0px; font-family: inherit; font-style: inherit; height: 15pt; margin: 0px; padding: 2px 4px; vertical-align: top; width: 48pt;" width="64">FirstParam</td><td style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 2px 4px; vertical-align: top; width: 48pt;" width="64">SecondParam</td><td style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 2px 4px; vertical-align: top; width: 48pt;" width="64">ThirdParam</td></tr>
<tr style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; height: 15pt; margin: 0px; padding: 0px; vertical-align: baseline;"><td align="right" height="20" style="border: 0px; font-family: inherit; font-style: inherit; height: 15pt; margin: 0px; padding: 2px 4px; vertical-align: top;">0.31</td><td align="right" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 2px 4px; vertical-align: top;">5.2</td><td align="right" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 2px 4px; vertical-align: top;">7</td></tr>
<tr style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; height: 15pt; margin: 0px; padding: 0px; vertical-align: baseline;"><td align="right" height="20" style="border: 0px; font-family: inherit; font-style: inherit; height: 15pt; margin: 0px; padding: 2px 4px; vertical-align: top;">0.31</td><td align="right" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 2px 4px; vertical-align: top;">5.2</td><td align="right" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 2px 4px; vertical-align: top;">7.1</td></tr>
<tr style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; height: 15pt; margin: 0px; padding: 0px; vertical-align: baseline;"><td align="right" height="20" style="border: 0px; font-family: inherit; font-style: inherit; height: 15pt; margin: 0px; padding: 2px 4px; vertical-align: top;">0.31</td><td align="right" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 2px 4px; vertical-align: top;">5.2</td><td align="right" style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 2px 4px; vertical-align: top;">7.2</td></tr>
</tbody></table>
</td></tr>
</tbody></table>
<div style="background-color: white; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="background-color: white; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; padding: 0px; vertical-align: baseline;">
Add this code to open a new file called "mydata.csv" on the SD card:</div>
<table border="0" class="pbNoBorder" style="background-color: #eeeeee; border-collapse: collapse; border-spacing: 0px; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; margin: 0px; padding: 0px; vertical-align: baseline; width: 977px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"><td style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 2px 4px; vertical-align: top;"><div style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5em; padding: 0px; vertical-align: baseline;">
import java.io.File;<br />import java.io.FileWriter;<br />import java.io.IOException;<br />import android.os.Environment;</div>
<div style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5em; padding: 0px; vertical-align: baseline;">
---------------------------------------------</div>
<div style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5em; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5em; padding: 0px; vertical-align: baseline;">
FileWriter writer;</div>
<div style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5em; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5em; padding: 0px; vertical-align: baseline;">
File root = Environment.getExternalStorageDirectory();<br />File gpxfile = new File(root, "mydata.csv");</div>
</td></tr>
</tbody></table>
<div style="background-color: white; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="background-color: white; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; padding: 0px; vertical-align: baseline;">
Use this routine to write the csv headers:</div>
<table border="0" class="pbNoBorder" style="background-color: #eeeeee; border-collapse: collapse; border-spacing: 0px; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; margin: 0px; padding: 0px; vertical-align: baseline; width: 1598px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"><td style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 2px 4px; vertical-align: top;">private void writeCsvHeader(String h1, String h2, String h3) throws IOException {<br /> String line = String.format("%s,%s,%s\n", h1,h2,h3);<br /> writer.write(line);<br /> }</td></tr>
</tbody></table>
<div style="background-color: white; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="background-color: white; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; padding: 0px; vertical-align: baseline;">
Use this routine to write CSV values to the file:</div>
<table border="0" class="pbNoBorder" style="background-color: #eeeeee; border-collapse: collapse; border-spacing: 0px; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; margin: 0px; padding: 0px; vertical-align: baseline; width: 1595px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"><td style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 2px 4px; vertical-align: top;">private void writeCsvData(float d, float e, float f) throws IOException { <br /> String line = String.format("%f,%f,%f\n", d, e, f);<br /> writer.write(line);<br />}</td></tr>
</tbody></table>
<div style="background-color: white; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="background-color: white; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; padding: 0px; vertical-align: baseline;">
Write the header and data lines like this:</div>
<table border="0" class="pbNoBorder" style="background-color: #eeeeee; border-collapse: collapse; border-spacing: 0px; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; margin: 0px; padding: 0px; vertical-align: baseline; width: 1589px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"><td style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 2px 4px; vertical-align: top;"><div style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5em; padding: 0px; vertical-align: baseline;">
try {</div>
<div style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5em; padding: 0px; vertical-align: baseline;">
writer = new FileWriter(gpxfile);</div>
<div style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5em; padding: 0px; vertical-align: baseline;">
writeCsvHeader("FirstParam","SecondParam","ThirdParam");<br /> writeCsvData(0.31f,5.2f,7.0f);<br /> writeCsvData(0.31f,5.2f,7.1f);<br /> writeCsvData(0.31f,5.2f,7.2f);</div>
<div style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5em; padding: 0px; vertical-align: baseline;">
} catch (IOException e) {<br /> e.printStackTrace();<br />}</div>
</td></tr>
</tbody></table>
<div style="background-color: white; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="background-color: white; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; padding: 0px; vertical-align: baseline;">
Quick note: adding "f" to the end of the constant number above tells Java you explicitly want to pass the value as a float, instead of a double.</div>
<div style="background-color: white; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; padding: 0px; vertical-align: baseline;">
<br /></div>
<div style="background-color: white; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; padding: 0px; vertical-align: baseline;">
Don't forget to close the file:</div>
<table border="0" class="pbNoBorder" style="background-color: #eeeeee; border-collapse: collapse; border-spacing: 0px; border: 0px; color: #444444; font-family: "Segoe UI", "Lucida Grande", Arial; font-size: 13px; line-height: 19.5px; margin: 0px; padding: 0px; vertical-align: baseline; width: 977px;"><tbody style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"><td style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 2px 4px; vertical-align: top;">writer.flush();<br />writer.close(); </td></tr>
</tbody></table>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-3809199399179723902016-12-01T15:59:00.001+06:002016-12-01T16:16:41.277+06:00How to enable/disable bluetooth programmatically in android<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
<b>Add the following permissions into your manifest file:</b></div>
<pre class="default prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="tag" style="border: 0px; color: #7d2727; margin: 0px; padding: 0px;"><uses-permission</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> </span><span class="atn" style="border: 0px; color: #e64320; margin: 0px; padding: 0px;">android:name</span><span class="pun" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">=</span><span class="atv" style="border: 0px; color: #0f74bd; margin: 0px; padding: 0px;">"android.permission.BLUETOOTH"</span><span class="tag" style="border: 0px; color: #7d2727; margin: 0px; padding: 0px;">/></span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">
</span><span class="tag" style="border: 0px; color: #7d2727; margin: 0px; padding: 0px;"><uses-permission</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> </span><span class="atn" style="border: 0px; color: #e64320; margin: 0px; padding: 0px;">android:name</span><span class="pun" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">=</span><span class="atv" style="border: 0px; color: #0f74bd; margin: 0px; padding: 0px;">"android.permission.BLUETOOTH_ADMIN"</span><span class="tag" style="border: 0px; color: #7d2727; margin: 0px; padding: 0px;">/></span></code></pre>
<h2 style="background-color: #eff0f1; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; text-align: left; width: auto; word-wrap: normal;">
<span style="font-size: small;"><b><code style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="tag" style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; margin: 0px; padding: 0px;">To Enable </span></code><span style="white-space: inherit;">BLUETOOTH Use This Code</span></b><span style="color: #0f74bd; white-space: inherit;">.</span></span></h2>
<pre class="default prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; margin: 0px; padding: 0px;"><span class="tag" style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; margin: 0px; padding: 0px;"><pre class="default prettyprint prettyprinted" style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; white-space: inherit; width: auto; word-wrap: normal;"><code style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="com" style="border: 0px; color: #858c93; margin: 0px; padding: 0px;"><b>//<span style="color: #303336; white-space: inherit;">Enable </span><span style="white-space: inherit;">bluetooth</span></b><span style="font-size: 13px;">
</span></span><span class="typ" style="border: 0px; color: #2b91af; font-size: 13px; margin: 0px; padding: 0px;">BluetoothAdapter</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> mBluetoothAdapter </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; font-size: 13px; margin: 0px; padding: 0px;">BluetoothAdapter</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">getDefaultAdapter</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: #101094; font-size: 13px; margin: 0px; padding: 0px;">if</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">(!</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">mBluetoothAdapter</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">isEnabled</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">())</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
mBluetoothAdapter</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">enable</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">}else{</span></code><span style="color: #303336; font-family: "arial" , "helvetica" , sans-serif; font-size: x-small; white-space: inherit;">Toast.makeText(getApplicationContext(), "Bluetooth Al-Ready <b style="color: #858c93; font-family: consolas, menlo, monaco, "lucida console", "liberation mono", "dejavu sans mono", "bitstream vera sans mono", "courier new", monospace, sans-serif; white-space: inherit;"><span style="color: #303336; white-space: inherit;">Enable</span></b></span><span style="color: #303336; font-family: "arial" , "helvetica" , sans-serif; font-size: x-small; white-space: inherit;">", Toast.LENGTH_LONG).show();</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px; white-space: inherit;">}</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px; white-space: inherit;"> </span></pre>
<pre class="default prettyprint prettyprinted" style="border: 0px; color: #393318; font-family: consolas, menlo, monaco, "lucida console", "liberation mono", "dejavu sans mono", "bitstream vera sans mono", "courier new", monospace, sans-serif; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; white-space: inherit; width: auto; word-wrap: normal;"><pre class="default prettyprint prettyprinted" style="border: 0px; font-family: consolas, menlo, monaco, "lucida console", "liberation mono", "dejavu sans mono", "bitstream vera sans mono", "courier new", monospace, sans-serif; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; white-space: inherit; width: auto; word-wrap: normal;"><code style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="com" style="border: 0px; color: #858c93; margin: 0px; padding: 0px;"><b><span style="color: #303336; white-space: inherit;">//Disable </span><span style="white-space: inherit;">bluetooth</span></b><span style="font-size: 13px;">
</span></span><span class="typ" style="border: 0px; color: #2b91af; font-size: 13px; margin: 0px; padding: 0px;">BluetoothAdapter</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> mBluetoothAdapter </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; font-size: 13px; margin: 0px; padding: 0px;">BluetoothAdapter</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">getDefaultAdapter</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: #101094; font-size: 13px; margin: 0px; padding: 0px;">if</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">(!</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">mBluetoothAdapter</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">isEnabled</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">())</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
mBluetoothAdapter</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">disable</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: #303336; font-size: 13px; margin: 0px; padding: 0px;">}</span></code></pre>
</pre>
<pre class="default prettyprint prettyprinted" style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; white-space: inherit; width: auto; word-wrap: normal;"></pre>
<pre class="default prettyprint prettyprinted" style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; white-space: inherit; width: auto; word-wrap: normal;"></pre>
<pre class="default prettyprint prettyprinted" style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; white-space: inherit; width: auto; word-wrap: normal;"></pre>
<pre class="default prettyprint prettyprinted" style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; white-space: inherit; width: auto; word-wrap: normal;"><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px; white-space: inherit;">
<span style="font-size: 13px;">
</span></span></pre>
<pre class="default prettyprint prettyprinted" style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; white-space: inherit; width: auto; word-wrap: normal;"><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px; white-space: inherit;">
</span></pre>
<pre class="default prettyprint prettyprinted" style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; white-space: inherit; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">
</span></code></pre>
</span></code></pre>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-41916968946154875822016-11-22T16:02:00.000+06:002016-11-22T16:02:18.096+06:00Draw Path on Google Maps Android API<div dir="ltr" style="text-align: left;" trbidi="on">
<h1 style="font-family: Georgia, Times, serif; font-weight: normal;">
Draw Path on Google Maps Android API</h1>
<div style="font-family: Arial, sans-serif; font-size: 14.4px; line-height: 21.6px;">
This Android tutorial is to demonstrate a sample application which will draw path for a route in Google map using Android API v2. This tutorial is a part of Google maps series. I recommend you to go through the previous tutorial <a href="http://javapapers.com/android/draw-lines-on-google-maps-android-api/" style="color: #0000ee; text-decoration: none;" title="Draw lines on Google Maps Android API">Draw lines on Google Maps Android API</a>. This earlier tutorial is to draw straight lines (polyline) between given latitude and longitude.</div>
<div style="font-family: Arial, sans-serif; font-size: 14.4px; line-height: 21.6px;">
The example Android app given in this tutorial give opportunity to learn to add markers, zoom to a particular latitude/longitude, draw polylines and draw path along a route in Google map. Pre-requisite is same for all Google maps tutorial and so I am not going to repeat it again, so to setup the development environment, to get the Android API key and related preparations please go through the previous tutorial link given above.</div>
<div style="font-family: Arial, sans-serif; font-size: 14.4px; line-height: 21.6px;">
<img alt="PathGoogleMap" border="0" height="640" src="http://javapapers.com/wp-content/uploads/2014/03/PathGoogleMap.jpg" style="background-image: none; border: 0px; display: inline; height: auto; max-width: 100%; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: middle;" title="PathGoogleMap" width="411" /></div>
<div class="ad-size" style="font-family: Arial, sans-serif; font-size: 14.4px; height: 280px; line-height: 21.6px; width: 336px;">
<ins class="adsbygoogle" data-ad-client="ca-pub-2525233393528874" data-ad-format="rectangle" data-ad-slot="3498801173" data-adsbygoogle-status="done" style="display: block; height: 280px;"><ins id="aswift_0_expand" style="border: none; display: inline-table; height: 280px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 336px;"><ins id="aswift_0_anchor" style="border: none; display: block; height: 280px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 336px;"><iframe allowfullscreen="true" allowtransparency="true" frameborder="0" height="280" hspace="0" id="aswift_0" marginheight="0" marginwidth="0" name="aswift_0" scrolling="no" style="left: 0px; position: absolute; top: 0px;" vspace="0" width="336"></iframe></ins></ins></ins></div>
<div style="font-family: Arial, sans-serif; font-size: 14.4px; line-height: 21.6px;">
Above shown image is the output of the example Android app. I have chose three locations and drawn path between them. Those three locations are shown by <a href="http://javapapers.com/android/markersgoogle-maps-android-api-v2/" style="color: #0000ee; text-decoration: none;" title="Android markers">Android markers</a>.</div>
<h2 style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; font-family: Georgia, Times, serif; font-weight: normal;">
The Google Directions API</h2>
<div style="font-family: Arial, sans-serif; font-size: 14.4px; line-height: 21.6px;">
To get the directions to draw the path, I have used the <a href="https://developers.google.com/maps/documentation/directions/" style="color: #0000ee; text-decoration: none;" target="_blank" title="Google Directions API">Google Directions API</a>. We just hit the given URL using HTTP request and get json response. This Google service calculates direction between given locations.</div>
<h3 style="font-family: Georgia, Times, serif;">
PathGoogleMapActivity.java</h3>
<pre class="prettyprint lang-java prettyprinted" style="border: 1px dashed rgb(207, 207, 207); font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 14.4px; line-height: 1.3em; margin-bottom: 18px; max-height: 600px; overflow: auto; padding: 4px; tab-size: 4;"><span class="kwd" style="color: #8959a8;">package</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smr</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">maps</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">path</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ArrayList</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">json</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">JSONObject</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">graphics</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Color</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">os</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">AsyncTask</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">os</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">support</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">v4</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">app</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">FragmentActivity</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">google</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gms</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">maps</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">CameraUpdateFactory</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">google</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gms</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">maps</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">GoogleMap</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">google</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gms</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">maps</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">SupportMapFragment</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">google</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gms</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">maps</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">model</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">google</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gms</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">maps</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">model</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">MarkerOptions</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">google</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gms</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">maps</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">model</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">PolylineOptions</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">class</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">PathGoogleMapActivity</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">extends</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">FragmentActivity</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pln" style="color: #4d4d4c;"> LOWER_MANHATTAN </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pun" style="color: #4d4d4c;">(</span><span class="lit" style="color: #f5871f;">40.722543</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">-</span><span class="lit" style="color: #f5871f;">73.998585</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pln" style="color: #4d4d4c;"> BROOKLYN_BRIDGE </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pun" style="color: #4d4d4c;">(</span><span class="lit" style="color: #f5871f;">40.7057</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">-</span><span class="lit" style="color: #f5871f;">73.9964</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pln" style="color: #4d4d4c;"> WALL_STREET </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pun" style="color: #4d4d4c;">(</span><span class="lit" style="color: #f5871f;">40.7064</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">-</span><span class="lit" style="color: #f5871f;">74.0094</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">GoogleMap</span><span class="pln" style="color: #4d4d4c;"> googleMap</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> TAG </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"PathGoogleMapActivity"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">protected</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onCreate</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pln" style="color: #4d4d4c;"> savedInstanceState</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">super</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">onCreate</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">savedInstanceState</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
setContentView</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">layout</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">activity_path_google_map</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">SupportMapFragment</span><span class="pln" style="color: #4d4d4c;"> fm </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">SupportMapFragment</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> getSupportFragmentManager</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">findFragmentById</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">id</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">map</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
googleMap </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> fm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getMap</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">MarkerOptions</span><span class="pln" style="color: #4d4d4c;"> options </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">MarkerOptions</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
options</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">position</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">LOWER_MANHATTAN</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
options</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">position</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">BROOKLYN_BRIDGE</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
options</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">position</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">WALL_STREET</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
googleMap</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">addMarker</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">options</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> url </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> getMapsApiDirectionsUrl</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">ReadTask</span><span class="pln" style="color: #4d4d4c;"> downloadTask </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ReadTask</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
downloadTask</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">execute</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">url</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
googleMap</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">moveCamera</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">CameraUpdateFactory</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">newLatLngZoom</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">BROOKLYN_BRIDGE</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">13</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
addMarkers</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> getMapsApiDirectionsUrl</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> waypoints </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"waypoints=optimize:true|"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> LOWER_MANHATTAN</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">latitude </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">","</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> LOWER_MANHATTAN</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">longitude
</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"|"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"|"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> BROOKLYN_BRIDGE</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">latitude </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">","</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> BROOKLYN_BRIDGE</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">longitude </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"|"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> WALL_STREET</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">latitude </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">","</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> WALL_STREET</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">longitude</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> sensor </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"sensor=false"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> params </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> waypoints </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"&"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> sensor</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> output </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"json"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> url </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"https://maps.googleapis.com/maps/api/directions/"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> output </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"?"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> params</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> url</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> addMarkers</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">googleMap </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
googleMap</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">addMarker</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">MarkerOptions</span><span class="pun" style="color: #4d4d4c;">().</span><span class="pln" style="color: #4d4d4c;">position</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">BROOKLYN_BRIDGE</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">title</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"First Point"</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
googleMap</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">addMarker</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">MarkerOptions</span><span class="pun" style="color: #4d4d4c;">().</span><span class="pln" style="color: #4d4d4c;">position</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">LOWER_MANHATTAN</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">title</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"Second Point"</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
googleMap</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">addMarker</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">MarkerOptions</span><span class="pun" style="color: #4d4d4c;">().</span><span class="pln" style="color: #4d4d4c;">position</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">WALL_STREET</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">title</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"Third Point"</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">class</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ReadTask</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">extends</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">AsyncTask</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Void</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">protected</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> doInBackground</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">...</span><span class="pln" style="color: #4d4d4c;"> url</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> data </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">""</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">try</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">HttpConnection</span><span class="pln" style="color: #4d4d4c;"> http </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">HttpConnection</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
data </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> http</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">readUrl</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">url</span><span class="pun" style="color: #4d4d4c;">[</span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">]);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">catch</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Exception</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"Background Task"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> data</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">protected</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onPostExecute</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> result</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">super</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">onPostExecute</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">result</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ParserTask</span><span class="pun" style="color: #4d4d4c;">().</span><span class="pln" style="color: #4d4d4c;">execute</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">result</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">class</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ParserTask</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">extends</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">AsyncTask</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Integer</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">>>>></span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">protected</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">>>></span><span class="pln" style="color: #4d4d4c;"> doInBackground</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">...</span><span class="pln" style="color: #4d4d4c;"> jsonData</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">JSONObject</span><span class="pln" style="color: #4d4d4c;"> jObject</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">>>></span><span class="pln" style="color: #4d4d4c;"> routes </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">try</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
jObject </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">JSONObject</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">jsonData</span><span class="pun" style="color: #4d4d4c;">[</span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">]);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">PathJSONParser</span><span class="pln" style="color: #4d4d4c;"> parser </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">PathJSONParser</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
routes </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> parser</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">parse</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">jObject</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">catch</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Exception</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
e</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">printStackTrace</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> routes</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">protected</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onPostExecute</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">>>></span><span class="pln" style="color: #4d4d4c;"> routes</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">ArrayList</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> points </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">PolylineOptions</span><span class="pln" style="color: #4d4d4c;"> polyLineOptions </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// traversing through routes</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">for</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> i </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;"> i </span><span class="pun" style="color: #4d4d4c;"><</span><span class="pln" style="color: #4d4d4c;"> routes</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">size</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;"> i</span><span class="pun" style="color: #4d4d4c;">++)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
points </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ArrayList</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pun" style="color: #4d4d4c;">>();</span><span class="pln" style="color: #4d4d4c;">
polyLineOptions </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">PolylineOptions</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">>></span><span class="pln" style="color: #4d4d4c;"> path </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> routes</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">i</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">for</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> j </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;"> j </span><span class="pun" style="color: #4d4d4c;"><</span><span class="pln" style="color: #4d4d4c;"> path</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">size</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;"> j</span><span class="pun" style="color: #4d4d4c;">++)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> point </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> path</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">j</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">double</span><span class="pln" style="color: #4d4d4c;"> lat </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Double</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">parseDouble</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">point</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"lat"</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">double</span><span class="pln" style="color: #4d4d4c;"> lng </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Double</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">parseDouble</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">point</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"lng"</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pln" style="color: #4d4d4c;"> position </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">lat</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> lng</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
points</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">add</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">position</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
polyLineOptions</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">addAll</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">points</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
polyLineOptions</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">width</span><span class="pun" style="color: #4d4d4c;">(</span><span class="lit" style="color: #f5871f;">2</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
polyLineOptions</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">color</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Color</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">BLUE</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
googleMap</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">addPolyline</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">polyLineOptions</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span></pre>
<h3 style="font-family: Georgia, Times, serif;">
HttpConnection.java</h3>
<div style="font-family: Arial, sans-serif; font-size: 14.4px; line-height: 21.6px;">
</div>
<pre class="prettyprint lang-java prettyprinted" style="border: 1px dashed rgb(207, 207, 207); font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 14.4px; line-height: 1.3em; margin-bottom: 18px; max-height: 600px; overflow: auto; padding: 4px; tab-size: 4;"><span class="kwd" style="color: #8959a8;">package</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smr</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">maps</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">path</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">io</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">BufferedReader</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">io</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">IOException</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">io</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">InputStream</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">io</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">InputStreamReader</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">net</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">HttpURLConnection</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">net</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">URL</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">class</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">HttpConnection</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> readUrl</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> mapsApiDirectionsUrl</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">throws</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">IOException</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> data </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">""</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">InputStream</span><span class="pln" style="color: #4d4d4c;"> iStream </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">HttpURLConnection</span><span class="pln" style="color: #4d4d4c;"> urlConnection </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">try</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
URL url </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> URL</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">mapsApiDirectionsUrl</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
urlConnection </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">HttpURLConnection</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> url</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">openConnection</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
urlConnection</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">connect</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
iStream </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> urlConnection</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getInputStream</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">BufferedReader</span><span class="pln" style="color: #4d4d4c;"> br </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">BufferedReader</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">InputStreamReader</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">
iStream</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">StringBuffer</span><span class="pln" style="color: #4d4d4c;"> sb </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">StringBuffer</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> line </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">""</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">while</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">((</span><span class="pln" style="color: #4d4d4c;">line </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> br</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">readLine</span><span class="pun" style="color: #4d4d4c;">())</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
sb</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">line</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
data </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> sb</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
br</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">close</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">catch</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Exception</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"Exception while reading url"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">finally</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
iStream</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">close</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
urlConnection</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">disconnect</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> data</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span></pre>
<div style="font-family: Arial, sans-serif; font-size: 14.4px; line-height: 21.6px;">
</div>
<h3 style="font-family: Georgia, Times, serif;">
PathJSONParser.java</h3>
<pre class="prettyprint lang-java prettyprinted" style="border: 1px dashed rgb(207, 207, 207); font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 14.4px; line-height: 1.3em; margin-bottom: 18px; max-height: 600px; overflow: auto; padding: 4px; tab-size: 4;"><span class="kwd" style="color: #8959a8;">package</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smr</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">maps</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">path</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ArrayList</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">json</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">JSONArray</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">json</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">JSONException</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">json</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">JSONObject</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">google</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gms</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">maps</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">model</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">class</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">PathJSONParser</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">>>></span><span class="pln" style="color: #4d4d4c;"> parse</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">JSONObject</span><span class="pln" style="color: #4d4d4c;"> jObject</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">>>></span><span class="pln" style="color: #4d4d4c;"> routes </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ArrayList</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">>>>();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">JSONArray</span><span class="pln" style="color: #4d4d4c;"> jRoutes </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">JSONArray</span><span class="pln" style="color: #4d4d4c;"> jLegs </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">JSONArray</span><span class="pln" style="color: #4d4d4c;"> jSteps </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">try</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
jRoutes </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> jObject</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getJSONArray</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"routes"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/** Traversing all routes */</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">for</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> i </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;"> i </span><span class="pun" style="color: #4d4d4c;"><</span><span class="pln" style="color: #4d4d4c;"> jRoutes</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">length</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;"> i</span><span class="pun" style="color: #4d4d4c;">++)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
jLegs </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">((</span><span class="typ" style="color: #4271ae;">JSONObject</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> jRoutes</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">i</span><span class="pun" style="color: #4d4d4c;">)).</span><span class="pln" style="color: #4d4d4c;">getJSONArray</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"legs"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">>></span><span class="pln" style="color: #4d4d4c;"> path </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ArrayList</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">>>();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/** Traversing all legs */</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">for</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> j </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;"> j </span><span class="pun" style="color: #4d4d4c;"><</span><span class="pln" style="color: #4d4d4c;"> jLegs</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">length</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;"> j</span><span class="pun" style="color: #4d4d4c;">++)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
jSteps </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">((</span><span class="typ" style="color: #4271ae;">JSONObject</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> jLegs</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">j</span><span class="pun" style="color: #4d4d4c;">)).</span><span class="pln" style="color: #4d4d4c;">getJSONArray</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"steps"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/** Traversing all steps */</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">for</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> k </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;"> k </span><span class="pun" style="color: #4d4d4c;"><</span><span class="pln" style="color: #4d4d4c;"> jSteps</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">length</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;"> k</span><span class="pun" style="color: #4d4d4c;">++)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> polyline </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">""</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
polyline </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">((</span><span class="typ" style="color: #4271ae;">JSONObject</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">((</span><span class="typ" style="color: #4271ae;">JSONObject</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> jSteps
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">k</span><span class="pun" style="color: #4d4d4c;">)).</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"polyline"</span><span class="pun" style="color: #4d4d4c;">)).</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"points"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> list </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> decodePoly</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">polyline</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/** Traversing all points */</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">for</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> l </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;"> l </span><span class="pun" style="color: #4d4d4c;"><</span><span class="pln" style="color: #4d4d4c;"> list</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">size</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;"> l</span><span class="pun" style="color: #4d4d4c;">++)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> hm </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">>();</span><span class="pln" style="color: #4d4d4c;">
hm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"lat"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Double</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">(((</span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> list</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">l</span><span class="pun" style="color: #4d4d4c;">)).</span><span class="pln" style="color: #4d4d4c;">latitude</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
hm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"lng"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Double</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">(((</span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> list</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">l</span><span class="pun" style="color: #4d4d4c;">)).</span><span class="pln" style="color: #4d4d4c;">longitude</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
path</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">add</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">hm</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
routes</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">add</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">path</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">catch</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">JSONException</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
e</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">printStackTrace</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">catch</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Exception</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> routes</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/**
* Method Courtesy :
* jeffreysambells.com/2010/05/27
* /decoding-polylines-from-google-maps-direction-api-with-java
* */</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> decodePoly</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> encoded</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> poly </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ArrayList</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pun" style="color: #4d4d4c;">>();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> index </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> len </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> encoded</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">length</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> lat </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> lng </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">while</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">index </span><span class="pun" style="color: #4d4d4c;"><</span><span class="pln" style="color: #4d4d4c;"> len</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> b</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> shift </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> result </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">do</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
b </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> encoded</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">charAt</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">index</span><span class="pun" style="color: #4d4d4c;">++)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">-</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">63</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
result </span><span class="pun" style="color: #4d4d4c;">|=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">b </span><span class="pun" style="color: #4d4d4c;">&</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0x1f</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;"><<</span><span class="pln" style="color: #4d4d4c;"> shift</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
shift </span><span class="pun" style="color: #4d4d4c;">+=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">5</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">while</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">b </span><span class="pun" style="color: #4d4d4c;">>=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0x20</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> dlat </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">((</span><span class="pln" style="color: #4d4d4c;">result </span><span class="pun" style="color: #4d4d4c;">&</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">1</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">?</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">~(</span><span class="pln" style="color: #4d4d4c;">result </span><span class="pun" style="color: #4d4d4c;">>></span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">1</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">:</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">result </span><span class="pun" style="color: #4d4d4c;">>></span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">1</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
lat </span><span class="pun" style="color: #4d4d4c;">+=</span><span class="pln" style="color: #4d4d4c;"> dlat</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
shift </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
result </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">do</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
b </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> encoded</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">charAt</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">index</span><span class="pun" style="color: #4d4d4c;">++)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">-</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">63</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
result </span><span class="pun" style="color: #4d4d4c;">|=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">b </span><span class="pun" style="color: #4d4d4c;">&</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0x1f</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;"><<</span><span class="pln" style="color: #4d4d4c;"> shift</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
shift </span><span class="pun" style="color: #4d4d4c;">+=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">5</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">while</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">b </span><span class="pun" style="color: #4d4d4c;">>=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0x20</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> dlng </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">((</span><span class="pln" style="color: #4d4d4c;">result </span><span class="pun" style="color: #4d4d4c;">&</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">1</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">?</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">~(</span><span class="pln" style="color: #4d4d4c;">result </span><span class="pun" style="color: #4d4d4c;">>></span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">1</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">:</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">result </span><span class="pun" style="color: #4d4d4c;">>></span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">1</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
lng </span><span class="pun" style="color: #4d4d4c;">+=</span><span class="pln" style="color: #4d4d4c;"> dlng</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pln" style="color: #4d4d4c;"> p </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">LatLng</span><span class="pun" style="color: #4d4d4c;">((((</span><span class="kwd" style="color: #8959a8;">double</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> lat </span><span class="pun" style="color: #4d4d4c;">/</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">1E5</span><span class="pun" style="color: #4d4d4c;">)),</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">(((</span><span class="kwd" style="color: #8959a8;">double</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> lng </span><span class="pun" style="color: #4d4d4c;">/</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">1E5</span><span class="pun" style="color: #4d4d4c;">)));</span><span class="pln" style="color: #4d4d4c;">
poly</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">add</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">p</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> poly</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span></pre>
<h3 style="font-family: Georgia, Times, serif;">
activity_path_google_map.xml</h3>
<div style="font-family: Arial, sans-serif; font-size: 14.4px; line-height: 21.6px;">
</div>
<pre class="prettyprint lang-xml prettyprinted" style="border: 1px dashed rgb(207, 207, 207); font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 14.4px; line-height: 1.3em; margin-bottom: 18px; max-height: 600px; overflow: auto; padding: 4px; tab-size: 4;"><span class="tag" style="color: #c82829;"><RelativeLayout</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">xmlns:android</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"http://schemas.android.com/apk/res/android"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">xmlns:tools</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"http://schemas.android.com/tools"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"match_parent"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"match_parent"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">tools:context</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">".TaskRoadMap"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><fragment</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:id</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/map"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">class</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"com.google.android.gms.maps.SupportMapFragment"</span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"></RelativeLayout></span><span class="pln" style="color: #4d4d4c;">
</span></pre>
<div style="font-family: Arial, sans-serif; font-size: 14.4px; line-height: 21.6px;">
</div>
<h3 style="font-family: Georgia, Times, serif;">
AndroidManifest.xml</h3>
<div style="font-family: Arial, sans-serif; font-size: 14.4px; line-height: 21.6px;">
</div>
<br />
<div style="font-family: Arial, sans-serif; font-size: 14.4px; line-height: 21.6px;">
</div>
<br />
<pre class="prettyprint lang-xml prettyprinted" style="-webkit-text-stroke-width: 0px; border: 1px dashed rgb(207, 207, 207); color: black; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 14.4px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 1.3em; margin: 0px 0px 18px; max-height: 600px; orphans: auto; overflow: auto; padding: 4px; tab-size: 4; text-align: start; text-indent: 0px; text-transform: none; widows: 1; word-spacing: 0px;"><span class="pun" style="color: #4d4d4c;"><?</span><span class="pln" style="color: #4d4d4c;">xml version</span><span class="pun" style="color: #4d4d4c;">=</span><span class="str" style="color: #718c00;">"1.0"</span><span class="pln" style="color: #4d4d4c;"> encoding</span><span class="pun" style="color: #4d4d4c;">=</span><span class="str" style="color: #718c00;">"utf-8"</span><span class="pun" style="color: #4d4d4c;">?></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><manifest</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">xmlns:android</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"http://schemas.android.com/apk/res/android"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">package</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"com.smr.android.maps.path"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:versionCode</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"1"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:versionName</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"1.0"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><uses-sdk</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:minSdkVersion</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"8"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:targetSdkVersion</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"18"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><permission</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:name</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"com.smr.android.maps.path.permission.MAPS_RECEIVE"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:protectionLevel</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"signature"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><uses-permission</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">android:name</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"com.<span style="font-size: 14.4px; line-height: 1.3em;">smr</span><span class="atv" style="font-size: 14.4px; line-height: 1.3em;">.android.maps.path.permission.MAPS_RECEIVE"</span><span class="pln" style="color: #4d4d4c; font-size: 14.4px; line-height: 1.3em;"> </span><span class="tag" style="color: #c82829; font-size: 14.4px; line-height: 1.3em;">/></span></span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;"><uses-permission</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">android:name</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"android.permission.INTERNET"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><uses-permission</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">android:name</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"android.permission.ACCESS_NETWORK_STATE"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><uses-permission</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">android:name</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"android.permission.WRITE_EXTERNAL_STORAGE"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><uses-permission</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">android:name</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"com.google.android.providers.gsf.permission.READ_GSERVICES"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><uses-permission</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">android:name</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"android.permission.ACCESS_COARSE_LOCATION"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><uses-permission</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">android:name</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"android.permission.ACCESS_FINE_LOCATION"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><uses-feature</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:glEsVersion</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"0x00020000"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:required</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><application</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:allowBackup</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:icon</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@drawable/ic_launcher"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:label</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@string/app_name"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:theme</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@style/AppTheme"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><activity</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:name</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"com.<span style="font-size: 14.4px; line-height: 1.3em;">smr</span><span style="font-size: 14.4px; line-height: 1.3em;">.android.maps.path.PathGoogleMapActivity"</span></span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">android:label</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@string/title_activity_path_google_map"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><intent-filter></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><action</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">android:name</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"android.intent.action.MAIN"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><category</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">android:name</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"android.intent.category.LAUNCHER"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"></intent-filter></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"></activity></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><meta-data</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:name</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"com.google.android.maps.v2.API_KEY"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:value</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"AIzaSyARCTcX8bABCDE_ohscNcALAak-HnjTO5s"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><meta-data</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:name</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"com.google.android.gms.version"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:value</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@integer/google_play_services_version"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"></application></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"></manifest></span></pre>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-52938271628522878612016-06-22T18:27:00.000+06:002016-06-22T18:27:07.283+06:00truncate table in sqlite table in android.<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
Try this:</div>
<div style="background-color: white; border: 0px; clear: both; color: #333333; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
<b><i><span style="color: red;">Use this for truncate sqlite table in android</span></i></b><span style="color: #242729;">. </span></div>
<div style="background-color: white; border: 0px; clear: both; color: #333333; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
<span style="color: #242729;">this command 1st delete all from table but </span><span style="color: magenta;">Auto-increment Primary</span><span style="color: #242729;"> key field is exist that reset 2nd command . Totally You get truncate table. like = truncate 'table_name' ;</span></div>
<pre class="lang-sql prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="kwd" style="border: 0px; color: #101094; margin: 0px; padding: 0px;">delete</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: #101094; margin: 0px; padding: 0px;">from</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> your_table</span><span class="pun" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">;</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: #101094; margin: 0px; padding: 0px;">delete</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: #101094; margin: 0px; padding: 0px;">from</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> sqlite_sequence </span><span class="kwd" style="border: 0px; color: #101094; margin: 0px; padding: 0px;">where</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> name</span><span class="pun" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">=</span><span class="str" style="border: 0px; color: #7d2727; margin: 0px; padding: 0px;">'your_table'</span><span class="pun" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">;</span></code></pre>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-40808844010196424142016-06-22T18:25:00.002+06:002016-06-22T18:25:43.010+06:00Resetting Autoincrement in Android SQLite after delete table<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
Try this:</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
<b><i><span style="color: red;">Use this for truncate sqlite table in android</span></i></b><span style="color: #242729;">. </span></div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
<span style="color: #242729;">this command 1st delete all from table but </span><span style="color: magenta;">Auto-increment Primary</span><span style="color: #242729;"> key field is exist that reset 2nd command . Totally You get truncate table. like = truncate 'table_name' ;</span></div>
<pre class="lang-sql prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="kwd" style="border: 0px; color: #101094; margin: 0px; padding: 0px;">delete</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: #101094; margin: 0px; padding: 0px;">from</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> your_table</span><span class="pun" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">;</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: #101094; margin: 0px; padding: 0px;">delete</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: #101094; margin: 0px; padding: 0px;">from</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> sqlite_sequence </span><span class="kwd" style="border: 0px; color: #101094; margin: 0px; padding: 0px;">where</span><span class="pln" style="border: 0px; color: #303336; margin: 0px; padding: 0px;"> name</span><span class="pun" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">=</span><span class="str" style="border: 0px; color: #7d2727; margin: 0px; padding: 0px;">'your_table'</span><span class="pun" style="border: 0px; color: #303336; margin: 0px; padding: 0px;">;</span></code></pre>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-18783211412601428432016-06-06T17:06:00.003+06:002016-06-06T17:14:11.778+06:00Android Sending SMS Example<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
In some situations, we want to send sms messages from our own Android application. There are two different ways to do such a thing:</div>
<ul style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; margin: 0px 0px 25px 10px; outline: none; padding: 0px;">
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;">By using <a href="http://developer.android.com/reference/android/telephony/SmsManager.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;" target="_blank"><code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">SmsManager</code></a> class</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;">By using an <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">implicit <a href="http://developer.android.com/reference/android/content/Intent.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;" target="_blank">Intent</a></code></li>
</ul>
<div style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
The use of <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">SmsManager</code> facilitates the sms sending because it gives us the opportunity to customize this functionality with the manner we want, within our own <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">Activity</code>. In parallel, the use of <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">Intents</code> implies the use of built-in applications and sms clients that are installed in each Android device. In this example, we are going to implement both ways. More specifically, we are going to send a sms by using <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">SmsManager</code> and <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">implicit Intent</code> with<code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">SENDTO</code> action and/or <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">VIEW</code> action.</div>
<div style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
<span style="font-family: "helvetica"; font-size: 30px; line-height: 1em;">2. Create the layout of the Main Activity</span></div>
<div style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
We will put two <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">EditTexts</code> so that the user can fill in a phone number and a message for a SMS. Also, we are going to add three different <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">Buttons</code>, that each one enables a different action and uses a suitable class (<code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">smsManager</code>, <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">Intent</code> with<code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">SENDTO</code> action, <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">Intent</code> with <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">VIEW</code> action).</div>
<div style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
Open <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">res/layout/activity_main.xml</code> and go to the respective xml tab. Then paste the following.</div>
<div style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
<em style="border: 0px none; list-style: none; margin: 0px; outline: none; padding: 0px;"><u style="border: 0px none; list-style: none; margin: 0px; outline: none; padding: 0px;">activity_main.xml:</u></em></div>
<div class="syntaxhighlighter " id="highlighter_445010" style="background: none rgb(255, 255, 255) !important; border: 1px solid rgb(224, 224, 224) !important; bottom: auto !important; color: #333333; direction: ltr !important; display: inline-block; float: none !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 15px; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 1em 0px !important; outline: 0px !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 811.797px;">
<div class="lines" style="background: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background: none !important; border-collapse: collapse !important; border-radius: 3px; border-spacing: 0px; border: 0px !important; bottom: auto !important; color: #333333; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background: none !important; border: 0px !important; bottom: auto !important; color: #666666; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; font-stretch: normal; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; overflow-x: visible; overflow-y: hidden; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"><br /></code></td><td class="content" style="background: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; color: rgb(0, 0, 0) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 820px;"><pre style="line-height: normal;"><pre><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Complete the fields to send a sms"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/phoneNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="ex: 1234567890"
android:inputType="phone" />
<EditText
android:id="@+id/smsBody"
android:layout_width="fill_parent"
android:layout_height="80dp"
android:layout_marginBottom="30dp"
android:hint="Write your sms here...." />
<Button
android:id="@+id/smsManager"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Send the sms by SmsManager" />
<Button
android:id="@+id/smsSIntent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Send the sms by SENDTO" />
<Button
android:id="@+id/smsVIntent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Send the sms by VIEW" />
</LinearLayout></pre>
</pre>
</td></tr>
</tbody></table>
</div>
</div>
</div>
<h2 style="background-color: white; border: 0px none; color: #333333; font-family: Helvetica; font-size: 30px; font-weight: normal; line-height: 1em; list-style: none; margin: 25px 0px 10px; outline: none; padding: 0px;">
3. Code the Main Activity</h2>
<div style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
<code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">SmsManager</code> handles SMS operations and <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">getDefault()</code> method should be called, in order to get an instance of this object. For the intent with <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">ACTION_SENDTO</code> we have to define the data as <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">smsto:</code> and the phone number added at the end. Respectively, for the intent with <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">ACTION_VIEW</code> we will define the type as <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">vnd.android-dir/mms-sms</code>, so only sms-mms providers will launch. Also, we have to add the phone number and the message as extra fields to that intent.</div>
<div style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
Open <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">src/com.javacodegeeks.android.sendsmstest/MainActivity.java</code> and paste the following.</div>
<div style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
<em style="border: 0px none; list-style: none; margin: 0px; outline: none; padding: 0px;"><u style="border: 0px none; list-style: none; margin: 0px; outline: none; padding: 0px;">MainActivity.java:</u></em></div>
<div class="syntaxhighlighter " id="highlighter_268723" style="background: none rgb(255, 255, 255) !important; border: 1px solid rgb(224, 224, 224) !important; bottom: auto !important; color: #333333; direction: ltr !important; display: inline-block; float: none !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 15px; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 1em 0px !important; outline: 0px !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 811.797px;">
<div class="lines" style="background: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background: none !important; border-collapse: collapse !important; border-radius: 3px; border-spacing: 0px; border: 0px !important; bottom: auto !important; color: #333333; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background: none !important; border: 0px !important; bottom: auto !important; color: #666666; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; font-stretch: normal; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; overflow-x: visible; overflow-y: hidden; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"><br /></code></td><td class="content" style="background: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; color: rgb(0, 0, 0) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 820px;"><pre style="line-height: normal;">package com.sbg.android.sendsmstest;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends Activity {
private EditText phoneNumber;
private EditText smsBody;
private Button smsManagerBtn;
private Button smsSendToBtn;
private Button smsViewBtn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
phoneNumber = (EditText) findViewById(R.id.phoneNumber);
smsBody = (EditText) findViewById(R.id.smsBody);
smsManagerBtn = (Button) findViewById(R.id.smsManager);
smsSendToBtn = (Button) findViewById(R.id.smsSIntent);
smsViewBtn = (Button) findViewById(R.id.smsVIntent);
smsManagerBtn.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
sendSmsByManager();
}
});
smsSendToBtn.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
sendSmsBySIntent();
}
});
smsViewBtn.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
sendSmsByVIntent();
}
});
}
public void sendSmsByManager() {
try {
// Get the default instance of the SmsManager
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNumber.getText().toString(),
null,
smsBody.getText().toString(),
null,
null);
Toast.makeText(getApplicationContext(), "Your sms has successfully sent!",
Toast.LENGTH_LONG).show();
} catch (Exception ex) {
Toast.makeText(getApplicationContext(),"Your sms has failed...",
Toast.LENGTH_LONG).show();
ex.printStackTrace();
}
}
public void sendSmsBySIntent() {
// add the phone number in the data
Uri uri = Uri.parse("smsto:" + phoneNumber.getText().toString());
Intent smsSIntent = new Intent(Intent.ACTION_SENDTO, uri);
// add the message at the sms_body extra field
smsSIntent.putExtra("sms_body", smsBody.getText().toString());
try{
startActivity(smsSIntent);
} catch (Exception ex) {
Toast.makeText(MainActivity.this, "Your sms has failed...",
Toast.LENGTH_LONG).show();
ex.printStackTrace();
}
}
public void sendSmsByVIntent() {
Intent smsVIntent = new Intent(Intent.ACTION_VIEW);
// prompts only sms-mms clients
smsVIntent.setType("vnd.android-dir/mms-sms");
// extra fields for number and message respectively
smsVIntent.putExtra("address", phoneNumber.getText().toString());
smsVIntent.putExtra("sms_body", smsBody.getText().toString());
try{
startActivity(smsVIntent);
} catch (Exception ex) {
Toast.makeText(MainActivity.this, "Your sms has failed...",
Toast.LENGTH_LONG).show();
ex.printStackTrace();
}
}
}</pre>
</td></tr>
</tbody></table>
</div>
</div>
</div>
<h2 style="background-color: white; border: 0px none; color: #333333; font-family: Helvetica; font-size: 30px; font-weight: normal; line-height: 1em; list-style: none; margin: 25px 0px 10px; outline: none; padding: 0px;">
4. Set the SMS Permission</h2>
<div style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
We should set <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">SEND_SMS</code> as permission in the <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">AndroidManifest.xml</code> file, in order to send an SMS via our application. At this point, we should mention that the permission must be defined for <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">smsManager</code>, but it is not necessary for the <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">implicit Intents</code>.</div>
<div style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
Open <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">AndroidManifest.xml</code> file and go to the respective xml tab. Then paste the permission <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">android.permission.SEND_SMS</code>, as you can see below.</div>
<div style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
<em style="border: 0px none; list-style: none; margin: 0px; outline: none; padding: 0px;"><u style="border: 0px none; list-style: none; margin: 0px; outline: none; padding: 0px;">AndroidManifest.xml:</u></em></div>
<div class="syntaxhighlighter " id="highlighter_758618" style="background: none rgb(255, 255, 255) !important; border: 1px solid rgb(224, 224, 224) !important; bottom: auto !important; color: #333333; direction: ltr !important; display: inline-block; float: none !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 15px; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 1em 0px !important; outline: 0px !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 811.797px;">
<div class="lines" style="background: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<table style="background: none !important; border-collapse: collapse !important; border-radius: 3px; border-spacing: 0px; border: 0px !important; bottom: auto !important; color: #333333; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><tbody style="background: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background: none !important; border: 0px !important; bottom: auto !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="number" style="background: none !important; border: 0px !important; bottom: auto !important; color: rgb(175, 175, 175) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 3em !important;"><code style="background: none !important; border: 0px !important; bottom: auto !important; color: #666666; direction: ltr !important; display: block !important; float: none !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; font-stretch: normal; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; overflow-x: visible; overflow-y: hidden; padding: 0px 0.3em 0px 0px !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; width: 2.7em !important;"><br /></code></td><td class="content" style="background: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; color: rgb(0, 0, 0) !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; list-style: none; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: top !important; width: 820px;"><pre style="line-height: normal;"><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dfd.android.sendsmstest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.SEND_SMS" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.javacodegeeks.android.sendsmstest.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest></pre>
</td></tr>
</tbody></table>
</div>
</div>
</div>
<h2 style="background-color: white; border: 0px none; color: #333333; font-family: Helvetica; font-size: 30px; font-weight: normal; line-height: 1em; list-style: none; margin: 25px 0px 10px; outline: none; padding: 0px;">
5. Run the application</h2>
<h2 style="background-color: white; border: 0px none; color: #333333; font-family: Helvetica; font-size: 30px; font-weight: normal; line-height: 1em; list-style: none; margin: 25px 0px 10px; outline: none; padding: 0px;">
<div style="border: 0px none; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
To run our application, right click on our project → Run as → Android Application. The AVD will appear with the app loaded.</div>
<div style="border: 0px none; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
Fill in a phone number and a message in order to send a sms, as shown in the picture below.</div>
<div style="border: 0px none; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
<a href="http://examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj1.png" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;"><img alt="ADVSmsProj1" class="alignnone size-full wp-image-7643" height="359" sizes="(max-width: 256px) 100vw, 256px" src="https://examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj1.png" srcset="//examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj1.png 256w, //examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj1-213x300.png 213w" style="border: 0px none; height: auto; list-style: none; margin: 0px; max-width: 100%; outline: none; padding: 0px;" width="256" /></a></div>
<div style="border: 0px none; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
Lets press “Send the sms by SmsManager” button. The sms will be sent via <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">smsManager</code>, so a <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">Toast</code> will appear which certify the success of sms sending. Otherwise, an error message would be appeared.</div>
<div style="border: 0px none; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
<a href="http://examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj2.png" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;"><img alt="ADVSmsProj2" class="alignnone size-full wp-image-7644" height="359" sizes="(max-width: 256px) 100vw, 256px" src="https://examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj2.png" srcset="//examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj2.png 256w, //examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj2-213x300.png 213w" style="border: 0px none; height: auto; list-style: none; margin: 0px; max-width: 100%; outline: none; padding: 0px;" width="256" /></a></div>
<div style="border: 0px none; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
Now press the “Send the sms by SENDTO” button. If more than one applications, that use a <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">SENDTO</code> action exist, the user will choose one of the displayed ones. For example, our emulator contains an application that uses an implicit intent with<code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;">ACTION_SENDTO</code>, as shown in the picture.</div>
<div style="border: 0px none; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
<a href="http://examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj3.png" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;"><img alt="ADVSmsProj3" class="alignnone size-full wp-image-7645" height="359" sizes="(max-width: 256px) 100vw, 256px" src="https://examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj3.png" srcset="//examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj3.png 256w, //examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj3-213x300.png 213w" style="border: 0px none; height: auto; list-style: none; margin: 0px; max-width: 100%; outline: none; padding: 0px;" width="256" /></a></div>
<div style="border: 0px none; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
Lets choose the default Android app for sms. As you can see in the picture below, the fields are completed with the elements that the user gave previously.</div>
<div style="border: 0px none; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
<a href="http://examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj4.png" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;"><img alt="ADVSmsProj4" class="alignnone size-full wp-image-7646" height="359" sizes="(max-width: 256px) 100vw, 256px" src="https://examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj4.png" srcset="//examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj4.png 256w, //examples.javacodegeeks.com/wp-content/uploads/2013/12/ADVSmsProj4-213x300.png 213w" style="border: 0px none; height: auto; list-style: none; margin: 0px; max-width: 100%; outline: none; padding: 0px;" width="256" /></a></div>
<div style="border: 0px none; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; line-height: 22.5px; list-style: none; outline: none; padding: 0px 0px 1em;">
Finally if we press the “Send the sms by VIEW” button, the device’s Built-in SMS application will launch with the appropriate fields filled in, same as shown in the image above.</div>
</h2>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-1375823173803912312016-06-06T12:40:00.003+06:002016-06-06T12:40:34.204+06:00How to make a phone call in Android<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 24px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 40px;">
1 Android Layout Files</h2>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 22.8571px; margin-bottom: 10px;">
Simpel layout file, to display a button.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 22.8571px; margin-bottom: 10px;">
<em style="box-sizing: border-box;">File : res/layout/main.xml</em></div>
<div class="prism-show-language" style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 22.8571px; position: relative;">
<div class="prism-show-language-label" style="background-color: #cfcfcf; border-radius: 0px 0px 0px 5px; bottom: auto; box-shadow: none; box-sizing: border-box; color: black; display: inline-block; font-size: 0.9em; height: auto; left: auto; padding: 0px 0.5em; position: absolute; right: 0px; text-shadow: none; top: 0px; transform: none; width: auto; z-index: 1;">
Markup</div>
</div>
<pre class=" language-markup" style="background: rgb(247, 247, 249); border-radius: 0px 0px 4px 4px; border: 1px solid rgb(209, 209, 232); box-sizing: border-box; direction: ltr; font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; font-size: 13px; line-height: 1.5; margin-bottom: 20px; overflow: auto; padding: 1em; tab-size: 4; text-shadow: white 0px 1px; word-break: normal; word-wrap: normal;"><code class=" language-markup" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; direction: ltr; font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; font-size: inherit; line-height: 1.5; padding: 0px; tab-size: 4; text-shadow: white 0px 1px; word-break: normal; word-spacing: normal; word-wrap: normal;"><span class="token prolog" style="box-sizing: border-box; color: slategrey;"><?xml version="1.0" encoding="utf-8"?></span>
<span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"><</span>LinearLayout</span> <span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">xmlns:</span>android</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>http://schemas.android.com/apk/res/android<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span>
<span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>layout_width</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>fill_parent<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span>
<span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>layout_height</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>fill_parent<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span>
<span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>orientation</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>vertical<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">></span></span>
<span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"><</span>Button</span>
<span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>id</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>@+id/buttonCall<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span>
<span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>layout_width</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>wrap_content<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span>
<span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>layout_height</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>wrap_content<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span>
<span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>text</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>call 0377778888<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">/></span></span>
<span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"></</span>LinearLayout</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">></span></span>
</code></pre>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 22.8571px;">
<div class="ads-in-post hide_if_width_less_800" style="box-sizing: border-box; margin: 10px 0px;">
<ins class="adsbygoogle hide_if_width_less_800" data-ad-client="ca-pub-2836379775501347" data-ad-region="mkyongregion" data-ad-slot="7391621200" data-adsbygoogle-status="done" style="box-sizing: border-box; display: inline-block; height: 90px; width: 728px;"><ins id="aswift_1_expand" style="background-color: transparent; border: none; box-sizing: border-box; display: inline-table; height: 90px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;"><ins id="aswift_1_anchor" style="background-color: transparent; border: none; box-sizing: border-box; display: block; height: 90px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;"><iframe allowfullscreen="true" allowtransparency="true" frameborder="0" height="90" hspace="0" id="aswift_1" marginheight="0" marginwidth="0" name="aswift_1" scrolling="no" style="box-sizing: border-box; left: 0px; position: absolute; top: 0px;" vspace="0" width="728"></iframe><span style="font-size: 24px; line-height: 1.1;">2. Activity</span></ins><ins id="aswift_1_anchor" style="background-color: transparent; border: none; box-sizing: border-box; display: block; height: 90px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;"><span style="line-height: 22.8571px;">Use below code snippet to make a phone call in Android.</span></ins></ins></ins></div>
</div>
<div class="prism-show-language" style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 22.8571px; position: relative;">
<div class="prism-show-language-label" style="background-color: #cfcfcf; border-radius: 0px 0px 0px 5px; bottom: auto; box-shadow: none; box-sizing: border-box; color: black; display: inline-block; font-size: 0.9em; height: auto; left: auto; padding: 0px 0.5em; position: absolute; right: 0px; text-shadow: none; top: 0px; transform: none; width: auto; z-index: 1;">
Java</div>
</div>
<pre class=" language-java" style="background: rgb(247, 247, 249); border-radius: 0px 0px 4px 4px; border: 1px solid rgb(209, 209, 232); box-sizing: border-box; direction: ltr; font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; font-size: 13px; line-height: 1.5; margin-bottom: 20px; overflow: auto; padding: 1em; tab-size: 4; text-shadow: white 0px 1px; word-break: normal; word-wrap: normal;"><code class=" language-java" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; direction: ltr; font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; font-size: inherit; line-height: 1.5; padding: 0px; tab-size: 4; text-shadow: white 0px 1px; word-break: normal; word-spacing: normal; word-wrap: normal;"> Intent callIntent <span class="token operator" style="background: rgba(255, 255, 255, 0.498039); box-sizing: border-box; color: #a67f59;">=</span> <span class="token keyword" style="box-sizing: border-box; color: #0077aa;">new</span> <span class="token class-name" style="box-sizing: border-box;">Intent</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span>Intent<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>ACTION_CALL<span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
callIntent<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span><span class="token function" style="box-sizing: border-box; color: #dd4a68;">setData</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span>Uri<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span><span class="token function" style="box-sizing: border-box; color: #dd4a68;">parse</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span><span class="token string" style="box-sizing: border-box; color: #669900;">"tel:0377778888"</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
<span class="token function" style="box-sizing: border-box; color: #dd4a68;">startActivity</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span>callIntent<span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
</code></pre>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 22.8571px; margin-bottom: 10px;">
<em style="box-sizing: border-box;">File : MainActivity.java</em> – When the button is call, make a phone to 0377778888.</div>
<div class="prism-show-language" style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 22.8571px; position: relative;">
<div class="prism-show-language-label" style="background-color: #cfcfcf; border-radius: 0px 0px 0px 5px; bottom: auto; box-shadow: none; box-sizing: border-box; color: black; display: inline-block; font-size: 0.9em; height: auto; left: auto; padding: 0px 0.5em; position: absolute; right: 0px; text-shadow: none; top: 0px; transform: none; width: auto; z-index: 1;">
Java</div>
</div>
<pre class=" language-java" style="background: rgb(247, 247, 249); border-radius: 0px 0px 4px 4px; border: 1px solid rgb(209, 209, 232); box-sizing: border-box; direction: ltr; font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; font-size: 13px; line-height: 1.5; margin-bottom: 20px; overflow: auto; padding: 1em; tab-size: 4; text-shadow: white 0px 1px; word-break: normal; word-wrap: normal;"><code class=" language-java" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; direction: ltr; font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; font-size: inherit; line-height: 1.5; padding: 0px; tab-size: 4; text-shadow: white 0px 1px; word-break: normal; word-spacing: normal; word-wrap: normal;"><span class="token keyword" style="box-sizing: border-box; color: #0077aa;">package</span> com<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>mkyong<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>android<span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
<span class="token keyword" style="box-sizing: border-box; color: #0077aa;">import</span> android<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>app<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>Activity<span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
<span class="token keyword" style="box-sizing: border-box; color: #0077aa;">import</span> android<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>content<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>Intent<span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
<span class="token keyword" style="box-sizing: border-box; color: #0077aa;">import</span> android<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>net<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>Uri<span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
<span class="token keyword" style="box-sizing: border-box; color: #0077aa;">import</span> android<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>os<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>Bundle<span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
<span class="token keyword" style="box-sizing: border-box; color: #0077aa;">import</span> android<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>view<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>View<span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
<span class="token keyword" style="box-sizing: border-box; color: #0077aa;">import</span> android<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>view<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>View<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>OnClickListener<span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
<span class="token keyword" style="box-sizing: border-box; color: #0077aa;">import</span> android<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>widget<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>Button<span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
<span class="token keyword" style="box-sizing: border-box; color: #0077aa;">public</span> <span class="token keyword" style="box-sizing: border-box; color: #0077aa;">class</span> <span class="token class-name" style="box-sizing: border-box;">MainActivity</span> <span class="token keyword" style="box-sizing: border-box; color: #0077aa;">extends</span> <span class="token class-name" style="box-sizing: border-box;">Activity</span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">{</span>
<span class="token keyword" style="box-sizing: border-box; color: #0077aa;">private</span> Button button<span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
<span class="token keyword" style="box-sizing: border-box; color: #0077aa;">public</span> <span class="token keyword" style="box-sizing: border-box; color: #0077aa;">void</span> <span class="token function" style="box-sizing: border-box; color: #dd4a68;">onCreate</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span>Bundle savedInstanceState<span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">{</span>
<span class="token keyword" style="box-sizing: border-box; color: #0077aa;">super</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span><span class="token function" style="box-sizing: border-box; color: #dd4a68;">onCreate</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span>savedInstanceState<span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
<span class="token function" style="box-sizing: border-box; color: #dd4a68;">setContentView</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span>R<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>layout<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>main<span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
button <span class="token operator" style="background: rgba(255, 255, 255, 0.498039); box-sizing: border-box; color: #a67f59;">=</span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span>Button<span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span> <span class="token function" style="box-sizing: border-box; color: #dd4a68;">findViewById</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span>R<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>id<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>buttonCall<span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
<span class="token comment" spellcheck="true" style="box-sizing: border-box; color: slategrey;">// add button listener</span>
button<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span><span class="token function" style="box-sizing: border-box; color: #dd4a68;">setOnClickListener</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span><span class="token keyword" style="box-sizing: border-box; color: #0077aa;">new</span> <span class="token class-name" style="box-sizing: border-box;">OnClickListener</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">{</span>
@Override
<span class="token keyword" style="box-sizing: border-box; color: #0077aa;">public</span> <span class="token keyword" style="box-sizing: border-box; color: #0077aa;">void</span> <span class="token function" style="box-sizing: border-box; color: #dd4a68;">onClick</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span>View arg0<span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">{</span>
Intent callIntent <span class="token operator" style="background: rgba(255, 255, 255, 0.498039); box-sizing: border-box; color: #a67f59;">=</span> <span class="token keyword" style="box-sizing: border-box; color: #0077aa;">new</span> <span class="token class-name" style="box-sizing: border-box;">Intent</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span>Intent<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span>ACTION_CALL<span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
callIntent<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span><span class="token function" style="box-sizing: border-box; color: #dd4a68;">setData</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span>Uri<span class="token punctuation" style="box-sizing: border-box; color: #999999;">.</span><span class="token function" style="box-sizing: border-box; color: #dd4a68;">parse</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span><span class="token string" style="box-sizing: border-box; color: #669900;">"tel:0377778888"</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
<span class="token function" style="box-sizing: border-box; color: #dd4a68;">startActivity</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">(</span>callIntent<span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
<span class="token punctuation" style="box-sizing: border-box; color: #999999;">}</span>
<span class="token punctuation" style="box-sizing: border-box; color: #999999;">}</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">)</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">;</span>
<span class="token punctuation" style="box-sizing: border-box; color: #999999;">}</span>
<span class="token punctuation" style="box-sizing: border-box; color: #999999;">}</span>
</code></pre>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 22.8571px;">
<div class="ads-in-post hide_if_width_less_800" style="box-sizing: border-box; margin: 10px 0px;">
<ins class="adsbygoogle hide_if_width_less_800" data-ad-client="ca-pub-2836379775501347" data-ad-region="mkyongregion" data-ad-slot="3642936086" data-adsbygoogle-status="done" style="box-sizing: border-box; display: inline-block; height: 90px; width: 728px;"><ins id="aswift_2_expand" style="background-color: transparent; border: none; box-sizing: border-box; display: inline-table; height: 90px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;"><ins id="aswift_2_anchor" style="background-color: transparent; border: none; box-sizing: border-box; display: block; height: 90px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;"><iframe allowfullscreen="true" allowtransparency="true" frameborder="0" height="90" hspace="0" id="aswift_2" marginheight="0" marginwidth="0" name="aswift_2" scrolling="no" style="box-sizing: border-box; left: 0px; position: absolute; top: 0px;" vspace="0" width="728"></iframe><span style="font-size: 24px; line-height: 1.1;">3 Android Manifest</span></ins><ins id="aswift_2_anchor" style="background-color: transparent; border: none; box-sizing: border-box; display: block; height: 90px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;"><span style="line-height: 22.8571px;">To make a phone call, Android need</span><span style="line-height: 22.8571px;"> </span><strong style="box-sizing: border-box; line-height: 22.8571px;">CALL_PHONE</strong><span style="line-height: 22.8571px;"> </span><span style="line-height: 22.8571px;">permission.</span></ins></ins></ins></div>
</div>
<div class="prism-show-language" style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 22.8571px; position: relative;">
<div class="prism-show-language-label" style="background-color: #cfcfcf; border-radius: 0px 0px 0px 5px; bottom: auto; box-shadow: none; box-sizing: border-box; color: black; display: inline-block; font-size: 0.9em; height: auto; left: auto; padding: 0px 0.5em; position: absolute; right: 0px; text-shadow: none; top: 0px; transform: none; width: auto; z-index: 1;">
Markup</div>
</div>
<pre class=" language-markup" style="background: rgb(247, 247, 249); border-radius: 0px 0px 4px 4px; border: 1px solid rgb(209, 209, 232); box-sizing: border-box; direction: ltr; font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; font-size: 13px; line-height: 1.5; margin-bottom: 20px; overflow: auto; padding: 1em; tab-size: 4; text-shadow: white 0px 1px; word-break: normal; word-wrap: normal;"><code class=" language-markup" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; direction: ltr; font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; font-size: inherit; line-height: 1.5; padding: 0px; tab-size: 4; text-shadow: white 0px 1px; word-break: normal; word-spacing: normal; word-wrap: normal;"><span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"><</span>uses-permission</span> <span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>name</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>android.permission.CALL_PHONE<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">/></span></span>
</code></pre>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 22.8571px; margin-bottom: 10px;">
<em style="box-sizing: border-box;">File : AndroidManifest.xml</em></div>
<div class="prism-show-language" style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 16px; line-height: 22.8571px; position: relative;">
<div class="prism-show-language-label" style="background-color: #cfcfcf; border-radius: 0px 0px 0px 5px; bottom: auto; box-shadow: none; box-sizing: border-box; color: black; display: inline-block; font-size: 0.9em; height: auto; left: auto; padding: 0px 0.5em; position: absolute; right: 0px; text-shadow: none; top: 0px; transform: none; width: auto; z-index: 1;">
Markup</div>
</div>
<pre class=" language-markup" style="background: rgb(247, 247, 249); border-radius: 0px 0px 4px 4px; border: 1px solid rgb(209, 209, 232); box-sizing: border-box; direction: ltr; font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; font-size: 13px; line-height: 1.5; margin-bottom: 20px; overflow: auto; padding: 1em; tab-size: 4; text-shadow: white 0px 1px; word-break: normal; word-wrap: normal;"><code class=" language-markup" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; direction: ltr; font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; font-size: inherit; line-height: 1.5; padding: 0px; tab-size: 4; text-shadow: white 0px 1px; word-break: normal; word-spacing: normal; word-wrap: normal;"><span class="token prolog" style="box-sizing: border-box; color: slategrey;"><?xml version="1.0" encoding="utf-8"?></span>
<span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"><</span>manifest</span> <span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">xmlns:</span>android</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>http://schemas.android.com/apk/res/android<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span>
<span class="token attr-name" style="box-sizing: border-box; color: #669900;">package</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>com.mkyong.android<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span>
<span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>versionCode</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>1<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span>
<span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>versionName</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>1.0<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">></span></span>
<span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"><</span>uses-sdk</span> <span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>minSdkVersion</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>10<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">/></span></span>
<span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"><</span>uses-permission</span> <span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>name</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>android.permission.CALL_PHONE<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">/></span></span>
<span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"><</span>application</span>
<span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>icon</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>@drawable/ic_launcher<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span>
<span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>label</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>@string/app_name<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">></span></span>
<span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"><</span>activity</span>
<span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>label</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>@string/app_name<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span>
<span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>name</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>.MainActivity<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">></span></span>
<span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"><</span>intent-filter</span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">></span></span>
<span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"><</span>action</span> <span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>name</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>android.intent.action.MAIN<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">/></span></span>
<span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"><</span>category</span> <span class="token attr-name" style="box-sizing: border-box; color: #669900;"><span class="token namespace" style="box-sizing: border-box; opacity: 0.7;">android:</span>name</span><span class="token attr-value" style="box-sizing: border-box; color: #0077aa;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;">=</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span>android.intent.category.LAUNCHER<span class="token punctuation" style="box-sizing: border-box; color: #999999;">"</span></span> <span class="token punctuation" style="box-sizing: border-box; color: #999999;">/></span></span>
<span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"></</span>intent-filter</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">></span></span>
<span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"></</span>activity</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">></span></span>
<span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"></</span>application</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">></span></span>
<span class="token tag" style="box-sizing: border-box; color: #990055;"><span class="token tag" style="box-sizing: border-box;"><span class="token punctuation" style="box-sizing: border-box; color: #999999;"></</span>manifest</span><span class="token punctuation" style="box-sizing: border-box; color: #999999;">></span></span></code></pre>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-87869802481654131672016-06-04T18:22:00.001+06:002016-06-04T18:29:34.778+06:00Populate GridView with ImageView and TextView from Mysql database In Android<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: #a64d79; color: magenta;">1.First Activity Class for GrideView Main</span><br />
public class New_GridView_Activity extends AppCompatActivity {<br />
<br />
//Web api url<br />
public static final String DATA_URL = "http://172.107.10.20/SSS/sss/New_Retrive_Image_Non_Encode_Direct_From_Server.php";<br />
<br />
//Tag values to read from json<br />
public static final String TAG_IMAGE_Name = "PO_Image";<br />
public static final String TAG_NAME = "PO_Name";<br />
<br />
//GridView Object<br />
private GridView gridView;<br />
<br />
//ArrayList for Storing image urls and titles<br />
private static ArrayList<String> images;<br />
private static ArrayList<String> names;<br />
private ProgressDialog pDialog;<br />
@Override<br />
protected void onCreate(Bundle savedInstanceState) {<br />
super.onCreate(savedInstanceState);<br />
setContentView(R.layout.main_gridview_layout);<br />
<br />
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbarzoommm);<br />
toolbar.setLogo(R.drawable.logo);<br />
setSupportActionBar(toolbar);<br />
// getSupportActionBar().setDisplayHomeAsUpEnabled(true);<br />
toolbar.setNavigationOnClickListener(new View.OnClickListener() {<br />
@Override<br />
public void onClick(View v) {<br />
finish();<br />
}<br />
});<br />
<br />
gridView = (GridView) findViewById(R.id.gridView1);<br />
<br />
images = new ArrayList<>();<br />
names = new ArrayList<>();<br />
//Calling the getData method<br />
<span style="background-color: #ead1dc; color: #c27ba0;">getData();</span><br />
<br />
}<br />
<br />
public void <span style="background-color: #ead1dc;">getData()</span> {<br />
<br />
AsyncHttpClient client = new AsyncHttpClient();<br />
RequestParams params = new RequestParams();<br />
client.post(DATA_URL, params, new AsyncHttpResponseHandler() {<br />
<br />
@Override<br />
public void onStart() {<br />
pDialog = new ProgressDialog(New_GridView_Activity.this);<br />
pDialog.setMessage("Sending Request..");<br />
pDialog.setIndeterminate(false);<br />
pDialog.setCancelable(true);<br />
pDialog.show();<br />
}<br />
<br />
@Override<br />
public void onFinish() {<br />
super.onFinish();<br />
pDialog.dismiss();<br />
}<br />
<br />
@Override<br />
public void onSuccess(String response) {<br />
// super.onSuccess(response);<br />
Log.d("Rs service_ReloadSqlDB res ", response);<br />
try {<br />
JSONArray jsonArray = new JSONArray(response);<br />
<br />
if (jsonArray.length() > 0) {<br />
<br />
for (int i = 0; i < jsonArray.length(); i++) {<br />
JSONObject jsonObject = jsonArray.getJSONObject(i);<br />
<br />
String img = jsonObject.getString(TAG_IMAGE_Name);<br />
<br />
images.add(img);<br />
names.add(jsonObject.getString(TAG_NAME));<br />
<br />
}<br />
<span style="background-color: #8e7cc3;">MainFragment_CustomAdapter_Gridview</span> gridViewAdapter = new MainFragment_CustomAdapter_Gridview(New_GridView_Activity.this, images, names);<br />
<br />
gridView.setAdapter(gridViewAdapter);<br />
<br />
} else {<br />
Toast.makeText(New_GridView_Activity.this, "No Data Found", Toast.LENGTH_LONG).show();<br />
}<br />
<br />
} catch (JSONException e) {<br />
Log.d("Response Data Status:", e.getLocalizedMessage());<br />
}<br />
}<br />
<br />
@Override<br />
public void onFailure(Throwable throwable) {<br />
super.onFailure(throwable);<br />
Log.d(" RS onFailure ", throwable.toString());<br />
}<br />
});<br />
}<br />
<br />
}<br />
<span style="background-color: #d5a6bd; color: #351c75;">2.Adapter Class for Grid-view Main</span><br />
<span style="color: blue;">I get Image And Text from Server </span><span style="color: magenta;">as a String</span><span style="color: blue;"> using JSON with PHP Web API From MySQL Database. </span><br />
<span style="color: blue;">NB: I Use "</span><span style="color: #a64d79;">android-async-http-1.3.1.jar" </span><span style="color: blue;">Jar file in libs folder for web request .</span><br />
( <span style="background-color: #c27ba0;">AsyncHttpClient</span> ). use build.gradle = <span style="color: blue;">compile files('libs/<android-async-http-1.3.1.jar>')</span><br />
<span style="color: blue;"><br /></span>
public class <span style="background-color: #8e7cc3;">MainFragment_CustomAdapter_Gridview</span> extends BaseAdapter {<br />
private Context context;<br />
//Array List that would contain the urls and the titles for the images<br />
private ArrayList<String> images;<br />
private ArrayList<String> names;<br />
<br />
public MainFragment_CustomAdapter_Gridview(Context context, ArrayList<String> images, ArrayList<String> names) {<br />
//Getting all the values<br />
this.context = context;<br />
this.images = images;<br />
this.names = names;<br />
}<br />
@Override<br />
public int getCount() {<br />
return images.size();<br />
}<br />
@Override<br />
public Object getItem(int position) {<br />
return images.get(position);<br />
}<br />
@Override<br />
public long getItemId(int position) {<br />
return 0;<br />
}<br />
@Override<br />
public View getView(int position, View convertView, ViewGroup parent) {<br />
//Creating a linear layout<br />
View grid;<br />
if (convertView == null) {<br />
grid = new View(context);<br />
LayoutInflater inflater = LayoutInflater.from(context);<br />
grid = inflater.inflate(R.layout.mainfragment_customeadapter_layout, parent, false);<br />
} else {<br />
grid = (View) convertView;<br />
}<br />
<br />
ImageView imageView = (ImageView) grid.findViewById(R.id.imageView_Im);<br />
TextView textView = (TextView) grid.findViewById(R.id.textView_Name);<br />
<br />
final String getImage = images.get(position);<br />
<br />
InputStream stream = new ByteArrayInputStream(Base64.decode(getImage.getBytes(), Base64.DEFAULT));<br />
<br />
Bitmap theImage = BitmapFactory.decodeStream(stream);<br />
<br />
imageView.setImageBitmap(theImage);<br />
<br />
textView.setText(names.get(position));<br />
<br />
final String name = names.get(position);<br />
<br />
imageView.setOnClickListener(new View.OnClickListener() {<br />
@Override<br />
public void onClick(View v) {<br />
<br />
Intent i = new Intent(context, Product_Details_Activity.class);<br />
// Pass image index<br />
i.putExtra("id", getImage);<br />
i.putExtra("text", name);<br />
context.startActivity(i);<br />
}<br />
});<br />
return grid;<br />
}<br />
}<br />
<span style="background-color: #c27ba0; color: blue;">3.Use this layout class in Adapter class</span><br />
<span style="background-color: #c27ba0; color: blue;"><br /></span>
<span style="color: blue;"><?xml version="1.0" encoding="utf-8"?></span><br />
<span style="color: blue;"><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"</span><br />
<span style="color: blue;"> android:orientation="vertical"</span><br />
<span style="color: blue;"> android:layout_width="match_parent"</span><br />
<span style="color: blue;"> android:layout_height="match_parent"></span><br />
<span style="color: blue;"> <ImageView</span><br />
<span style="color: blue;"> android:id="@+id/imageView_Im"</span><br />
<span style="color: blue;"> android:layout_width="88dp"</span><br />
<span style="color: blue;"> android:layout_height="88dp"</span><br />
<span style="color: blue;"> android:src="@drawable/sp1"</span><br />
<span style="color: blue;"> android:layout_below="@+id/textView_pName"</span><br />
<span style="color: blue;"> android:layout_gravity="center_horizontal" /></span><br />
<span style="color: blue;"> <TextView</span><br />
<span style="color: blue;"> android:id="@+id/textView_Name"</span><br />
<span style="color: blue;"> android:layout_width="wrap_content"</span><br />
<span style="color: blue;"> android:layout_height="wrap_content"</span><br />
<span style="color: blue;"> android:textSize="22dp"</span><br />
<span style="color: blue;"> android:text="TextView"</span><br />
<span style="color: blue;"> android:layout_gravity="center_horizontal" /></span><br />
<span style="color: blue;"></LinearLayout></span><br />
<br />
4.<span style="background-color: #a64d79; color: blue;">3.Use this layout class in Main class</span><br />
<span style="color: blue;"><?xml version="1.0" encoding="utf-8"?></span><br />
<span style="color: blue;"><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"</span><br />
<span style="color: blue;"> android:orientation="vertical" android:layout_width="match_parent"</span><br />
<span style="color: blue;"> android:layout_height="match_parent"></span><br />
<span style="color: blue;"> <include</span><br />
<span style="color: blue;"> android:id="@+id/toolbarzoommm"</span><br />
<span style="color: blue;"> layout="@layout/tool_bar"</span><br />
<span style="color: blue;"> /></span><br />
<span style="color: blue;"> <LinearLayout</span><br />
<span style="color: blue;"> android:layout_height="match_parent"</span><br />
<span style="color: blue;"> android:layout_width="match_parent"</span><br />
<span style="color: blue;"> android:orientation="vertical"</span><br />
<span style="color: blue;"> android:layout_marginTop="50dp"</span><br />
<span style="color: blue;"> android:weightSum="1"</span><br />
<span style="color: blue;"> ></span><br />
<span style="color: blue;"> <TextView</span><br />
<span style="color: blue;"> android:id="@+id/textView1"</span><br />
<span style="color: blue;"> android:layout_width="wrap_content"</span><br />
<span style="color: blue;"> android:layout_height="wrap_content"</span><br />
<span style="color: blue;"> android:textSize="25dp"</span><br />
<span style="color: blue;"> android:layout_marginTop="0dp"</span><br />
<span style="color: blue;"> android:layout_gravity="center"</span><br />
<span style="color: blue;"> android:textStyle="bold"</span><br />
<span style="color: blue;"> android:text="Products Item List..."</span><br />
<span style="color: blue;"> android:layout_centerHorizontal="true" /></span><br />
<span style="color: blue;"> <GridView</span><br />
<span style="color: blue;"> android:id="@+id/gridView1"</span><br />
<span style="color: blue;"> android:layout_width="match_parent"</span><br />
<span style="color: blue;"> android:layout_height="match_parent"</span><br />
<span style="color: blue;"> android:layout_alignParentLeft="true"</span><br />
<span style="color: blue;"> android:layout_below="@+id/textView1"</span><br />
<span style="color: blue;"> android:numColumns="2" ></span><br />
<span style="color: blue;"> </GridView></span><br />
<span style="color: blue;"> </LinearLayout></span><br />
<span style="color: blue;"><span style="background-color: #a64d79;"></span></span><br />
<span style="color: blue;"></RelativeLayout></span><br />
<span style="background-color: #d5a6bd; color: blue;">5.Use Internet Permission in Manifest class</span><br />
<span style="color: blue;"> <uses-permission android:name="android.permission.INTERNET" /></span><br />
<span style="color: red;">NB: Store Image in MySQL Database BLOB type/ Formate.</span><br />
<span style="color: blue;"><br /></span>
<span style="color: blue;">Run your Application. Please comment any Query.</span><br />
<span style="color: blue;"><br /></span>
<span style="background-color: #a64d79; color: blue;"><br /></span></div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-48930815720254392942016-04-06T16:09:00.001+06:002016-04-15T00:25:32.198+06:00Android Populate ListView from JSON – Example<div dir="ltr" style="text-align: left;" trbidi="on">
<h4 style="background-color: white; box-sizing: border-box; color: #212121; font-family: Roboto, sans-serif; font-size: 24px; font-weight: 300; line-height: 1.4; margin: 0px 0px 1.5rem; padding-top: 1rem;">
Creating Layout:</h4>
<div style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px; margin-bottom: 1.5em;">
The Main layout for our project is “activity_main” which has a ListView to display the array.</div>
<div style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px; margin-bottom: 1.5em;">
<strong style="box-sizing: border-box;">activity_main.xml</strong></div>
<div style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px;">
<div class="syntaxhighlighter nogutter xml" id="highlighter_337986" style="box-sizing: border-box; font-size: 1em !important; margin: 1em 0px !important; overflow: auto !important; position: relative !important; width: 775.188px;">
<table border="0" cellpadding="0" cellspacing="0" style="background: none !important; border-collapse: collapse; border-radius: 0px !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 758px;"><tbody style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="code" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 758px;"><div class="container" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">RelativeLayout</code> <code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">xmlns:android</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"http://schemas.android.com/apk/res/android"</code></div>
<div class="line number2 index1 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">xmlns:tools</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"http://schemas.android.com/tools"</code></div>
<div class="line number3 index2 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_width</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"match_parent"</code></div>
<div class="line number4 index3 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_height</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"match_parent"</code></div>
<div class="line number5 index4 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:paddingBottom</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"@dimen/activity_vertical_margin"</code></div>
<div class="line number6 index5 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:paddingLeft</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"@dimen/activity_horizontal_margin"</code></div>
<div class="line number7 index6 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:paddingRight</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"@dimen/activity_horizontal_margin"</code></div>
<div class="line number8 index7 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:paddingTop</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"@dimen/activity_vertical_margin"</code></div>
<div class="line number9 index8 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">tools:context</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">".MainActivity"</code> <code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number10 index9 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number11 index10 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ListView</code></div>
<div class="line number12 index11 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:id</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"@+id/list"</code></div>
<div class="line number13 index12 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_width</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"fill_parent"</code></div>
<div class="line number14 index13 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_height</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"wrap_content"</code></div>
<div class="line number15 index14 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_above</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"@+id/getdata"</code> <code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">/></code></div>
<div class="line number16 index15 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number17 index16 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Button</code></div>
<div class="line number18 index17 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:id</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"@+id/getdata"</code></div>
<div class="line number19 index18 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_width</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"wrap_content"</code></div>
<div class="line number20 index19 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_height</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"wrap_content"</code></div>
<div class="line number21 index20 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_alignParentBottom</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"true"</code></div>
<div class="line number22 index21 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_centerHorizontal</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"true"</code></div>
<div class="line number23 index22 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_marginBottom</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"23dp"</code></div>
<div class="line number24 index23 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:text</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"Get Data"</code> <code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">/></code></div>
<div class="line number25 index24 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number26 index25 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"></</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">RelativeLayout</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px; margin-bottom: 1.5em;">
Next step is to create a layout for the list item that is to be displayed in ListView. Create the layout as list_v.xml which has three TextView’s to display the Array in each list item. Here I have created the TextView’s in LinearLayout.</div>
<div style="background-color: white; box-sizing: border-box; margin-bottom: 1.5em;">
<div style="color: #3f4544; font-family: roboto, sans-serif; font-size: 14px; line-height: 24px;">
<strong style="box-sizing: border-box;">list_v.xml</strong></div>
<div style="color: #3f4544; font-family: roboto, sans-serif; font-size: 14px; line-height: 24px;">
<strong style="box-sizing: border-box;"><br /></strong></div>
<span style="color: #3f4544; font-family: roboto, sans-serif;"><span style="font-size: 14px; line-height: 24px;"><b><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script></b></span></span><br />
<span style="color: #3f4544; font-family: roboto, sans-serif;"><span style="font-size: 14px; line-height: 24px;"><b><!-- android help --></b></span></span><br />
<span style="color: #3f4544; font-family: roboto, sans-serif;"><span style="font-size: 14px; line-height: 24px;"><b><ins class="adsbygoogle"</b></span></span><br />
<span style="color: #3f4544; font-family: roboto, sans-serif;"><span style="font-size: 14px; line-height: 24px;"><b> style="display:inline-block;width:728px;height:90px"</b></span></span><br />
<span style="color: #3f4544; font-family: roboto, sans-serif;"><span style="font-size: 14px; line-height: 24px;"><b> data-ad-client="ca-pub-1495591458562636"</b></span></span><br />
<span style="color: #3f4544; font-family: roboto, sans-serif;"><span style="font-size: 14px; line-height: 24px;"><b> data-ad-slot="2543043308"></ins></b></span></span><br />
<span style="color: #3f4544; font-family: roboto, sans-serif;"><span style="font-size: 14px; line-height: 24px;"><b><script></b></span></span><br />
<span style="color: #3f4544; font-family: roboto, sans-serif;"><span style="font-size: 14px; line-height: 24px;"><b>(adsbygoogle = window.adsbygoogle || []).push({});</b></span></span><br />
<span style="color: #3f4544; font-family: roboto, sans-serif;"><b><span style="box-sizing: border-box; font-size: 14px; line-height: 24px;"></span></b></span><br />
<span style="color: #3f4544; font-family: roboto, sans-serif;"><span style="font-size: 14px; line-height: 24px;"><b></script></b></span></span></div>
<div style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px;">
<div class="syntaxhighlighter nogutter xml" id="highlighter_685919" style="box-sizing: border-box; font-size: 1em !important; margin: 1em 0px !important; overflow: auto !important; position: relative !important; width: 775.188px;">
<table border="0" cellpadding="0" cellspacing="0" style="background: none !important; border-collapse: collapse; border-radius: 0px !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 758px;"><tbody style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="code" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 758px;"><div class="container" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><?</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">xml</code> <code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">version</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"1.0"</code> <code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">encoding</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"utf-8"</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?></code></div>
<div class="line number2 index1 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">LinearLayout</code> <code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">xmlns:android</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"http://schemas.android.com/apk/res/android"</code></div>
<div class="line number3 index2 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_width</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"match_parent"</code></div>
<div class="line number4 index3 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_height</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"match_parent"</code></div>
<div class="line number5 index4 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:orientation</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"vertical"</code> <code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number6 index5 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number7 index6 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">TextView</code></div>
<div class="line number8 index7 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:id</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"@+id/vers"</code></div>
<div class="line number9 index8 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_width</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"match_parent"</code></div>
<div class="line number10 index9 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_height</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"wrap_content"</code></div>
<div class="line number11 index10 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">/></code></div>
<div class="line number12 index11 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number13 index12 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">TextView</code></div>
<div class="line number14 index13 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:id</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"@+id/name"</code></div>
<div class="line number15 index14 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_width</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"match_parent"</code></div>
<div class="line number16 index15 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_height</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"wrap_content"</code></div>
<div class="line number17 index16 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">/></code></div>
<div class="line number18 index17 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number19 index18 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">TextView</code></div>
<div class="line number20 index19 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:id</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"@+id/api"</code></div>
<div class="line number21 index20 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_width</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"match_parent"</code></div>
<div class="line number22 index21 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:layout_height</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"wrap_content"</code></div>
<div class="line number23 index22 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">/></code></div>
<div class="line number24 index23 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number25 index24 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"></</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">LinearLayout</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<h4 style="background-color: white; box-sizing: border-box; color: #212121; font-family: Roboto, sans-serif; font-size: 24px; font-weight: 300; line-height: 1.4; margin: 0px 0px 1.5rem; padding-top: 1rem;">
Creating Activity:</h4>
<div style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px; margin-bottom: 1.5em;">
Before creating the MainActivity we need to create a JSON Parser class which gets the JSON data from the URL and returns JSON Object.<br />
In your Project create a new folder library in the src folder such that the package is “learn2crack.listview.library”. Create the JSONParser.java in the library folder.</div>
<div style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px; margin-bottom: 1.5em;">
<strong style="box-sizing: border-box;">JSONParser.java</strong></div>
<div style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px;">
<div class="syntaxhighlighter nogutter java" id="highlighter_120037" style="box-sizing: border-box; font-size: 1em !important; margin: 1em 0px !important; overflow: auto !important; position: relative !important; width: 775.188px;">
<table border="0" cellpadding="0" cellspacing="0" style="background: none !important; border-collapse: collapse; border-radius: 0px !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 758px;"><tbody style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="code" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 758px;"><div class="container" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">package</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">smr.listview.library;</code></div>
<div class="line number2 index1 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number3 index2 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">java.io.BufferedReader;</code></div>
<div class="line number4 index3 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">java.io.IOException;</code></div>
<div class="line number5 index4 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">java.io.InputStream;</code></div>
<div class="line number6 index5 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">java.io.InputStreamReader;</code></div>
<div class="line number7 index6 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">java.io.UnsupportedEncodingException;</code></div>
<div class="line number8 index7 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number9 index8 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">org.apache.http.HttpEntity;</code></div>
<div class="line number10 index9 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">org.apache.http.HttpResponse;</code></div>
<div class="line number11 index10 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">org.apache.http.client.ClientProtocolException;</code></div>
<div class="line number12 index11 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">org.apache.http.client.methods.HttpPost;</code></div>
<div class="line number13 index12 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">org.apache.http.impl.client.DefaultHttpClient;</code></div>
<div class="line number14 index13 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">org.json.JSONException;</code></div>
<div class="line number15 index14 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">org.json.JSONObject;</code></div>
<div class="line number16 index15 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number17 index16 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">android.util.Log;</code></div>
<div class="line number18 index17 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number19 index18 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">public</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">class</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">JSONParser {</code></div>
<div class="line number20 index19 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number21 index20 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">static</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">InputStream is = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">null</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></div>
<div class="line number22 index21 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">static</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">JSONObject jObj = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">null</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></div>
<div class="line number23 index22 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">static</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">String json = </code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">""</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></div>
<div class="line number24 index23 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number25 index24 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// constructor</code></div>
<div class="line number26 index25 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">public</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">JSONParser() {</code></div>
<div class="line number27 index26 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number28 index27 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number29 index28 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number30 index29 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">public</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">JSONObject getJSONFromUrl(String url) {</code></div>
<div class="line number31 index30 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number32 index31 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// Making HTTP request</code></div>
<div class="line number33 index32 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">try</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">{</code></div>
<div class="line number34 index33 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// defaultHttpClient</code></div>
<div class="line number35 index34 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">DefaultHttpClient httpClient = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">DefaultHttpClient();</code></div>
<div class="line number36 index35 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">HttpPost httpPost = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">HttpPost(url);</code></div>
<div class="line number37 index36 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number38 index37 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">HttpResponse httpResponse = httpClient.execute(httpPost);</code></div>
<div class="line number39 index38 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">HttpEntity httpEntity = httpResponse.getEntity();</code></div>
<div class="line number40 index39 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">is = httpEntity.getContent();</code></div>
<div class="line number41 index40 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number42 index41 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">} </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">catch</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">(UnsupportedEncodingException e) {</code></div>
<div class="line number43 index42 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">e.printStackTrace();</code></div>
<div class="line number44 index43 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">} </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">catch</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">(ClientProtocolException e) {</code></div>
<div class="line number45 index44 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">e.printStackTrace();</code></div>
<div class="line number46 index45 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">} </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">catch</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">(IOException e) {</code></div>
<div class="line number47 index46 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">e.printStackTrace();</code></div>
<div class="line number48 index47 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number49 index48 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number50 index49 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">try</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">{</code></div>
<div class="line number51 index50 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">BufferedReader reader = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">BufferedReader(</code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">InputStreamReader(</code></div>
<div class="line number52 index51 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">is, </code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"iso-8859-1"</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">), </code><code class="java value" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 153, 0) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">8</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">);</code></div>
<div class="line number53 index52 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">StringBuilder sb = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">StringBuilder();</code></div>
<div class="line number54 index53 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">String line = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">null</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></div>
<div class="line number55 index54 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">while</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">((line = reader.readLine()) != </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">null</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">) {</code></div>
<div class="line number56 index55 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">sb.append(line + </code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"n"</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">);</code></div>
<div class="line number57 index56 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number58 index57 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">is.close();</code></div>
<div class="line number59 index58 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">json = sb.toString();</code></div>
<div class="line number60 index59 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">} </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">catch</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">(Exception e) {</code></div>
<div class="line number61 index60 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Log.e(</code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"Buffer Error"</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">, </code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"Error converting result "</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">+ e.toString());</code></div>
<div class="line number62 index61 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number63 index62 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number64 index63 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// try parse the string to a JSON object</code></div>
<div class="line number65 index64 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">try</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">{</code></div>
<div class="line number66 index65 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">jObj = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">JSONObject(json);</code></div>
<div class="line number67 index66 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">} </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">catch</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">(JSONException e) {</code></div>
<div class="line number68 index67 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Log.e(</code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"JSON Parser"</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">, </code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"Error parsing data "</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">+ e.toString());</code></div>
<div class="line number69 index68 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number70 index69 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number71 index70 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// return JSON String</code></div>
<div class="line number72 index71 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">return</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">jObj;</code></div>
<div class="line number73 index72 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number74 index73 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number75 index74 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px; margin-bottom: 1.5em;">
Next step is to create MainActivity.The Button “Get Data” is used to trigger the AsyncTask which process the backgroung Data. Here we are defining the array “oslist” which is displayed as text in ListView. The JSONArray is “android” which we got from the URL. It is then stored in a string. We are using ListAdapter is generate ListView. Finally we are using OnItemClickListener to display the OS in Toast when it is clicked.</div>
<div style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px; margin-bottom: 1.5em;">
<strong style="box-sizing: border-box;">MainActivity.java</strong></div>
<div style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px;">
<div class="syntaxhighlighter nogutter java" id="highlighter_147559" style="box-sizing: border-box; font-size: 1em !important; margin: 1em 0px !important; overflow: auto !important; position: relative !important; width: 775.188px;">
<table border="0" cellpadding="0" cellspacing="0" style="background: none !important; border-collapse: collapse; border-radius: 0px !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1108px;"><tbody style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="code" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 1108px;"><div class="container" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">package</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">learn2crack.listview;</code></div>
<div class="line number2 index1 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number3 index2 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">java.util.ArrayList;</code></div>
<div class="line number4 index3 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">java.util.HashMap;</code></div>
<div class="line number5 index4 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number6 index5 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">org.json.JSONArray;</code></div>
<div class="line number7 index6 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">org.json.JSONException;</code></div>
<div class="line number8 index7 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">org.json.JSONObject;</code></div>
<div class="line number9 index8 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number10 index9 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">android.app.Activity;</code></div>
<div class="line number11 index10 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">android.app.ProgressDialog;</code></div>
<div class="line number12 index11 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">android.os.AsyncTask;</code></div>
<div class="line number13 index12 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">android.os.Bundle;</code></div>
<div class="line number14 index13 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">android.view.View;</code></div>
<div class="line number15 index14 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">android.widget.AdapterView;</code></div>
<div class="line number16 index15 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">android.widget.Button;</code></div>
<div class="line number17 index16 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">android.widget.ListAdapter;</code></div>
<div class="line number18 index17 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">android.widget.ListView;</code></div>
<div class="line number19 index18 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">android.widget.SimpleAdapter;</code></div>
<div class="line number20 index19 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">android.widget.TextView;</code></div>
<div class="line number21 index20 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">android.widget.Toast;</code></div>
<div class="line number22 index21 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number23 index22 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">import</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">learn2crack.listview.library.JSONParser;</code></div>
<div class="line number24 index23 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number25 index24 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">public</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">class</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">MainActivity </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">extends</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Activity {</code></div>
<div class="line number26 index25 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ListView list;</code></div>
<div class="line number27 index26 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">TextView ver;</code></div>
<div class="line number28 index27 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">TextView name;</code></div>
<div class="line number29 index28 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">TextView api;</code></div>
<div class="line number30 index29 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Button Btngetdata;</code></div>
<div class="line number31 index30 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ArrayList<HashMap<String, String>> oslist = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ArrayList<HashMap<String, String>>();</code></div>
<div class="line number32 index31 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number33 index32 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">//URL to get JSON Array</code></div>
<div class="line number34 index33 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">private</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">static</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">String url = </code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"http://api.learn2crack.com/android/jsonos/"</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></div>
<div class="line number35 index34 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number36 index35 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">//JSON Node Names</code></div>
<div class="line number37 index36 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">private</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">static</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">final</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">String TAG_OS = </code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"android"</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></div>
<div class="line number38 index37 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">private</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">static</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">final</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">String TAG_VER = </code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"ver"</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></div>
<div class="line number39 index38 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">private</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">static</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">final</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">String TAG_NAME = </code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"name"</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></div>
<div class="line number40 index39 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">private</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">static</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">final</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">String TAG_API = </code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"api"</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></div>
<div class="line number41 index40 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number42 index41 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">JSONArray android = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">null</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></div>
<div class="line number43 index42 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number44 index43 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">@Override</code></div>
<div class="line number45 index44 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">protected</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">void</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">onCreate(Bundle savedInstanceState) {</code></div>
<div class="line number46 index45 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">super</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">.onCreate(savedInstanceState);</code></div>
<div class="line number47 index46 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number48 index47 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">setContentView(R.layout.activity_main);</code></div>
<div class="line number49 index48 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">oslist = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ArrayList<HashMap<String, String>>();</code></div>
<div class="line number50 index49 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number51 index50 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Btngetdata = (Button)findViewById(R.id.getdata);</code></div>
<div class="line number52 index51 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Btngetdata.setOnClickListener(</code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">View.OnClickListener() {</code></div>
<div class="line number53 index52 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number54 index53 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">@Override</code></div>
<div class="line number55 index54 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">public</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">void</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">onClick(View view) {</code></div>
<div class="line number56 index55 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">JSONParse().execute();</code></div>
<div class="line number57 index56 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number58 index57 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number59 index58 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">});</code></div>
<div class="line number60 index59 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number61 index60 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number62 index61 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number63 index62 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">private</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">class</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">JSONParse </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">extends</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">AsyncTask<String, String, JSONObject> {</code></div>
<div class="line number64 index63 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">private</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ProgressDialog pDialog;</code></div>
<div class="line number65 index64 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">@Override</code></div>
<div class="line number66 index65 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">protected</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">void</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">onPreExecute() {</code></div>
<div class="line number67 index66 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">super</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">.onPreExecute();</code></div>
<div class="line number68 index67 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ver = (TextView)findViewById(R.id.vers);</code></div>
<div class="line number69 index68 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">name = (TextView)findViewById(R.id.name);</code></div>
<div class="line number70 index69 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">api = (TextView)findViewById(R.id.api);</code></div>
<div class="line number71 index70 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">pDialog = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ProgressDialog(MainActivity.</code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">this</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">);</code></div>
<div class="line number72 index71 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">pDialog.setMessage(</code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"Getting Data ..."</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">);</code></div>
<div class="line number73 index72 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">pDialog.setIndeterminate(</code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">false</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">);</code></div>
<div class="line number74 index73 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">pDialog.setCancelable(</code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">true</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">);</code></div>
<div class="line number75 index74 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">pDialog.show();</code></div>
<div class="line number76 index75 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number77 index76 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number78 index77 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number79 index78 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">@Override</code></div>
<div class="line number80 index79 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">protected</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">JSONObject doInBackground(String... args) {</code></div>
<div class="line number81 index80 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number82 index81 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">JSONParser jParser = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">JSONParser();</code></div>
<div class="line number83 index82 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number84 index83 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// Getting JSON from URL</code></div>
<div class="line number85 index84 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">JSONObject json = jParser.getJSONFromUrl(url);</code></div>
<div class="line number86 index85 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">return</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">json;</code></div>
<div class="line number87 index86 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number88 index87 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">@Override</code></div>
<div class="line number89 index88 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">protected</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">void</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">onPostExecute(JSONObject json) {</code></div>
<div class="line number90 index89 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">pDialog.dismiss();</code></div>
<div class="line number91 index90 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">try</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">{</code></div>
<div class="line number92 index91 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// Getting JSON Array from URL</code></div>
<div class="line number93 index92 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">android = json.getJSONArray(TAG_OS);</code></div>
<div class="line number94 index93 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">for</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">(</code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">int</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">i = </code><code class="java value" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 153, 0) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">0</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">; i < android.length(); i++){</code></div>
<div class="line number95 index94 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">JSONObject c = android.getJSONObject(i);</code></div>
<div class="line number96 index95 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number97 index96 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// Storing JSON item in a Variable</code></div>
<div class="line number98 index97 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">String ver = c.getString(TAG_VER);</code></div>
<div class="line number99 index98 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">String name = c.getString(TAG_NAME);</code></div>
<div class="line number100 index99 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">String api = c.getString(TAG_API);</code></div>
<div class="line number101 index100 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number102 index101 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// Adding value HashMap key => value</code></div>
<div class="line number103 index102 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number104 index103 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">HashMap<String, String> map = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">HashMap<String, String>();</code></div>
<div class="line number105 index104 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number106 index105 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">map.put(TAG_VER, ver);</code></div>
<div class="line number107 index106 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">map.put(TAG_NAME, name);</code></div>
<div class="line number108 index107 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">map.put(TAG_API, api);</code></div>
<div class="line number109 index108 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number110 index109 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">oslist.add(map);</code></div>
<div class="line number111 index110 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">list=(ListView)findViewById(R.id.list);</code></div>
<div class="line number112 index111 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number113 index112 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ListAdapter adapter = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">SimpleAdapter(MainActivity.</code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">this</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">, oslist,</code></div>
<div class="line number114 index113 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">R.layout.list_v,</code></div>
<div class="line number115 index114 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">String[] { TAG_VER,TAG_NAME, TAG_API }, </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">int</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">[] {</code></div>
<div class="line number116 index115 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">R.id.vers,R.id.name, R.id.api});</code></div>
<div class="line number117 index116 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number118 index117 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">list.setAdapter(adapter);</code></div>
<div class="line number119 index118 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">list.setOnItemClickListener(</code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">AdapterView.OnItemClickListener() {</code></div>
<div class="line number120 index119 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number121 index120 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">@Override</code></div>
<div class="line number122 index121 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">public</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">void</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">onItemClick(AdapterView<?> parent, View view,</code></div>
<div class="line number123 index122 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">int</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">position, </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">long</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">id) {</code></div>
<div class="line number124 index123 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Toast.makeText(MainActivity.</code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">this</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">, </code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"You Clicked at "</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">+oslist.get(+position).get(</code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"name"</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">), Toast.LENGTH_SHORT).show();</code></div>
<div class="line number125 index124 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number126 index125 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number127 index126 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">});</code></div>
<div class="line number128 index127 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number129 index128 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number130 index129 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">} </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">catch</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">(JSONException e) {</code></div>
<div class="line number131 index130 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">e.printStackTrace();</code></div>
<div class="line number132 index131 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number133 index132 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number134 index133 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number135 index134 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number136 index135 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number137 index136 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<h4 style="background-color: white; box-sizing: border-box; color: #212121; font-family: Roboto, sans-serif; font-size: 24px; font-weight: 300; line-height: 1.4; margin: 0px 0px 1.5rem; padding-top: 1rem;">
Creating Manifest:</h4>
<div style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px; margin-bottom: 1.5em;">
Add the permision “android.permission.INTERNET” to the Manifest file as we need to access external Address.No other special Permissions are required for our project.</div>
<div style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px; margin-bottom: 1.5em;">
<strong style="box-sizing: border-box;">AndroidManifest.xml</strong></div>
<div style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px;">
<div class="syntaxhighlighter nogutter xml" id="highlighter_542140" style="box-sizing: border-box; font-size: 1em !important; margin: 1em 0px !important; overflow: auto !important; position: relative !important; width: 775.188px;">
<table border="0" cellpadding="0" cellspacing="0" style="background: none !important; border-collapse: collapse; border-radius: 0px !important; border-spacing: 0px; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 758px;"><tbody style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="code" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 758px;"><div class="container" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><?</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">xml</code> <code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">version</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"1.0"</code> <code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">encoding</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"utf-8"</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">?></code></div>
<div class="line number2 index1 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">manifest</code> <code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">xmlns:android</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"http://schemas.android.com/apk/res/android"</code></div>
<div class="line number3 index2 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">package</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"learn2crack.listview"</code></div>
<div class="line number4 index3 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:versionCode</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"1"</code></div>
<div class="line number5 index4 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:versionName</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"1.0"</code> <code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number6 index5 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number7 index6 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">uses-sdk</code></div>
<div class="line number8 index7 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:minSdkVersion</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"8"</code></div>
<div class="line number9 index8 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:targetSdkVersion</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"19"</code> <code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">/></code></div>
<div class="line number10 index9 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number11 index10 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">application</code></div>
<div class="line number12 index11 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:allowBackup</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"true"</code></div>
<div class="line number13 index12 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:icon</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"@drawable/ic_launcher"</code></div>
<div class="line number14 index13 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:label</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"@string/app_name"</code></div>
<div class="line number15 index14 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:theme</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"@style/AppTheme"</code> <code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number16 index15 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">activity</code></div>
<div class="line number17 index16 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:name</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"learn2crack.listview.MainActivity"</code></div>
<div class="line number18 index17 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:label</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"@string/app_name"</code> <code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number19 index18 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">intent-filter</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number20 index19 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">action</code> <code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:name</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"android.intent.action.MAIN"</code> <code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">/></code></div>
<div class="line number21 index20 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number22 index21 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">category</code> <code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:name</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"android.intent.category.LAUNCHER"</code> <code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">/></code></div>
<div class="line number23 index22 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"></</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">intent-filter</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number24 index23 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"></</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">activity</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number25 index24 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"></</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">application</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
<div class="line number26 index25 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">uses-permission</code> <code class="xml color1" style="background: none; border-radius: 0px; border: 0px; bottom: auto; box-sizing: content-box; color: grey; display: inline-block; float: none; font-family: "consolas" , "bitstream vera sans mono" , "courier new" , "courier" , monospace "important"; font-size: 1em; height: auto; left: auto; line-height: 1.1em; margin: 0px; min-height: auto; outline: 0px; overflow: visible; padding: 0px; position: static; right: auto; top: auto; vertical-align: baseline; width: auto;">android:name</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">=</code><code class="xml string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"android.permission.INTERNET"</code> <code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">/></code></div>
<div class="line number27 index26 alt2" style="background: none rgb(248, 248, 248) !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number28 index27 alt1" style="background-attachment: initial !important; background-clip: initial !important; background-image: none !important; background-origin: initial !important; background-position: initial !important; background-repeat: initial !important; background-size: initial !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"></</code><code class="xml keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">manifest</code><code class="xml plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; display: inline-block; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">></code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px; margin-bottom: 1.5em;">
Finally run the project in the Emulator.</div>
<div class="wp-caption aligncenter" id="attachment_843" style="background-color: white; box-sizing: border-box; color: #3f4544; font-family: Roboto, sans-serif; font-size: 14px; line-height: 0; margin: 0px auto 30px; max-width: 100%; position: relative; width: 177px;">
<a href="https://www.learn2crack.com/wp-content/uploads/2013/11/Screenshot-from-2013-11-02-202518.png" ref="magnificPopup" style="background-color: transparent; box-sizing: border-box; color: #2196f3; outline: 0px; text-decoration: none; transition-duration: 0.3s; transition-property: background-color, box-shadow, border, color, opacity;"><img alt="listview json parsing" class="wp-image-843 size-medium" height="300" sizes="(max-width: 167px) 100vw, 167px" src="https://www.learn2crack.com/wp-content/uploads/2013/11/Screenshot-from-2013-11-02-202518-167x300.png" srcset="https://www.learn2crack.com/wp-content/uploads/2013/11/Screenshot-from-2013-11-02-202518-167x300.png 167w, https://www.learn2crack.com/wp-content/uploads/2013/11/Screenshot-from-2013-11-02-202518.png 335w" style="border: 0px; box-sizing: border-box; height: auto; max-width: 100%;" title="Android Populate ListView from JSON - Example" width="167" /></a><br />
<div class="wp-caption-text" style="box-sizing: border-box; font-size: 0.9em; line-height: 1.6; margin-left: auto; margin-right: auto; padding: 5px 10px; text-align: center;">
Project Running in Emulator</div>
</div>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-22113794979450078352016-03-24T14:14:00.001+06:002016-03-24T14:14:28.920+06:00Capture Image from Camera and Display in Activity<div dir="ltr" style="text-align: left;" trbidi="on">
Use Bellow code for<br />
<h1 itemprop="name" style="background-color: white; border: 0px; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 22px; line-height: 1.3; margin: 0px 0px 0.5em; padding: 0px;">
<a class="question-hyperlink" href="http://stackoverflow.com/questions/5991319/capture-image-from-camera-and-display-in-activity" style="border: 0px; color: #222426; cursor: pointer; font-size: 24px; font-weight: normal; line-height: 1.35; margin: 0px 0px 0.5em; padding: 0px; text-decoration: none;">Capture Image from Camera and Display in Activity</a></h1>
<br />
public void Taken_image(View view) {<br />
<br />
Context context = this;<br />
PackageManager pm = context.getPackageManager();<br />
if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {<br />
<br />
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);<br />
startActivityForResult(cameraIntent, CAMERA_REQUEST);<br />
<br />
} else {<br />
Toast.makeText(getApplicationContext(), "This device doesn't have a Camera", Toast.LENGTH_SHORT).show();<br />
}<br />
}<br />
<br />
protected void onActivityResult(int requestCode, int resultCode, Intent data) {<br />
if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) {<br />
Bitmap photo = (Bitmap) data.getExtras().get("data");<br />
imageView.setImageBitmap(photo);<br />
<br />
ByteArrayOutputStream bytes = new ByteArrayOutputStream();<br />
photo.compress(Bitmap.CompressFormat.JPEG, 100, bytes);<br />
//4<br />
// File file = new File(Environment.getExternalStorageDirectory()+File.separator + "User.jpg");<br />
File root = new File(Environment.getExternalStorageDirectory() + File.separator + "/.PPPP" + File.separator);<br />
root.mkdirs();<br />
File sdImageMainDirectory = new File(root, "myPicName.jpg");<br />
try {<br />
root.createNewFile();<br />
FileOutputStream fo = new FileOutputStream(sdImageMainDirectory);<br />
//5<br />
fo.write(bytes.toByteArray());<br />
fo.close();<br />
} catch (IOException e) {<br />
// TODO Auto-generated catch block<br />
e.printStackTrace();<br />
}<br />
}<br />
}<br />
<br />
<strong style="background: rgb(255, 255, 255); border: 0px; color: #1c1c1c; font-family: Raleway, Arial, sans-serif; font-size: 16px; line-height: 26px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;">Add permission in AndroidManifest.xml</strong><br />
<strong style="background: rgb(255, 255, 255); border: 0px; color: #1c1c1c; font-family: Raleway, Arial, sans-serif; font-size: 16px; line-height: 26px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><br /></strong>
<span style="color: #1c1c1c; font-family: Raleway, Arial, sans-serif;"><span style="line-height: 26px;"><b>uses-feature android:name="android.hardware.camera" /></b></span></span><br />
<span style="color: #1c1c1c; font-family: Raleway, Arial, sans-serif;"><span style="line-height: 26px;"><b> <uses-permission android:name="android.permission.CAMERA"/></b></span></span><br />
<span style="color: #1c1c1c; font-family: Raleway, Arial, sans-serif;"><b><span style="background: rgb(255, 255, 255); border: 0px; line-height: 26px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"></span></b></span><br />
<span style="color: #1c1c1c; font-family: Raleway, Arial, sans-serif;"><span style="line-height: 26px;"><b> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /></b></span></span></div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com1tag:blogger.com,1999:blog-1272312981753410060.post-47155891597703134312016-03-24T14:09:00.001+06:002016-03-24T14:09:45.730+06:00How to pick image from gallery in android ?<div dir="ltr" style="text-align: left;" trbidi="on">
Use this two method<br />
<br />
<div class="line number24 index23 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">public</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">void</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">loadImagefromGallery(View view) {</code></div>
<div class="line number25 index24 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// Create intent to Open Image applications like Gallery, Google Photos</code></div>
<div class="line number26 index25 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Intent galleryIntent = </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Intent(Intent.ACTION_PICK,</code></div>
<div class="line number27 index26 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);</code></div>
<div class="line number28 index27 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// Start the Intent</code></div>
<div class="line number29 index28 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">startActivityForResult(galleryIntent, RESULT_LOAD_IMG);</code></div>
<div class="line number30 index29 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number31 index30 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number32 index31 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java color1" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: gray !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">@Override</code></div>
<div class="line number33 index32 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">protected</code> <code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">void</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">onActivityResult(</code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">int</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">requestCode, </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">int</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">resultCode, Intent data) {</code></div>
<div class="line number34 index33 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">super</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">.onActivityResult(requestCode, resultCode, data);</code></div>
<div class="line number35 index34 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">try</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">{</code></div>
<div class="line number36 index35 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// When an Image is picked</code></div>
<div class="line number37 index36 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">if</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">(requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK</code></div>
<div class="line number38 index37 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">&& </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">null</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">!= data) {</code></div>
<div class="line number39 index38 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// Get the Image from data</code></div>
<div class="line number40 index39 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number41 index40 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Uri selectedImage = data.getData();</code></div>
<div class="line number42 index41 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">String[] filePathColumn = { MediaStore.Images.Media.DATA };</code></div>
<div class="line number43 index42 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number44 index43 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// Get the cursor</code></div>
<div class="line number45 index44 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Cursor cursor = getContentResolver().query(selectedImage,</code></div>
<div class="line number46 index45 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">filePathColumn, </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">null</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">, </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">null</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">, </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">null</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">);</code></div>
<div class="line number47 index46 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// Move to first row</code></div>
<div class="line number48 index47 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">cursor.moveToFirst();</code></div>
<div class="line number49 index48 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number50 index49 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">int</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">columnIndex = cursor.getColumnIndex(filePathColumn[</code><code class="java value" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 153, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">0</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">]);</code></div>
<div class="line number51 index50 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">imgDecodableString = cursor.getString(columnIndex);</code></div>
<div class="line number52 index51 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">cursor.close();</code></div>
<div class="line number53 index52 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">ImageView imgView = (ImageView) findViewById(R.id.imgView);</code></div>
<div class="line number54 index53 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java comments" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// Set the Image in ImageView after decoding the String</code></div>
<div class="line number55 index54 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">imgView.setImageBitmap(BitmapFactory</code></div>
<div class="line number56 index55 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">.decodeFile(imgDecodableString));</code></div>
<div class="line number57 index56 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number58 index57 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">} </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">else</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">{</code></div>
<div class="line number59 index58 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Toast.makeText(</code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">this</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">, </code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"You haven't picked Image"</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">,</code></div>
<div class="line number60 index59 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Toast.LENGTH_LONG).show();</code></div>
<div class="line number61 index60 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number62 index61 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">} </code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">catch</code> <code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">(Exception e) {</code></div>
<div class="line number63 index62 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">Toast.makeText(</code><code class="java keyword" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">this</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">, </code><code class="java string" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"Something went wrong"</code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">, Toast.LENGTH_LONG)</code></div>
<div class="line number64 index63 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">.show();</code></div>
<div class="line number65 index64 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number66 index65 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number67 index66 alt2" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="java spaces" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="java plain" style="background: none !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></div>
<div class="line number68 index67 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number68 index67 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<strong style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; color: #1c1c1c; font-family: Raleway, Arial, sans-serif; line-height: 26px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; white-space: normal;">Add permission in AndroidManifest.xml</strong></div>
<div class="line number68 index67 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.6px; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<br /></div>
<div class="line number68 index67 alt1" style="background: none white !important; border-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; min-height: auto !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<span style="color: #333333; font-family: Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;"><span style="line-height: 17.6px; white-space: pre;"><uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /></span></span></div>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-63824666776780119932016-03-24T14:07:00.001+06:002016-03-24T14:07:14.615+06:00how to Allow user to select camera or gallery for image in android<div dir="ltr" style="text-align: left;" trbidi="on">
Use this it fine work to me<br />
<br />
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">private</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">void</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> openImageIntent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(){</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// Determine Uri of camera image to save.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">final</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">File</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> root </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">new</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">File</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Environment</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getExternalStorageDirectory</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">()</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">+</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">File</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">separator </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">+</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="str" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">"amfb"</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">+</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">File</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">separator</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
root</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">mkdir</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">final</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">String</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> fname </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="str" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">"img_"</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">+</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">System</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">currentTimeMillis</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">()</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">+</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="str" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">".jpg"</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">;</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">final</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">File</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> sdImageMainDirectory </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">new</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">File</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">root</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> fname</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
outputFileUri </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Uri</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">fromFile</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">sdImageMainDirectory</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// Camera.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">final</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">List</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;"><</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">></span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> cameraIntents </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">new</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ArrayList</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;"><</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">>();</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">final</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> captureIntent </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">new</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">MediaStore</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">ACTION_IMAGE_CAPTURE</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">final</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">PackageManager</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> packageManager </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> getPackageManager</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">final</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">List</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;"><</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ResolveInfo</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">></span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> listCam </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> packageManager</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">queryIntentActivities</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">captureIntent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="lit" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">0</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">for</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ResolveInfo</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> res </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">:</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> listCam</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">){</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">final</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">String</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> packageName </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> res</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">activityInfo</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">packageName</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">;</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">final</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> intent </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">new</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">captureIntent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">setComponent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">new</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ComponentName</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">res</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">activityInfo</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">packageName</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> res</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">activityInfo</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">name</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">));</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">setPackage</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">packageName</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">putExtra</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">MediaStore</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">EXTRA_OUTPUT</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> outputFileUri</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
cameraIntents</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">add</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">//FileSystem</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">final</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> galleryIntent </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">new</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
galleryIntent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">setType</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="str" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">"image/"</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
galleryIntent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">setAction</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">ACTION_GET_CONTENT</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// Chooser of filesystem options.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">final</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> chooserIntent </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">createChooser</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">galleryIntent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="str" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">"Select Source"</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// Add the camera options.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
chooserIntent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">putExtra</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">EXTRA_INITIAL_INTENTS</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> cameraIntents</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">toArray</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">new</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Parcelable</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">[]{}));</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
startActivityForResult</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">chooserIntent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> CAMERA_CAPTURE_IMAGE_REQUEST_CODE</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="lit" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">@Override</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">protected</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">void</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> onActivityResult</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">int</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> requestCode</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">int</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> resultCode</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> data</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">//super.onActivityResult(requestCode, resultCode, data);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">if</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">resultCode </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">==</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> RESULT_OK</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">if</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">requestCode </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">==</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> CAMERA_CAPTURE_IMAGE_REQUEST_CODE</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">final</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">boolean</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> isCamera</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">;</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">if</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">data </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">==</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">null</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
isCamera </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">true</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">;</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">else</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">final</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">String</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> action </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> data</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getAction</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">if</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">action </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">==</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">null</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
isCamera </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">false</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">;</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">else</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
isCamera </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> action</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">equals</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">MediaStore</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">ACTION_IMAGE_CAPTURE</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Uri</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> selectedImageUri</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">;</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">if</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">isCamera</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
selectedImageUri </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> outputFileUri</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">;</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">//Bitmap factory</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">BitmapFactory</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Options</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> options </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">new</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">BitmapFactory</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Options</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// downsizing image as it throws OutOfMemory Exception for larger</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// images</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
options</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">inSampleSize </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="lit" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">8</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">;</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">final</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Bitmap</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> bitmap </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">BitmapFactory</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">decodeFile</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">selectedImageUri</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getPath</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(),</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> options</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
preview</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">setImageBitmap</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">bitmap</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">else</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
selectedImageUri </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> data </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">==</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">null</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">?</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">null</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">:</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> data</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getData</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Log</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">d</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="str" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">"ImageURI"</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> selectedImageUri</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getLastPathSegment</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">());</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// /Bitmap factory</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">BitmapFactory</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Options</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> options </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">new</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">BitmapFactory</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Options</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// downsizing image as it throws OutOfMemory Exception for larger</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// images</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
options</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">inSampleSize </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="lit" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">8</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">;</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">try</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">//Using Input Stream to get uri did the trick</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">InputStream</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> input </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> getContentResolver</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">().</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">openInputStream</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">selectedImageUri</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">final</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Bitmap</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> bitmap </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">BitmapFactory</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">decodeStream</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">input</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
preview</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">setImageBitmap</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">bitmap</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">catch</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">FileNotFoundException</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> e</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
e</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">printStackTrace</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">else</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">if</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">resultCode </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">==</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> RESULT_CANCELED</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">){</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// user cancelled Image capture</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Toast</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">makeText</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getApplicationContext</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(),</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="str" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">"User cancelled image capture"</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Toast</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">LENGTH_SHORT</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">show</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">else</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// failed to capture image</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Toast</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">makeText</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getApplicationContext</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(),</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="str" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">"Sorry! Failed to capture image"</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Toast</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">LENGTH_SHORT</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">show</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span></code></pre>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-69978267286369016132016-03-17T22:28:00.001+06:002016-03-17T22:28:08.920+06:00How to set navigation drawer header image and name programmatically in android<div dir="ltr" style="text-align: left;" trbidi="on">
First invoke navigation drawer in your main class then use this code for header image or user name<br />
<br />
<div style="background-color: white; border: 0px; clear: both; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
don't add header in xml add using code by inflating layout</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">View</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> hView </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> navigationView</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">inflateHeaderView</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">R</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">layout</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">nav_header_main</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ImageView</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> imgvw </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ImageView</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">hView</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">findViewById</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">R</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">id</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">imageView</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">TextView</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> tv </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">TextView</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">hView</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">findViewById</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">R</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">id</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">textview</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
imgvw </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">setImageResource</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
tv</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">settext</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="str" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">"new text"</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span></code></pre>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">Hint of work</span></code></pre>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;"><pre style="background-color: white; font-family: 'Courier New'; font-size: 9pt;"><span style="color: olive;">@Override</span><span style="color: navy; font-weight: bold;">protected void </span>onCreate(Bundle savedInstanceState) {
<span style="color: navy; font-weight: bold;">super</span>.onCreate(savedInstanceState);
setContentView(R.layout.<span style="color: #660e7a; font-style: italic; font-weight: bold;">service_main</span>);
<span style="color: grey; font-style: italic;">// Initializing Toolbar and setting it as the actionbar</span><span style="color: grey; font-style: italic;"> </span><span style="color: #660e7a; font-weight: bold;">toolbar </span>= (Toolbar) findViewById(R.id.<span style="color: #660e7a; font-style: italic; font-weight: bold;">toolbar</span>);
setSupportActionBar(<span style="color: #660e7a; font-weight: bold;">toolbar</span>);
<span style="color: #660e7a; font-weight: bold;">navigationView </span>= (NavigationView) findViewById(R.id.<span style="color: #660e7a; font-style: italic; font-weight: bold;">navigation_view</span>);
View hView = <span style="color: #660e7a; font-weight: bold;">navigationView</span>.inflateHeaderView(R.layout.<span style="color: #660e7a; font-style: italic; font-weight: bold;">abc</span>);
ImageView imgvw = (ImageView)hView.findViewById(R.id.<span style="color: #660e7a; font-style: italic; font-weight: bold;">profile_image</span>);
TextView tv = (TextView)hView.findViewById(R.id.<span style="color: #660e7a; font-style: italic; font-weight: bold;">username</span>);
imgvw .setImageResource(R.drawable.<span style="color: #660e7a; font-style: italic; font-weight: bold;">logo</span>);
tv.setText(<span style="color: green; font-weight: bold;">"UserName"</span>);</pre>
</span></code></pre>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com5tag:blogger.com,1999:blog-1272312981753410060.post-68719305843518865722016-01-19T13:59:00.003+06:002016-01-19T13:59:58.041+06:00Open application if it is exist, or open Play Store application for install it in android<div dir="ltr" style="text-align: left;" trbidi="on">
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">private</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">void</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> open</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">()</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
openApplication</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getActivity</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(),</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="str" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">"com.app.package.here"</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">public</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">void</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> openApplication</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Context</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> context</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">String</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> packageN</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> i </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> context</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getPackageManager</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">().</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getLaunchIntentForPackage</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">packageN</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">if</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">i </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">==</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">null</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
i</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">addCategory</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">CATEGORY_LAUNCHER</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
context</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">startActivity</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">i</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">else</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">try</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
context</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">startActivity</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">new</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">ACTION_VIEW</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Uri</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">parse</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="str" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">"market://details?id="</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">+</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> packageN</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)));</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">catch</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">android</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">content</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ActivityNotFoundException</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> anfe</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
context</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">startActivity</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">new</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">ACTION_VIEW</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Uri</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">parse</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="str" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">"http://play.google.com/store/apps/details?id="</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">+</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> packageN</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)));</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span></code></pre>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-7754730486612859232016-01-19T10:26:00.002+06:002016-01-19T10:27:40.342+06:00Difference START_STICKY and START_NOT_STICKY in android<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; clear: both; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
Difference:</div>
<div style="background-color: white; border: 0px; clear: both; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
<a href="http://developer.android.com/reference/android/app/Service.html#START_STICKY" rel="nofollow" style="border: 0px; color: #005999; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;"><code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; margin: 0px; padding: 1px 5px; white-space: pre-wrap;">START_STICKY</code></a></div>
<div style="background-color: white; border: 0px; clear: both; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
the system will try to re-create your service after it is killed</div>
<div style="background-color: white; border: 0px; clear: both; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
<a href="http://developer.android.com/reference/android/app/Service.html#START_NOT_STICKY" rel="nofollow" style="border: 0px; color: #005999; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;"><code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; margin: 0px; padding: 1px 5px; white-space: pre-wrap;">START_NOT_STICKY</code></a></div>
<div style="background-color: white; border: 0px; clear: both; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
the system will <strong style="border: 0px; margin: 0px; padding: 0px;">not</strong> try to re-create your service after it is killed</div>
<hr style="background-color: #dddddd; border: 0px; color: #dddddd; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; height: 1px; line-height: 19.5px; margin-bottom: 20px;" />
<div style="background-color: white; border: 0px; clear: both; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
Standard example:</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="lit" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">@Override</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">public</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">int</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> onStartCommand</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">int</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> flags</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">int</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> startId</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">return</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> START_STICKY</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">;</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span></code></pre>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-69700512752537218302016-01-12T16:58:00.000+06:002016-01-12T17:00:03.648+06:00How to get the SHA1 fingerprint certificate in android studio for debug mode?<div dir="ltr" style="text-align: left;" trbidi="on">
First open cmd then get bin location like bellow<br />
<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;">C:\Program Files\Java\jdk1.8.0\bin></span><br />
<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;"><br /></span>
<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;">then type </span><br />
<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;"><br /></span>
<wbr style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;"></wbr><span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;">keytool -list -v -keystore C:\Users\</span><span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;">yourPC_</span><span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;">username\.android\debug.</span><wbr style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;"></wbr><span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;">keystore -alias androiddebugkey -storepass android -keypass android</span><br />
<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;"><br /></span>
<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;">example = </span><span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;">keytool -list -v -keystore C:\Users\A\.android\debug.</span><wbr style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: small;"></wbr><span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;">keystore -alias androiddebugkey -storepass android -keypass android</span><br />
<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;"><br /></span>
<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;">press enter </span><br />
<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;"><br /></span>
<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small;">get your result.</span></div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-5398684311220865192015-12-29T13:02:00.003+06:002015-12-29T13:04:36.262+06:00Continue Service even if application is cleared from Recent app<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; clear: both; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
Here is a workaround I came across and works well for re-starting a service if its process is killed on closing the application. In your service, add the following code.</div>
<div style="background-color: white; border: 0px; clear: both; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
I came across this workaround in this thread.<br />
<br />
It is Great Work in Android version >=4.4.2, in my case 4.4.2 fine work.</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="lit" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">@Override</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">public</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">void</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> onTaskRemoved</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> rootIntent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">){</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> restartServiceIntent </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">new</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Intent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getApplicationContext</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(),</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">this</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getClass</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">());</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
restartServiceIntent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">setPackage</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getPackageName</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">());</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">PendingIntent</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> restartServicePendingIntent </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">PendingIntent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getService</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getApplicationContext</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(),</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="lit" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">1</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> restartServiceIntent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">PendingIntent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">FLAG_ONE_SHOT</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">AlarmManager</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> alarmService </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">AlarmManager</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> getApplicationContext</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">().</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getSystemService</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Context</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">ALARM_SERVICE</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
alarmService</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">set</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">AlarmManager</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">ELAPSED_REALTIME</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">SystemClock</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">elapsedRealtime</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">()</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">+</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="lit" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">1000</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
restartServicePendingIntent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">super</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">onTaskRemoved</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">rootIntent</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span></code></pre>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-8648083194513312282015-12-28T10:18:00.001+06:002015-12-28T10:18:18.838+06:00How to display Toast in Android?<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; clear: both; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
In order to "display Toast" in your application, try this:</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Toast</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">makeText</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getActivity</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(),</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">String</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">data</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">result</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Toast</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">LENGTH_LONG</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">).</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">show</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">();</span></code></pre>
<div style="background-color: white; border: 0px; clear: both; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
other example...</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Toast</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">makeText</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">getActivity</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(),</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="str" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">"this is my Toast message!!! =)"</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Toast</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">LENGTH_LONG</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">).</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">show</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">();</span></code></pre>
<div style="background-color: white; border: 0px; clear: both; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
We can define two constats for duration:</div>
<blockquote style="background-color: cornsilk; border-left-color: rgb(255, 235, 142); border-left-style: solid; border-width: 0px 0px 0px 2px; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin: 0px 0px 10px; padding: 10px; quotes: none;">
<div style="border: 0px; clear: both; margin-bottom: 1em; padding: 0px;">
int <strong style="border: 0px; margin: 0px; padding: 0px;">LENGTH_LONG</strong> Show the view or text notification for a long period of time.</div>
<div style="border: 0px; clear: both; padding: 0px;">
int <strong style="border: 0px; margin: 0px; padding: 0px;">LENGTH_SHORT</strong> Show the view or text notification for a short period of time.</div>
</blockquote>
<div style="background-color: white; border: 0px; clear: both; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
Read more about "<a href="http://developer.android.com/guide/topics/ui/notifiers/toasts.html" style="border: 0px; color: #005999; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none;">Toasts</a>"</div>
<div style="background-color: white; border: 0px; clear: both; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
other option, customizing your toast:</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">LayoutInflater</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> myInflater</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">LayoutInflater</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">from</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">this</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">View</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> view</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">myInflater</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">inflate</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">R</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">layout</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">your_custom_layout</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">null</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Toast</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> mytoast</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">new</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Toast</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">this</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
mytoast</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">setView</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">view</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
mytoast</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">setDuration</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Toast</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">LENGTH_LONG</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
mytoast</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">show</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">();</span></code></pre>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-30933458550470382572015-12-19T14:23:00.001+06:002015-12-19T14:23:02.839+06:00How to add new contacts in android<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; border: 0px; clear: both; color: #222426; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px; margin-bottom: 1em; padding: 0px;">
This is working fine for me:</div>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;"><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ArrayList</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;"><</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ContentProviderOperation</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">></span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> ops </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">new</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ArrayList</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;"><</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ContentProviderOperation</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">>();</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">int</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> rawContactInsertIndex </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> ops</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">size</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">();</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
ops</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">add</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ContentProviderOperation</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">newInsert</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">RawContacts</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">CONTENT_URI</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">withValue</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">RawContacts</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">ACCOUNT_TYPE</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">null</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">withValue</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">RawContacts</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">ACCOUNT_NAME</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">null</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">).</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">build</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">());</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
ops</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">add</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ContentProviderOperation</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">newInsert</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Data</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">CONTENT_URI</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">withValueBackReference</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Data</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">RAW_CONTACT_ID</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">rawContactInsertIndex</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">withValue</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Data</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">MIMETYPE</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">StructuredName</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">CONTENT_ITEM_TYPE</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">withValue</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">StructuredName</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">DISPLAY_NAME</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="str" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">"Vikas Patidar"</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// Name of the person</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">build</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">());</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
ops</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">add</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ContentProviderOperation</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">newInsert</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Data</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">CONTENT_URI</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">withValueBackReference</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ContactsContract</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Data</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">RAW_CONTACT_ID</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> rawContactInsertIndex</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">withValue</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Data</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">MIMETYPE</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Phone</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">CONTENT_ITEM_TYPE</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">withValue</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Phone</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">NUMBER</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="str" style="border: 0px; color: maroon; margin: 0px; padding: 0px;">"9999999999"</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// Number of the person</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">withValue</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Phone</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">TYPE</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">Phone</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">TYPE_MOBILE</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">).</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">build</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">());</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// Type of mobile number </span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">try</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ContentProviderResult</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">[]</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> res </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">=</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> getContentResolver</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">().</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">applyBatch</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">ContactsContract</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">.</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">AUTHORITY</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">,</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> ops</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">);</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">catch</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">RemoteException</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> e</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// error</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="kwd" style="border: 0px; color: darkblue; margin: 0px; padding: 0px;">catch</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">(</span><span class="typ" style="border: 0px; color: #2b91af; margin: 0px; padding: 0px;">OperationApplicationException</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> e</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">)</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">{</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="com" style="border: 0px; color: grey; margin: 0px; padding: 0px;">// error</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;">
</span><span class="pun" style="border: 0px; color: black; margin: 0px; padding: 0px;">}</span><span class="pln" style="border: 0px; color: black; margin: 0px; padding: 0px;"> </span></code></pre>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0tag:blogger.com,1999:blog-1272312981753410060.post-54098108525227660322015-12-08T10:03:00.000+06:002015-12-08T10:03:33.953+06:00Android Chat with Google GCM XMPP<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
is Android tutorial is to walk you through create an Android chat application using Google Cloud Messaging (GCM) using its Google Cloud Connection Server (CSS) via XMPP. Using Google CCS we can send upstream messages from an Android device to another and we will be using that feature primarily to do this chat application.</div>
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
If you are new to Google Cloud Messaging (GCM), then you need to check a previous introductory tutorial “<a href="http://javapapers.com/android/google-cloud-messaging-gcm-for-android-and-push-notifications/" style="color: #0000ee; text-decoration: none;" title="Google Cloud Messaging GCM for Android and Push Notifications"><strong>Google Cloud Messaging GCM for Android and Push Notifications</strong></a>”. This tutorial will help to understand the basics, setup the prerequisite and start this wonderful GCM journey.</div>
<h2 style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; font-family: Georgia, Times, serif; font-weight: normal;">
Making of GCM Chat Application</h2>
<ul style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
<li>A cool Splash screen (just for fun)</li>
<li>A Simple Android List View (available chat users list screen)</li>
<li>A List View wit Row Layout (chat conversation display)</li>
<li>Chat Bubble</li>
<li>GCM upstream communication with XMPP</li>
</ul>
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
When we put together all the above, we get a nice Android chat application. I have already written detailed tutorials on all the above topics. In this tutorial, we will see how to wire them together as a nice little chat application.</div>
<h2 style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; font-family: Georgia, Times, serif; font-weight: normal;">
Android Splash Screen</h2>
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
<img alt="Google-GCM-Chat-Splash-Screen" border="0" src="http://javapapers.com/wp-content/uploads/2014/06/Google-GCM-Chat-Splash-Screen.jpg" height="562" style="background-image: none; border: 0px; display: inline; height: auto; max-width: 100%; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: middle;" title="Google-GCM-Chat-Splash-Screen" width="320" /></div>
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
Above shown screen shot is the splash screen of the chat app we are going to develop. If you want to know how to create this splash screen refer the tutorial<a href="http://javapapers.com/android/android-splash-screen/" style="color: #0000ee; text-decoration: none;" title="Android splash screen">Android splash screen</a>.</div>
<h2 style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; font-family: Georgia, Times, serif; font-weight: normal;">
Simple Android ListView</h2>
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
To list the logged in and available users to chat, we can use a simple list view using a layout already available as part of sdk. Recently I wrote a <a href="http://javapapers.com/android/android-listview-tutorial/" style="color: #0000ee; text-decoration: none;" title="Android ListView Tutorial">tutorial for Android ListView</a> and it is a basic introductory tutorial.</div>
<h2 style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; font-family: Georgia, Times, serif; font-weight: normal;">
Chat Conversation with ListView and Custom Layout</h2>
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
Chat activity is the interesting page. Most of the chat applications follow the same design. Conversations alternately displayed opposite to each other on a bubble background. Have a look at the <a href="http://javapapers.com/android/android-listview-custom-layout-tutorial/" style="color: #0000ee; text-decoration: none;" title="Android ListView Custom Layout Tutorial">Android ListView Custom Layout Tutorial</a> and it will help create the layout and date model using the custom adapter.</div>
<h2 style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; font-family: Georgia, Times, serif; font-weight: normal;">
Android Chat Bubble</h2>
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
We need to display the conversation on a bubble background. The bubble background image should scale according to the foreground text. We should design a ninepatch image and use it as a background for the view. Refer the<a href="http://javapapers.com/android/android-chat-bubble/" style="color: #0000ee; text-decoration: none;" title="Android Chat Bubble">Android Chat Bubble</a> tutorial which gives detailed explanation on this.</div>
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
<img alt="Google-GCM-Chat" border="0" src="http://javapapers.com/wp-content/uploads/2014/06/Google-GCM-Chat.jpg" height="471" style="background-image: none; border: 0px; display: inline; height: auto; max-width: 100%; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: middle;" title="Google-GCM-Chat" width="520" /></div>
<div class="ad-size" style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; height: 280px; line-height: 21.5999984741211px; width: 336px;">
<ins class="adsbygoogle" data-ad-client="ca-pub-2525233393528874" data-ad-format="rectangle" data-ad-slot="3498801173" data-adsbygoogle-status="done" style="display: block; height: 0px;"><ins id="aswift_1_expand" style="border: none; display: inline-table; height: 0px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 336px;"><ins id="aswift_1_anchor" style="-webkit-transition: opacity 1s cubic-bezier(0.4, 0, 1, 1), width 0.2s cubic-bezier(0.4, 0, 1, 1) 0.3s, height 0.5s cubic-bezier(0.4, 0, 1, 1); border: none; display: block; height: 0px; margin: 0px; opacity: 0; overflow: hidden; padding: 0px; position: relative; transition: opacity 1s cubic-bezier(0.4, 0, 1, 1), width 0.2s cubic-bezier(0.4, 0, 1, 1) 0.3s, height 0.5s cubic-bezier(0.4, 0, 1, 1); visibility: visible; width: 336px;"><iframe allowfullscreen="true" allowtransparency="true" frameborder="0" height="280" hspace="0" id="aswift_1" marginheight="0" marginwidth="0" name="aswift_1" scrolling="no" style="left: 0px; position: absolute; top: 0px;" vspace="0" width="336"></iframe></ins></ins></ins></div>
<h2 style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; font-family: Georgia, Times, serif; font-weight: normal;">
GCM upstream communication with CCS via XMPP</h2>
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
As part of the Google Cloud Messaging service, we have support for XMPP. Using this we can have persistent asynchronous and bidirectional communication. Google CCS server relays the messages between our XMPP server and Android device back and forth. In this tutorial example application, I have not completely leveraged the XMPP features. This is just a starting point and should build on top of this. Refer the previous <a href="http://javapapers.com/android/google-cloud-messaging-gcm-ccs-with-xmpp/" style="color: #0000ee; text-decoration: none;" title="tutorial on Google Cloud Messaging GCM-CCS with XMPP">tutorial on Google Cloud Messaging GCM-CCS with XMPP</a> to understand the fundamentals, communication flow and sequence of events.</div>
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
<img alt="GCM-Chat-Login-Activity" border="0" src="http://javapapers.com/wp-content/uploads/2014/06/GCM-Chat-Login-Activity.jpg" height="560" style="background-image: none; border: 0px; display: inline; height: auto; max-width: 100%; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: middle;" title="GCM-Chat-Login-Activity" width="320" /></div>
<h2 style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; font-family: Georgia, Times, serif; font-weight: normal;">
XMPP Chat Server Application</h2>
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
We need to have a XMPP chat server application as our backend. We will use the Java SmackClient API as XMMP wrapper framework. Our server application is a command line based Java program, this is heavily borrowed from the Google example and customized to suit our need.</div>
<pre class="prettyprint lang-java prettyprinted" style="border: 1px dashed rgb(204, 204, 204); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14.3999996185303px; height: auto; line-height: 18.7199993133545px; margin-bottom: 18px; max-height: 600px; max-width: 100%; overflow: auto; padding: 5px; tab-size: 4;"><span class="com" style="color: #78b937;">/*
* Most part of this class is copyright Google.
* It is from https://developer.android.com/google/gcm/ccs.html
*/</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">jivesoftware</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smack</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ConnectionConfiguration</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">jivesoftware</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smack</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ConnectionConfiguration</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">SecurityMode</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">jivesoftware</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smack</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ConnectionListener</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">jivesoftware</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smack</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">PacketInterceptor</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">jivesoftware</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smack</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">PacketListener</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">jivesoftware</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smack</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">XMPPConnection</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">jivesoftware</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smack</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">XMPPException</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">jivesoftware</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smack</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">filter</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">PacketTypeFilter</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">jivesoftware</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smack</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">packet</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">DefaultPacketExtension</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">jivesoftware</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smack</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">packet</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Message</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">jivesoftware</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smack</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">packet</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Packet</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">jivesoftware</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smack</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">packet</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">PacketExtension</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">jivesoftware</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smack</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">provider</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">PacketExtensionProvider</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">jivesoftware</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smack</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">provider</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ProviderManager</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">jivesoftware</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">smack</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">StringUtils</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">json</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">simple</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">JSONValue</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">json</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">simple</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">parser</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ParseException</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> org</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">xmlpull</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">v1</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">XmlPullParser</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Random</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">logging</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Level</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">logging</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Logger</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">io</span><span class="pun" style="color: #4d4d4c;">.*;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> javax</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">net</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">ssl</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">SSLSocketFactory</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/**
* Sample Smack implementation of a client for GCM Cloud Connection Server.
*
* For illustration purposes only.
*/</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">class</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">SmackCcsClient</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> REG_ID_STORE </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"gcmchat.txt"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> MESSAGE_KEY </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"SM"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Logger</span><span class="pln" style="color: #4d4d4c;"> logger </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Logger</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getLogger</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"SmackCcsClient"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> GCM_SERVER </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"gcm.googleapis.com"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> GCM_PORT </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">5235</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> GCM_ELEMENT_NAME </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"gcm"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> GCM_NAMESPACE </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"google:mobile:data"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Random</span><span class="pln" style="color: #4d4d4c;"> random </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Random</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">XMPPConnection</span><span class="pln" style="color: #4d4d4c;"> connection</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">ConnectionConfiguration</span><span class="pln" style="color: #4d4d4c;"> config</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/**
* XMPP Packet Extension for GCM Cloud Connection Server.
*/</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">class</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">GcmPacketExtension</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">extends</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">DefaultPacketExtension</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> json</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">GcmPacketExtension</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> json</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">super</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">GCM_ELEMENT_NAME</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> GCM_NAMESPACE</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">this</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">json </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> json</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> getJson</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> json</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> toXML</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">format</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"<%s xmlns=\"%s\">%s</%s>"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> GCM_ELEMENT_NAME</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
GCM_NAMESPACE</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> json</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> GCM_ELEMENT_NAME</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@SuppressWarnings</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"unused"</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Packet</span><span class="pln" style="color: #4d4d4c;"> toPacket</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Message</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// Must override toXML() because it includes a <body></span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> toXML</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">StringBuilder</span><span class="pln" style="color: #4d4d4c;"> buf </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">StringBuilder</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
buf</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"<message"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">getXmlns</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
buf</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">" xmlns=\""</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">getXmlns</span><span class="pun" style="color: #4d4d4c;">()).</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"\""</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">getLanguage</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
buf</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">" xml:lang=\""</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">getLanguage</span><span class="pun" style="color: #4d4d4c;">())</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"\""</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">getPacketID</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
buf</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">" id=\""</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">getPacketID</span><span class="pun" style="color: #4d4d4c;">()).</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"\""</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">getTo</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
buf</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">" to=\""</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">StringUtils</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">escapeForXML</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">getTo</span><span class="pun" style="color: #4d4d4c;">()))</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"\""</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">getFrom</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
buf</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">" from=\""</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">StringUtils</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">escapeForXML</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">getFrom</span><span class="pun" style="color: #4d4d4c;">()))</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"\""</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
buf</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">">"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
buf</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">GcmPacketExtension</span><span class="pun" style="color: #4d4d4c;">.</span><span class="kwd" style="color: #8959a8;">this</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toXML</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
buf</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">append</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"</message>"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> buf</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">};</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">SmackCcsClient</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// Add GcmPacketExtension</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">ProviderManager</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getInstance</span><span class="pun" style="color: #4d4d4c;">().</span><span class="pln" style="color: #4d4d4c;">addExtensionProvider</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">GCM_ELEMENT_NAME</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
GCM_NAMESPACE</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">PacketExtensionProvider</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">PacketExtension</span><span class="pln" style="color: #4d4d4c;"> parseExtension</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">XmlPullParser</span><span class="pln" style="color: #4d4d4c;"> parser</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">throws</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Exception</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> json </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> parser</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">nextText</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">GcmPacketExtension</span><span class="pln" style="color: #4d4d4c;"> packet </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">GcmPacketExtension</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">json</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> packet</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">});</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/**
* Returns a random message id to uniquely identify a message.
*
* <p>
* Note: This is generated by a pseudo random number generator for
* illustration purpose, and is not guaranteed to be unique.
*
*/</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> getRandomMessageId</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"m-"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Long</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">random</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">nextLong</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/**
* Sends a downstream GCM message.
*/</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> send</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> jsonRequest</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Packet</span><span class="pln" style="color: #4d4d4c;"> request </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">GcmPacketExtension</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">jsonRequest</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">toPacket</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
connection</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">sendPacket</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">request</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/**
* Handles an upstream data message from a device application.
*
* <p>
* This sample echo server sends an echo message back to the device.
* Subclasses should override this method to process an upstream message.
*/</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> handleIncomingDataMessage</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Object</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> jsonObject</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> from </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> jsonObject</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"from"</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// PackageName of the application that sent this message.</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> category </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> jsonObject</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"category"</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// Use the packageName as the collapseKey in the echo packet</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> collapseKey </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"echo:CollapseKey"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@SuppressWarnings</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"unchecked"</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> payload </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">>)</span><span class="pln" style="color: #4d4d4c;"> jsonObject
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"data"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> action </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> payload</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"ACTION"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"ECHO"</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">equals</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">action</span><span class="pun" style="color: #4d4d4c;">))</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> clientMessage </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> payload</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"CLIENT_MESSAGE"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
payload</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">MESSAGE_KEY</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"ECHO: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> clientMessage</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// Send an ECHO response back</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> echo </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> createJsonMessage</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">from</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> getRandomMessageId</span><span class="pun" style="color: #4d4d4c;">(),</span><span class="pln" style="color: #4d4d4c;">
payload</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> collapseKey</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">false</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
send</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">echo</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">else</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"SIGNUP"</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">equals</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">action</span><span class="pun" style="color: #4d4d4c;">))</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">try</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> userName </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> payload</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"USER_NAME"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
writeToFile</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">userName</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> from</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">catch</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">IOException</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
e</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">printStackTrace</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">else</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"USERLIST"</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">equals</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">action</span><span class="pun" style="color: #4d4d4c;">))</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> regIdMap </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> readFromFile</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> users </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">""</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">for</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Entry</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> entry </span><span class="pun" style="color: #4d4d4c;">:</span><span class="pln" style="color: #4d4d4c;"> regIdMap</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">entrySet</span><span class="pun" style="color: #4d4d4c;">())</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
users </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> users </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> entry</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getKey</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">":"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
payload</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">MESSAGE_KEY</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"USERLIST"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
payload</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"USERLIST"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">users</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> message </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> createJsonMessage</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">from</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> getRandomMessageId</span><span class="pun" style="color: #4d4d4c;">(),</span><span class="pln" style="color: #4d4d4c;">
payload</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> collapseKey</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">false</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
send</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">message</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">else</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"CHAT"</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">equals</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">action</span><span class="pun" style="color: #4d4d4c;">))</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> regIdMap </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> readFromFile</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
payload</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">MESSAGE_KEY</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"CHAT"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> toUser </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> payload</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"TOUSER"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> toUserRegid </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> regIdMap</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">toUser</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> message </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> createJsonMessage</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">toUserRegid</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> getRandomMessageId</span><span class="pun" style="color: #4d4d4c;">(),</span><span class="pln" style="color: #4d4d4c;">
payload</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> collapseKey</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">false</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
send</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">message</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/**
* Handles an ACK.
*
* <p>
* By default, it only logs a INFO message, but subclasses could override it
* to properly handle ACKS.
*/</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> handleAckReceipt</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Object</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> jsonObject</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> messageId </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> jsonObject</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"message_id"</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> from </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> jsonObject</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"from"</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
logger</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">log</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Level</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">INFO</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"handleAckReceipt() from: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> from
</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">", messageId: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> messageId</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/**
* Handles a NACK.
*
* <p>
* By default, it only logs a INFO message, but subclasses could override it
* to properly handle NACKS.
*/</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> handleNackReceipt</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Object</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> jsonObject</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> messageId </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> jsonObject</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"message_id"</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> from </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> jsonObject</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"from"</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
logger</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">log</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Level</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">INFO</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"handleNackReceipt() from: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> from
</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">", messageId: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> messageId</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/**
* Creates a JSON encoded GCM message.
*
* @param to
* RegistrationId of the target device (Required).
* @param messageId
* Unique messageId for which CCS will send an "ack/nack"
* (Required).
* @param payload
* Message content intended for the application. (Optional).
* @param collapseKey
* GCM collapse_key parameter (Optional).
* @param timeToLive
* GCM time_to_live parameter (Optional).
* @param delayWhileIdle
* GCM delay_while_idle parameter (Optional).
* @return JSON encoded GCM message.
*/</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> createJsonMessage</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> to</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> messageId</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> payload</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> collapseKey</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Long</span><span class="pln" style="color: #4d4d4c;"> timeToLive</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Boolean</span><span class="pln" style="color: #4d4d4c;"> delayWhileIdle</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Object</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> message </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Object</span><span class="pun" style="color: #4d4d4c;">>();</span><span class="pln" style="color: #4d4d4c;">
message</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"to"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> to</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">collapseKey </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
message</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"collapse_key"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> collapseKey</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">timeToLive </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
message</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"time_to_live"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> timeToLive</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">delayWhileIdle </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">&&</span><span class="pln" style="color: #4d4d4c;"> delayWhileIdle</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
message</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"delay_while_idle"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">true</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
message</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"message_id"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> messageId</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
message</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"data"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> payload</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">JSONValue</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toJSONString</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">message</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/**
* Creates a JSON encoded ACK message for an upstream message received from
* an application.
*
* @param to
* RegistrationId of the device who sent the upstream message.
* @param messageId
* messageId of the upstream message to be acknowledged to CCS.
* @return JSON encoded ack.
*/</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> createJsonAck</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> to</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> messageId</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Object</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> message </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Object</span><span class="pun" style="color: #4d4d4c;">>();</span><span class="pln" style="color: #4d4d4c;">
message</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"message_type"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"ack"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
message</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"to"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> to</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
message</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"message_id"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> messageId</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">JSONValue</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toJSONString</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">message</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/**
* Connects to GCM Cloud Connection Server using the supplied credentials.
*
* @param username
* GCM_SENDER_ID@gcm.googleapis.com
* @param password
* API Key
* @throws XMPPException
*/</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> connect</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> username</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> password</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">throws</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">XMPPException</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
config </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ConnectionConfiguration</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">GCM_SERVER</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> GCM_PORT</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
config</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setSecurityMode</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">SecurityMode</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">enabled</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
config</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setReconnectionAllowed</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">true</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
config</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setRosterLoadedAtLogin</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">false</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
config</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setSendPresence</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">false</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
config</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setSocketFactory</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">SSLSocketFactory</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getDefault</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// NOTE: Set to true to launch a window with information about packets</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// sent and received</span><span class="pln" style="color: #4d4d4c;">
config</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setDebuggerEnabled</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">true</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// -Dsmack.debugEnabled=true</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">XMPPConnection</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">DEBUG_ENABLED </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">true</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
connection </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">XMPPConnection</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">config</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
connection</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">connect</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
connection</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">addConnectionListener</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ConnectionListener</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> reconnectionSuccessful</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
logger</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">info</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"Reconnecting.."</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> reconnectionFailed</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Exception</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
logger</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">log</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Level</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">INFO</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Reconnection failed.. "</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> reconnectingIn</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> seconds</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
logger</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">log</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Level</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">INFO</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Reconnecting in %d secs"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> seconds</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> connectionClosedOnError</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Exception</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
logger</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">log</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Level</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">INFO</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Connection closed on error."</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> connectionClosed</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
logger</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">info</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"Connection closed."</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">});</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// Handle incoming packets</span><span class="pln" style="color: #4d4d4c;">
connection</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">addPacketListener</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">PacketListener</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> processPacket</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Packet</span><span class="pln" style="color: #4d4d4c;"> packet</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
logger</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">log</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Level</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">INFO</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Received: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> packet</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toXML</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Message</span><span class="pln" style="color: #4d4d4c;"> incomingMessage </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Message</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> packet</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">GcmPacketExtension</span><span class="pln" style="color: #4d4d4c;"> gcmPacket </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">GcmPacketExtension</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> incomingMessage
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getExtension</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">GCM_NAMESPACE</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> json </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> gcmPacket</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getJson</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">try</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@SuppressWarnings</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"unchecked"</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Object</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> jsonObject </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Object</span><span class="pun" style="color: #4d4d4c;">>)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">JSONValue</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">parseWithException</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">json</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// present for "ack"/"nack", null otherwise</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Object</span><span class="pln" style="color: #4d4d4c;"> messageType </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> jsonObject</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"message_type"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">messageType </span><span class="pun" style="color: #4d4d4c;">==</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// Normal upstream data message</span><span class="pln" style="color: #4d4d4c;">
handleIncomingDataMessage</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">jsonObject</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// Send ACK to CCS</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> messageId </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> jsonObject</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"message_id"</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> from </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> jsonObject</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"from"</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> ack </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> createJsonAck</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">from</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> messageId</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
send</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">ack</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">else</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"ack"</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">equals</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">messageType</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">()))</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// Process Ack</span><span class="pln" style="color: #4d4d4c;">
handleAckReceipt</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">jsonObject</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">else</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"nack"</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">equals</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">messageType</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">()))</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// Process Nack</span><span class="pln" style="color: #4d4d4c;">
handleNackReceipt</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">jsonObject</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">else</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
logger</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">log</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Level</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">WARNING</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="str" style="color: #718c00;">"Unrecognized message type (%s)"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
messageType</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">catch</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">ParseException</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
logger</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">log</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Level</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">SEVERE</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Error parsing JSON "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> json</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">catch</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Exception</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
logger</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">log</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Level</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">SEVERE</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Couldn't send echo."</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">},</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">PacketTypeFilter</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Message</span><span class="pun" style="color: #4d4d4c;">.</span><span class="kwd" style="color: #8959a8;">class</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// Log all outgoing packets</span><span class="pln" style="color: #4d4d4c;">
connection</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">addPacketInterceptor</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">PacketInterceptor</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> interceptPacket</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Packet</span><span class="pln" style="color: #4d4d4c;"> packet</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
logger</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">log</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Level</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">INFO</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Sent: {0}"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> packet</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toXML</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">},</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">PacketTypeFilter</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Message</span><span class="pun" style="color: #4d4d4c;">.</span><span class="kwd" style="color: #8959a8;">class</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
connection</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">login</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">username</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> password</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> writeToFile</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> name</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> regId</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">throws</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">IOException</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> regIdMap </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> readFromFile</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
regIdMap</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">name</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> regId</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">PrintWriter</span><span class="pln" style="color: #4d4d4c;"> out </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">PrintWriter</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">BufferedWriter</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">FileWriter</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">
REG_ID_STORE</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">false</span><span class="pun" style="color: #4d4d4c;">)));</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">for</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Entry</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> entry </span><span class="pun" style="color: #4d4d4c;">:</span><span class="pln" style="color: #4d4d4c;"> regIdMap</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">entrySet</span><span class="pun" style="color: #4d4d4c;">())</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
out</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">println</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">entry</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getKey</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">","</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> entry</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getValue</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
out</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">println</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">name </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">","</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> regId</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
out</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">close</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> readFromFile</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Map</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> regIdMap </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">try</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">BufferedReader</span><span class="pln" style="color: #4d4d4c;"> br </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">BufferedReader</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">FileReader</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">REG_ID_STORE</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> regIdLine </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">""</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
regIdMap </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">HashMap</span><span class="pun" style="color: #4d4d4c;"><</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">>();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">while</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">((</span><span class="pln" style="color: #4d4d4c;">regIdLine </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> br</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">readLine</span><span class="pun" style="color: #4d4d4c;">())</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">[]</span><span class="pln" style="color: #4d4d4c;"> regArr </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> regIdLine</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">split</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">","</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
regIdMap</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">put</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">regArr</span><span class="pun" style="color: #4d4d4c;">[</span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">],</span><span class="pln" style="color: #4d4d4c;"> regArr</span><span class="pun" style="color: #4d4d4c;">[</span><span class="lit" style="color: #f5871f;">1</span><span class="pun" style="color: #4d4d4c;">]);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
br</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">close</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">catch</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">IOException</span><span class="pln" style="color: #4d4d4c;"> ioe</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> regIdMap</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> main</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">[]</span><span class="pln" style="color: #4d4d4c;"> args</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> userName </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"512218038480"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"@gcm.googleapis.com"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> password </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"AIzaSyA9DQTcggUtfqOG9lnV_Xb5VEQ8iKBEaP4"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">SmackCcsClient</span><span class="pln" style="color: #4d4d4c;"> ccsClient </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">SmackCcsClient</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">try</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
ccsClient</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">connect</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">userName</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> password</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">catch</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">XMPPException</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
e</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">printStackTrace</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span></pre>
<pre prettyprint="prettyprint" style="height: auto; line-height: 21.5999984741211px; margin-bottom: 18px; max-width: 100%; overflow: auto; padding: 4px; tab-size: 4;">COMPILE: javac -cp *;.; SmackCcsClient.java
RUN: java -cp *;.; SmackCcsClient</pre>
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
<img alt="Google-GCM-XMPP-Chat-Server" border="0" src="http://javapapers.com/wp-content/uploads/2014/06/Google-GCM-XMPP-Chat-Server.jpg" height="478" style="background-image: none; border: 0px; display: inline; height: auto; max-width: 100%; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: middle;" title="Google-GCM-XMPP-Chat-Server" width="520" /></div>
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
Download the XMMP Server application <a href="http://javapapers.com/wp-content/uploads/2014/06/XMPP-Chat-Server.zip" style="color: #0000ee; text-decoration: none;">XMPP Chat Server</a></div>
<h2 style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; font-family: Georgia, Times, serif; font-weight: normal;">
Android Chat Application based on Google GCM</h2>
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
I am going to show only the key classes below in the source code listing. For the complete source, download the whole project source using the link give below.</div>
<h3 style="font-family: Georgia, Times, serif; font-weight: normal;">
ChatActivity.java</h3>
<pre class="prettyprint lang-java prettyprinted" style="border: 1px dashed rgb(204, 204, 204); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14.3999996185303px; height: auto; line-height: 18.7199993133545px; margin-bottom: 18px; max-height: 600px; max-width: 100%; overflow: auto; padding: 5px; tab-size: 4;"><span class="kwd" style="color: #8959a8;">package</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">javapapers</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">chat</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Random</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">app</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Activity</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">BroadcastReceiver</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Context</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Intent</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">IntentFilter</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">database</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">DataSetObserver</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">os</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">view</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">KeyEvent</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">view</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">View</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">view</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">View</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">OnKeyListener</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">AbsListView</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Button</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">EditText</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ListView</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">google</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gms</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">class</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ChatActivity</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">extends</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Activity</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> TAG </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"ChatActivity"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ChatArrayAdapter</span><span class="pln" style="color: #4d4d4c;"> chatArrayAdapter</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ListView</span><span class="pln" style="color: #4d4d4c;"> listView</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">EditText</span><span class="pln" style="color: #4d4d4c;"> chatText</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Button</span><span class="pln" style="color: #4d4d4c;"> buttonSend</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pln" style="color: #4d4d4c;"> gcm</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Intent</span><span class="pln" style="color: #4d4d4c;"> intent</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Random</span><span class="pln" style="color: #4d4d4c;"> random</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> toUserName</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">MessageSender</span><span class="pln" style="color: #4d4d4c;"> messageSender</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onCreate</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pln" style="color: #4d4d4c;"> savedInstanceState</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">super</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">onCreate</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">savedInstanceState</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Intent</span><span class="pln" style="color: #4d4d4c;"> i </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> getIntent</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
toUserName </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> i</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getStringExtra</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"TOUSER"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
setContentView</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">layout</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">activity_chat</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
buttonSend </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Button</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> findViewById</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">id</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">buttonSend</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
intent </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Intent</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">this</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">GCMNotificationIntentService</span><span class="pun" style="color: #4d4d4c;">.</span><span class="kwd" style="color: #8959a8;">class</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
registerReceiver</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">broadcastReceiver</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">IntentFilter</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"com.javapapers.android.gcm.chat.chatmessage"</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
random </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Random</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
messageSender </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">MessageSender</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
listView </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">ListView</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> findViewById</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">id</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">listView1</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
gcm </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getInstance</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">getApplicationContext</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
chatArrayAdapter </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ChatArrayAdapter</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">getApplicationContext</span><span class="pun" style="color: #4d4d4c;">(),</span><span class="pln" style="color: #4d4d4c;"> R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">layout</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">activity_chat_singlemessage</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
listView</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setAdapter</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">chatArrayAdapter</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
chatText </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">EditText</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> findViewById</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">id</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">chatText</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
chatText</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setOnKeyListener</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">OnKeyListener</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">boolean</span><span class="pln" style="color: #4d4d4c;"> onKey</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">View</span><span class="pln" style="color: #4d4d4c;"> v</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> keyCode</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">KeyEvent</span><span class="pln" style="color: #4d4d4c;"> event</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">((</span><span class="pln" style="color: #4d4d4c;">event</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getAction</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">==</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">KeyEvent</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">ACTION_DOWN</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">&&</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">keyCode </span><span class="pun" style="color: #4d4d4c;">==</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">KeyEvent</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">KEYCODE_ENTER</span><span class="pun" style="color: #4d4d4c;">))</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> sendChatMessage</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">false</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">});</span><span class="pln" style="color: #4d4d4c;">
buttonSend</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setOnClickListener</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">View</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">OnClickListener</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onClick</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">View</span><span class="pln" style="color: #4d4d4c;"> arg0</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
sendChatMessage</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">});</span><span class="pln" style="color: #4d4d4c;">
listView</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setTranscriptMode</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">AbsListView</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">TRANSCRIPT_MODE_ALWAYS_SCROLL</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
listView</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setAdapter</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">chatArrayAdapter</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
chatArrayAdapter</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">registerDataSetObserver</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">DataSetObserver</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onChanged</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">super</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">onChanged</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
listView</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setSelection</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">chatArrayAdapter</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getCount</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">-</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">1</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">});</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">boolean</span><span class="pln" style="color: #4d4d4c;"> sendChatMessage</span><span class="pun" style="color: #4d4d4c;">(){</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">//sending gcm message to the paired device</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pln" style="color: #4d4d4c;"> dataBundle </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
dataBundle</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">putString</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"ACTION"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"CHAT"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
dataBundle</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">putString</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"TOUSER"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> toUserName</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
dataBundle</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">putString</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"CHATMESSAGE"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> chatText</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getText</span><span class="pun" style="color: #4d4d4c;">().</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
messageSender</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">sendMessage</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">dataBundle</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">//updating the current device</span><span class="pln" style="color: #4d4d4c;">
chatArrayAdapter</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">add</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ChatMessage</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">false</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> chatText</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getText</span><span class="pun" style="color: #4d4d4c;">().</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">()));</span><span class="pln" style="color: #4d4d4c;">
chatText</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setText</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">""</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">true</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">BroadcastReceiver</span><span class="pln" style="color: #4d4d4c;"> broadcastReceiver </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">BroadcastReceiver</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onReceive</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Context</span><span class="pln" style="color: #4d4d4c;"> context</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Intent</span><span class="pln" style="color: #4d4d4c;"> intent</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"onReceive: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> intent</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getStringExtra</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"CHATMESSAGE"</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
chatArrayAdapter</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">add</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ChatMessage</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">true</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> intent</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getStringExtra</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"CHATMESSAGE"</span><span class="pun" style="color: #4d4d4c;">)));</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">};</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span></pre>
<h3 style="font-family: Georgia, Times, serif; font-weight: normal;">
ChatArrayAdapter.java</h3>
<pre class="prettyprint lang-java prettyprinted" style="border: 1px dashed rgb(204, 204, 204); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14.3999996185303px; height: auto; line-height: 18.7199993133545px; margin-bottom: 18px; max-height: 600px; max-width: 100%; overflow: auto; padding: 5px; tab-size: 4;"><span class="kwd" style="color: #8959a8;">package</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">javapapers</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">chat</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ArrayList</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Context</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">graphics</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Bitmap</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">graphics</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">BitmapFactory</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">view</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Gravity</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">view</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">LayoutInflater</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">view</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">View</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">view</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ViewGroup</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ArrayAdapter</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">LinearLayout</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">TextView</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">class</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ChatArrayAdapter</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">extends</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ArrayAdapter</span><chatmessage><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">TextView</span><span class="pln" style="color: #4d4d4c;"> chatText</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">List</span><chatmessage><span class="pln" style="color: #4d4d4c;"> chatMessageList </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ArrayList</span><chatmessage><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">LinearLayout</span><span class="pln" style="color: #4d4d4c;"> singleMessageContainer</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> add</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">ChatMessage</span><span class="pln" style="color: #4d4d4c;"> object</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
chatMessageList</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">add</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">object</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">super</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">add</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">object</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ChatArrayAdapter</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Context</span><span class="pln" style="color: #4d4d4c;"> context</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> textViewResourceId</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">super</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">context</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> textViewResourceId</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> getCount</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">this</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">chatMessageList</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">size</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ChatMessage</span><span class="pln" style="color: #4d4d4c;"> getItem</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> index</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">this</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">chatMessageList</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">index</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">View</span><span class="pln" style="color: #4d4d4c;"> getView</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> position</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">View</span><span class="pln" style="color: #4d4d4c;"> convertView</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ViewGroup</span><span class="pln" style="color: #4d4d4c;"> parent</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">View</span><span class="pln" style="color: #4d4d4c;"> row </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> convertView</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">row </span><span class="pun" style="color: #4d4d4c;">==</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">LayoutInflater</span><span class="pln" style="color: #4d4d4c;"> inflater </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">LayoutInflater</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">this</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getContext</span><span class="pun" style="color: #4d4d4c;">().</span><span class="pln" style="color: #4d4d4c;">getSystemService</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Context</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">LAYOUT_INFLATER_SERVICE</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
row </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> inflater</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">inflate</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">layout</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">activity_chat_singlemessage</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> parent</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">false</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
singleMessageContainer </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">LinearLayout</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> row</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">findViewById</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">id</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">singleMessageContainer</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">ChatMessage</span><span class="pln" style="color: #4d4d4c;"> chatMessageObj </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> getItem</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">position</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
chatText </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">TextView</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> row</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">findViewById</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">id</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">singleMessage</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
chatText</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setText</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">chatMessageObj</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">message</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
chatText</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setBackgroundResource</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">chatMessageObj</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">left </span><span class="pun" style="color: #4d4d4c;">?</span><span class="pln" style="color: #4d4d4c;"> R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">drawable</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">bubble_a </span><span class="pun" style="color: #4d4d4c;">:</span><span class="pln" style="color: #4d4d4c;"> R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">drawable</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">bubble_b</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
singleMessageContainer</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setGravity</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">chatMessageObj</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">left </span><span class="pun" style="color: #4d4d4c;">?</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Gravity</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">LEFT </span><span class="pun" style="color: #4d4d4c;">:</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Gravity</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">RIGHT</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> row</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Bitmap</span><span class="pln" style="color: #4d4d4c;"> decodeToBitmap</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">byte</span><span class="pun" style="color: #4d4d4c;">[]</span><span class="pln" style="color: #4d4d4c;"> decodedByte</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">BitmapFactory</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">decodeByteArray</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">decodedByte</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> decodedByte</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">length</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span></chatmessage></chatmessage></chatmessage></pre>
<h3 style="font-family: Georgia, Times, serif; font-weight: normal;">
ChatMessage.java</h3>
<pre class="prettyprint lang-java prettyprinted" style="border: 1px dashed rgb(204, 204, 204); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14.3999996185303px; height: auto; line-height: 18.7199993133545px; margin-bottom: 18px; max-height: 600px; max-width: 100%; overflow: auto; padding: 5px; tab-size: 4;"><span class="kwd" style="color: #8959a8;">package</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">javapapers</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">chat</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">class</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ChatMessage</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">boolean</span><span class="pln" style="color: #4d4d4c;"> left</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> message</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ChatMessage</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">boolean</span><span class="pln" style="color: #4d4d4c;"> left</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> message</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">super</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">this</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">left </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> left</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">this</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">message </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> message</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span></pre>
<h3 style="font-family: Georgia, Times, serif; font-weight: normal;">
GcmBroadcastReceiver.java</h3>
<pre class="prettyprint lang-java prettyprinted" style="border: 1px dashed rgb(204, 204, 204); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14.3999996185303px; height: auto; line-height: 18.7199993133545px; margin-bottom: 18px; max-height: 600px; max-width: 100%; overflow: auto; padding: 5px; tab-size: 4;"><span class="kwd" style="color: #8959a8;">package</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">javapapers</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">chat</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">app</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Activity</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ComponentName</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Context</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Intent</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">support</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">v4</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">WakefulBroadcastReceiver</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/**
* Created by Joe on 5/28/2014.
*/</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">class</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">GcmBroadcastReceiver</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">extends</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">WakefulBroadcastReceiver</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onReceive</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Context</span><span class="pln" style="color: #4d4d4c;"> context</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Intent</span><span class="pln" style="color: #4d4d4c;"> intent</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"GcmBroadcastReceiver"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="str" style="color: #718c00;">"onReceive: notification received."</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">ComponentName</span><span class="pln" style="color: #4d4d4c;"> comp </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ComponentName</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">context</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getPackageName</span><span class="pun" style="color: #4d4d4c;">(),</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">GCMNotificationIntentService</span><span class="pun" style="color: #4d4d4c;">.</span><span class="kwd" style="color: #8959a8;">class</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getName</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
startWakefulService</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">context</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">intent</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setComponent</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">comp</span><span class="pun" style="color: #4d4d4c;">)));</span><span class="pln" style="color: #4d4d4c;">
setResultCode</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Activity</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">RESULT_OK</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span></pre>
<h3 style="font-family: Georgia, Times, serif; font-weight: normal;">
GCMNotificationIntentService.java</h3>
<pre class="prettyprint lang-java prettyprinted" style="border: 1px dashed rgb(204, 204, 204); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14.3999996185303px; height: auto; line-height: 18.7199993133545px; margin-bottom: 18px; max-height: 600px; max-width: 100%; overflow: auto; padding: 5px; tab-size: 4;"><span class="kwd" style="color: #8959a8;">package</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">javapapers</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">chat</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">app</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">IntentService</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">app</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">NotificationManager</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">app</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">PendingIntent</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Context</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Intent</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">os</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">support</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">v4</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">app</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">NotificationCompat</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">google</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gms</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/**
* Created by Joe on 5/28/2014.
*/</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">class</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">GCMNotificationIntentService</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">extends</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">IntentService</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> NOTIFICATION_ID </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">1</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">NotificationManager</span><span class="pln" style="color: #4d4d4c;"> mNotificationManager</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">NotificationCompat</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Builder</span><span class="pln" style="color: #4d4d4c;"> builder</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">GCMNotificationIntentService</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">super</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"GcmIntentService"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> TAG </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"GCMNotificationIntentService"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">protected</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onHandleIntent</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Intent</span><span class="pln" style="color: #4d4d4c;"> intent</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"onHandleIntent "</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;">intent</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getDataString</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pln" style="color: #4d4d4c;"> extras </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> intent</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getExtras</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pln" style="color: #4d4d4c;"> gcm </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getInstance</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">this</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> messageType </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getMessageType</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">intent</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">extras </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(!</span><span class="pln" style="color: #4d4d4c;">extras</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">isEmpty</span><span class="pun" style="color: #4d4d4c;">())</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">MESSAGE_TYPE_SEND_ERROR
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">equals</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">messageType</span><span class="pun" style="color: #4d4d4c;">))</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
sendNotification</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"Send error: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> extras</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">else</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">MESSAGE_TYPE_DELETED
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">equals</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">messageType</span><span class="pun" style="color: #4d4d4c;">))</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
sendNotification</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"Deleted messages on server: "</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> extras</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">else</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">MESSAGE_TYPE_MESSAGE
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">equals</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">messageType</span><span class="pun" style="color: #4d4d4c;">))</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"USERLIST"</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">equals</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">extras</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"SM"</span><span class="pun" style="color: #4d4d4c;">))){</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"onHandleIntent - USERLIST "</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">//update the userlist view</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Intent</span><span class="pln" style="color: #4d4d4c;"> userListIntent </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Intent</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"com.javapapers.android.gcm.chat.userlist"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> userList </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> extras</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"USERLIST"</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
userListIntent</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">putExtra</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"USERLIST"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">userList</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
sendBroadcast</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">userListIntent</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">else</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">if</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"CHAT"</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">equals</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">extras</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"SM"</span><span class="pun" style="color: #4d4d4c;">))){</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"onHandleIntent - CHAT "</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Intent</span><span class="pln" style="color: #4d4d4c;"> chatIntent </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Intent</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"com.javapapers.android.gcm.chat.chatmessage"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
chatIntent</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">putExtra</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"CHATMESSAGE"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">extras</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">get</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"CHATMESSAGE"</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
sendBroadcast</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">chatIntent</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">i</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"SERVER_MESSAGE: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> extras</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">GcmBroadcastReceiver</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">completeWakefulIntent</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">intent</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> sendNotification</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> msg</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Preparing to send notification...: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> msg</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
mNotificationManager </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">NotificationManager</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">this</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getSystemService</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Context</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">NOTIFICATION_SERVICE</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">PendingIntent</span><span class="pln" style="color: #4d4d4c;"> contentIntent </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">PendingIntent</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getActivity</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">this</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Intent</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">this</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">SignUpActivity</span><span class="pun" style="color: #4d4d4c;">.</span><span class="kwd" style="color: #8959a8;">class</span><span class="pun" style="color: #4d4d4c;">),</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">NotificationCompat</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Builder</span><span class="pln" style="color: #4d4d4c;"> mBuilder </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">NotificationCompat</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Builder</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">this</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">setSmallIcon</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">drawable</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gcm_cloud</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setContentTitle</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"GCM XMPP Message"</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setStyle</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">NotificationCompat</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">BigTextStyle</span><span class="pun" style="color: #4d4d4c;">().</span><span class="pln" style="color: #4d4d4c;">bigText</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">msg</span><span class="pun" style="color: #4d4d4c;">))</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setContentText</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">msg</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
mBuilder</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setContentIntent</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">contentIntent</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
mNotificationManager</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">notify</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">NOTIFICATION_ID</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> mBuilder</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">build</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Notification sent successfully."</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span></pre>
<h3 style="font-family: Georgia, Times, serif; font-weight: normal;">
MessageSender.java</h3>
<pre class="prettyprint lang-java prettyprinted" style="border: 1px dashed rgb(204, 204, 204); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14.3999996185303px; height: auto; line-height: 18.7199993133545px; margin-bottom: 18px; max-height: 600px; max-width: 100%; overflow: auto; padding: 5px; tab-size: 4;"><span class="kwd" style="color: #8959a8;">package</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">javapapers</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">chat</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">os</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">AsyncTask</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">os</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">google</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gms</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">io</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">IOException</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">concurrent</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">atomic</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">AtomicInteger</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">/**
* Created by Joe on 6/1/2014.
*/</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">class</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">MessageSender</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> TAG </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"MessageSender"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">AsyncTask</span><void string="" void=""><span class="pln" style="color: #4d4d4c;"> sendTask</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">AtomicInteger</span><span class="pln" style="color: #4d4d4c;"> ccsMsgId </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">AtomicInteger</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> sendMessage</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pln" style="color: #4d4d4c;"> data</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pln" style="color: #4d4d4c;"> gcm </span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
sendTask </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">AsyncTask</span><void string="" void=""><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">protected</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> doInBackground</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Void</span><span class="pun" style="color: #4d4d4c;">...</span><span class="pln" style="color: #4d4d4c;"> params</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> id </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Integer</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">ccsMsgId</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">incrementAndGet</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">try</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"messageid: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> id</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">send</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Config</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">GOOGLE_PROJECT_ID </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"@gcm.googleapis.com"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> id</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
data</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"After gcm.send successful."</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">catch</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">IOException</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Exception: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
e</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">printStackTrace</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Message ID: "</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;">id</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">" Sent."</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">protected</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onPostExecute</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> result</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
sendTask </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"onPostExecute: result: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> result</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">};</span><span class="pln" style="color: #4d4d4c;">
sendTask</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">execute</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span></void></void></pre>
<h3 style="font-family: Georgia, Times, serif; font-weight: normal;">
UserListActivity.java</h3>
<div style="font-family: Arial, sans-serif; font-size: 14.3999996185303px; line-height: 21.5999984741211px;">
<img alt="GCM-Chat-User-List" border="0" src="http://javapapers.com/wp-content/uploads/2014/06/GCM-Chat-User-List.jpg" height="561" style="background-image: none; border: 0px; display: inline; height: auto; max-width: 100%; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: middle;" title="GCM-Chat-User-List" width="320" /></div>
<pre class="prettyprint lang-java prettyprinted" style="border: 1px dashed rgb(204, 204, 204); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14.3999996185303px; height: auto; line-height: 18.7199993133545px; margin-bottom: 18px; max-height: 600px; max-width: 100%; overflow: auto; padding: 5px; tab-size: 4;"><span class="kwd" style="color: #8959a8;">package</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">javapapers</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">chat</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">app</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ListActivity</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">BroadcastReceiver</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Context</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Intent</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">IntentFilter</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">support</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">v7</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">app</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ActionBarActivity</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">os</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">view</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Menu</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">view</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">MenuItem</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">view</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">View</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">AdapterView</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ArrayAdapter</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Button</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ListView</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">SimpleAdapter</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">TextView</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">google</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gms</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ArrayList</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Arrays</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">List</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">class</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">UserListActivity</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">extends</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ListActivity</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> TAG </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"UserListActivity"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">TextView</span><span class="pln" style="color: #4d4d4c;"> content</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Button</span><span class="pln" style="color: #4d4d4c;"> refreshButton</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Intent</span><span class="pln" style="color: #4d4d4c;"> intent</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">MessageSender</span><span class="pln" style="color: #4d4d4c;"> messageSender</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pln" style="color: #4d4d4c;"> gcm</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">protected</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onCreate</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pln" style="color: #4d4d4c;"> savedInstanceState</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">super</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">onCreate</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">savedInstanceState</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
setContentView</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">layout</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">activity_user_list</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
content </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">TextView</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;">findViewById</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">id</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">output</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setText</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"Select user to chat:"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
refreshButton </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Button</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;">findViewById</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">id</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">refreshButton</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
intent </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Intent</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">this</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">GCMNotificationIntentService</span><span class="pun" style="color: #4d4d4c;">.</span><span class="kwd" style="color: #8959a8;">class</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
registerReceiver</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">broadcastReceiver</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">IntentFilter</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"com.javapapers.android.gcm.chat.userlist"</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
messageSender </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">MessageSender</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
gcm </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getInstance</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">getApplicationContext</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
refreshButton</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setOnClickListener</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">View</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">OnClickListener</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onClick</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">View</span><span class="pln" style="color: #4d4d4c;"> arg0</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// get user list</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pln" style="color: #4d4d4c;"> dataBundle </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
dataBundle</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">putString</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"ACTION"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"USERLIST"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
messageSender</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">sendMessage</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">dataBundle</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> gcm</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">});</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">BroadcastReceiver</span><span class="pln" style="color: #4d4d4c;"> broadcastReceiver </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">BroadcastReceiver</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onReceive</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Context</span><span class="pln" style="color: #4d4d4c;"> context</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Intent</span><span class="pln" style="color: #4d4d4c;"> intent</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"onReceive: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> intent</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getStringExtra</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"USERLIST"</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
updateUI</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">intent</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getStringExtra</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"USERLIST"</span><span class="pun" style="color: #4d4d4c;">));</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">};</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> updateUI</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> userList</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">//get userlist from the intents and update the list</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">[]</span><span class="pln" style="color: #4d4d4c;"> userListArr </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> userList</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">split</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">":"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="str" style="color: #718c00;">"userListArr: "</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;">userListArr</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">length</span><span class="pun" style="color: #4d4d4c;">+</span><span class="str" style="color: #718c00;">" tostr "</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;">userListArr</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">());</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">//remove empty strings :-)</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">List</span><string><span class="pln" style="color: #4d4d4c;"> list </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ArrayList</span><string><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">for</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> s </span><span class="pun" style="color: #4d4d4c;">:</span><span class="pln" style="color: #4d4d4c;"> userListArr</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">s </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">&&</span><span class="pln" style="color: #4d4d4c;"> s</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">length</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">></span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
list</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">add</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">s</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
userListArr </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> list</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">toArray</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">[</span><span class="pln" style="color: #4d4d4c;">list</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">size</span><span class="pun" style="color: #4d4d4c;">()]);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">ArrayAdapter</span><string><span class="pln" style="color: #4d4d4c;"> adapter </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ArrayAdapter</span><string><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">this</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">layout</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">simple_list_item_1</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> userListArr</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
setListAdapter</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">adapter</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">protected</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onListItemClick</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">ListView</span><span class="pln" style="color: #4d4d4c;"> l</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">View</span><span class="pln" style="color: #4d4d4c;"> v</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> position</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">long</span><span class="pln" style="color: #4d4d4c;"> id</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">super</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">onListItemClick</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">l</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> v</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> position</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> id</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// ListView Clicked item index</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> itemPosition </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> position</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// ListView Clicked item value</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> itemValue </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> l</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getItemAtPosition</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">position</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setText</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"User selected: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;">itemValue</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Intent</span><span class="pln" style="color: #4d4d4c;"> i </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Intent</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">getApplicationContext</span><span class="pun" style="color: #4d4d4c;">(),</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">ChatActivity</span><span class="pun" style="color: #4d4d4c;">.</span><span class="kwd" style="color: #8959a8;">class</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
i</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">putExtra</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"TOUSER"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">itemValue</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
startActivity</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">i</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
finish</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">boolean</span><span class="pln" style="color: #4d4d4c;"> onCreateOptionsMenu</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Menu</span><span class="pln" style="color: #4d4d4c;"> menu</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// Inflate the menu; this adds items to the action bar if it is present.</span><span class="pln" style="color: #4d4d4c;">
getMenuInflater</span><span class="pun" style="color: #4d4d4c;">().</span><span class="pln" style="color: #4d4d4c;">inflate</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">menu</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">user_list</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> menu</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">true</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">boolean</span><span class="pln" style="color: #4d4d4c;"> onOptionsItemSelected</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">MenuItem</span><span class="pln" style="color: #4d4d4c;"> item</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// Handle action bar item clicks here. The action bar will</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// automatically handle clicks on the Home/Up button, so long</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// as you specify a parent activity in AndroidManifest.xml.</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> id </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> item</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getItemId</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">id </span><span class="pun" style="color: #4d4d4c;">==</span><span class="pln" style="color: #4d4d4c;"> R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">id</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">action_settings</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">true</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">super</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">onOptionsItemSelected</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">item</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span></string></string></string></string></pre>
<h3 style="font-family: Georgia, Times, serif; font-weight: normal;">
SignUpActivity.java</h3>
<pre class="prettyprint lang-java prettyprinted" style="border: 1px dashed rgb(204, 204, 204); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14.3999996185303px; height: auto; line-height: 18.7199993133545px; margin-bottom: 18px; max-height: 600px; max-width: 100%; overflow: auto; padding: 5px; tab-size: 4;"><span class="kwd" style="color: #8959a8;">package</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">javapapers</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">chat</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Context</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Intent</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">SharedPreferences</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">pm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">PackageInfo</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">content</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">pm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">PackageManager</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">os</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">AsyncTask</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">support</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">v7</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">app</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ActionBarActivity</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">os</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">text</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">TextUtils</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">view</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Menu</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">view</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">MenuItem</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">view</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">View</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">view</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Window</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Button</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">EditText</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">widget</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Toast</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> com</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">google</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gms</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">io</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">IOException</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">import</span><span class="pln" style="color: #4d4d4c;"> java</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">util</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">concurrent</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">atomic</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">AtomicInteger</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">class</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">SignUpActivity</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">extends</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">ActionBarActivity</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> TAG </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"SignUpActivity"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> REG_ID </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"regId"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">static</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> APP_VERSION </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"appVersion"</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Button</span><span class="pln" style="color: #4d4d4c;"> buttonSignUp</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Button</span><span class="pln" style="color: #4d4d4c;"> buttonLogin</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> regId</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> signUpUser</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">AsyncTask</span><void string="" void=""><span class="pln" style="color: #4d4d4c;"> sendTask</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">AtomicInteger</span><span class="pln" style="color: #4d4d4c;"> ccsMsgId </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">AtomicInteger</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pln" style="color: #4d4d4c;"> gcm</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Context</span><span class="pln" style="color: #4d4d4c;"> context</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">boolean</span><span class="pln" style="color: #4d4d4c;"> signupFlag </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">false</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">MessageSender</span><span class="pln" style="color: #4d4d4c;"> messageSender</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">protected</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onCreate</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pln" style="color: #4d4d4c;"> savedInstanceState</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">super</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">onCreate</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">savedInstanceState</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
setContentView</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">layout</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">activity_sign_up</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
context </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> getApplicationContext</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
buttonSignUp </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Button</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> findViewById</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">id</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ButtonSignUp</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
messageSender </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">MessageSender</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
buttonSignUp</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setOnClickListener</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">View</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">OnClickListener</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onClick</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">View</span><span class="pln" style="color: #4d4d4c;"> arg0</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">//step 1: register with Google GCM server</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">TextUtils</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">isEmpty</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">regId</span><span class="pun" style="color: #4d4d4c;">))</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
regId </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> registerGCM</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"GCM RegId: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> regId</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">//step 2: register with XMPP App Server</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pun" style="color: #4d4d4c;">(!</span><span class="pln" style="color: #4d4d4c;">regId</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">isEmpty</span><span class="pun" style="color: #4d4d4c;">())</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">EditText</span><span class="pln" style="color: #4d4d4c;"> mUserName </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">EditText</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> findViewById</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">id</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">userName</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
signUpUser </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> mUserName</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getText</span><span class="pun" style="color: #4d4d4c;">().</span><span class="pln" style="color: #4d4d4c;">toString</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pln" style="color: #4d4d4c;"> dataBundle </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
dataBundle</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">putString</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"ACTION"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"SIGNUP"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
dataBundle</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">putString</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"USER_NAME"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> signUpUser</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
messageSender</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">sendMessage</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">dataBundle</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
signupFlag </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">true</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Toast</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">makeText</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">context</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="str" style="color: #718c00;">"Sign Up Complete!"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Toast</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">LENGTH_LONG</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">show</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">else</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Toast</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">makeText</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">context</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="str" style="color: #718c00;">"Google GCM RegId Not Available!"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Toast</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">LENGTH_LONG</span><span class="pun" style="color: #4d4d4c;">).</span><span class="pln" style="color: #4d4d4c;">show</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">});</span><span class="pln" style="color: #4d4d4c;">
buttonLogin </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Button</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> findViewById</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">id</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">ButtonLogin</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
buttonLogin</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">setOnClickListener</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">View</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">OnClickListener</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onClick</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">View</span><span class="pln" style="color: #4d4d4c;"> arg0</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">//step 0: register with Google GCM server</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">TextUtils</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">isEmpty</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">regId</span><span class="pun" style="color: #4d4d4c;">))</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
regId </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> registerGCM</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"GCM RegId: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> regId</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">//step 1: user authentication</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">//step 2: get user list</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pln" style="color: #4d4d4c;"> dataBundle </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Bundle</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
dataBundle</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">putString</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"ACTION"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"USERLIST"</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
dataBundle</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">putString</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"USER_NAME"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> signUpUser</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
messageSender</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">sendMessage</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">dataBundle</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">gcm</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Intent</span><span class="pln" style="color: #4d4d4c;"> i </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Intent</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">context</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">UserListActivity</span><span class="pun" style="color: #4d4d4c;">.</span><span class="kwd" style="color: #8959a8;">class</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="str" style="color: #718c00;">"onClick of login: Before starting userlist activity."</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
startActivity</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">i</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
finish</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"onClick of Login: After finish."</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">});</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> registerGCM</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
gcm </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getInstance</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">this</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
regId </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> getRegistrationId</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">TextUtils</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">isEmpty</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">regId</span><span class="pun" style="color: #4d4d4c;">))</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
registerInBackground</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="str" style="color: #718c00;">"registerGCM - successfully registered with GCM server - regId: "</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> regId</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">else</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="str" style="color: #718c00;">"Regid already available: "</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> regId
</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> regId</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> getRegistrationId</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">SharedPreferences</span><span class="pln" style="color: #4d4d4c;"> prefs </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> getSharedPreferences</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">SignUpActivity</span><span class="pun" style="color: #4d4d4c;">.</span><span class="kwd" style="color: #8959a8;">class</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getSimpleName</span><span class="pun" style="color: #4d4d4c;">(),</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Context</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">MODE_PRIVATE</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> registrationId </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> prefs</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getString</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">REG_ID</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">""</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">registrationId</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">isEmpty</span><span class="pun" style="color: #4d4d4c;">())</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">i</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Registration not found."</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">""</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> registeredVersion </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> prefs</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getInt</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">APP_VERSION</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Integer</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">MIN_VALUE</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> currentVersion </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> getAppVersion</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">registeredVersion </span><span class="pun" style="color: #4d4d4c;">!=</span><span class="pln" style="color: #4d4d4c;"> currentVersion</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">i</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"App version changed."</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">""</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> registrationId</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> getAppVersion</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">try</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">PackageInfo</span><span class="pln" style="color: #4d4d4c;"> packageInfo</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
packageInfo </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> context</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getPackageManager</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getPackageInfo</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">context</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getPackageName</span><span class="pun" style="color: #4d4d4c;">(),</span><span class="pln" style="color: #4d4d4c;"> </span><span class="lit" style="color: #f5871f;">0</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> packageInfo</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">versionCode</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">catch</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">PackageManager</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">NameNotFoundException</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"RegisterActivity"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;">
</span><span class="str" style="color: #718c00;">"I never expected this! Going down, going down!"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> e</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">throw</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">RuntimeException</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">e</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> registerInBackground</span><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">new</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">AsyncTask</span><void string="" void=""><span class="pun" style="color: #4d4d4c;">()</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">protected</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> doInBackground</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Void</span><span class="pun" style="color: #4d4d4c;">...</span><span class="pln" style="color: #4d4d4c;"> params</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> msg </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">""</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">try</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">gcm </span><span class="pun" style="color: #4d4d4c;">==</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
gcm </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">GoogleCloudMessaging</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getInstance</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">context</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
regId </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> gcm</span><span class="pun" style="color: #4d4d4c;">.</span><span class="kwd" style="color: #8959a8;">register</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Config</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">GOOGLE_PROJECT_ID</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="str" style="color: #718c00;">"RegisterActivity"</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"registerInBackground - regId: "</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> regId</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
msg </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Device registered, registration ID="</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> regId</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
storeRegistrationId</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">regId</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">catch</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">IOException</span><span class="pln" style="color: #4d4d4c;"> ex</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
msg </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Error :"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> ex</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getMessage</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Error: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> msg</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"AsyncTask completed: "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> msg</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> msg</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">protected</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> onPostExecute</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> msg</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">d</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Registered with GCM Server."</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> msg</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}.</span><span class="pln" style="color: #4d4d4c;">execute</span><span class="pun" style="color: #4d4d4c;">(</span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">null</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">private</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">void</span><span class="pln" style="color: #4d4d4c;"> storeRegistrationId</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">String</span><span class="pln" style="color: #4d4d4c;"> regId</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">final</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">SharedPreferences</span><span class="pln" style="color: #4d4d4c;"> prefs </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> getSharedPreferences</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">SignUpActivity</span><span class="pun" style="color: #4d4d4c;">.</span><span class="kwd" style="color: #8959a8;">class</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getSimpleName</span><span class="pun" style="color: #4d4d4c;">(),</span><span class="pln" style="color: #4d4d4c;"> </span><span class="typ" style="color: #4271ae;">Context</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">MODE_PRIVATE</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> appVersion </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> getAppVersion</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">Log</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">i</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">TAG</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> </span><span class="str" style="color: #718c00;">"Saving regId on app version "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">+</span><span class="pln" style="color: #4d4d4c;"> appVersion</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="typ" style="color: #4271ae;">SharedPreferences</span><span class="pun" style="color: #4d4d4c;">.</span><span class="typ" style="color: #4271ae;">Editor</span><span class="pln" style="color: #4d4d4c;"> editor </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> prefs</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">edit</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
editor</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">putString</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">REG_ID</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> regId</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
editor</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">putInt</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">APP_VERSION</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> appVersion</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
editor</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">commit</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">boolean</span><span class="pln" style="color: #4d4d4c;"> onCreateOptionsMenu</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">Menu</span><span class="pln" style="color: #4d4d4c;"> menu</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// Inflate the menu; this adds items to the action bar if it is present.</span><span class="pln" style="color: #4d4d4c;">
getMenuInflater</span><span class="pun" style="color: #4d4d4c;">().</span><span class="pln" style="color: #4d4d4c;">inflate</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">menu</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">sign_up</span><span class="pun" style="color: #4d4d4c;">,</span><span class="pln" style="color: #4d4d4c;"> menu</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">true</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="lit" style="color: #f5871f;">@Override</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">public</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">boolean</span><span class="pln" style="color: #4d4d4c;"> onOptionsItemSelected</span><span class="pun" style="color: #4d4d4c;">(</span><span class="typ" style="color: #4271ae;">MenuItem</span><span class="pln" style="color: #4d4d4c;"> item</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// Handle action bar item clicks here. The action bar will</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// automatically handle clicks on the Home/Up button, so long</span><span class="pln" style="color: #4d4d4c;">
</span><span class="com" style="color: #78b937;">// as you specify a parent activity in AndroidManifest.xml.</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">int</span><span class="pln" style="color: #4d4d4c;"> id </span><span class="pun" style="color: #4d4d4c;">=</span><span class="pln" style="color: #4d4d4c;"> item</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">getItemId</span><span class="pun" style="color: #4d4d4c;">();</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">if</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">id </span><span class="pun" style="color: #4d4d4c;">==</span><span class="pln" style="color: #4d4d4c;"> R</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">id</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">action_settings</span><span class="pun" style="color: #4d4d4c;">)</span><span class="pln" style="color: #4d4d4c;"> </span><span class="pun" style="color: #4d4d4c;">{</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">true</span><span class="pun" style="color: #4d4d4c;">;</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="kwd" style="color: #8959a8;">return</span><span class="pln" style="color: #4d4d4c;"> </span><span class="kwd" style="color: #8959a8;">super</span><span class="pun" style="color: #4d4d4c;">.</span><span class="pln" style="color: #4d4d4c;">onOptionsItemSelected</span><span class="pun" style="color: #4d4d4c;">(</span><span class="pln" style="color: #4d4d4c;">item</span><span class="pun" style="color: #4d4d4c;">);</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span><span class="pln" style="color: #4d4d4c;">
</span><span class="pun" style="color: #4d4d4c;">}</span></void></void></pre>
<h3 style="font-family: Georgia, Times, serif; font-weight: normal;">
activity_chat.xml</h3>
<pre class="prettyprint lang-xml prettyprinted" style="border: 1px dashed rgb(204, 204, 204); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14.3999996185303px; height: auto; line-height: 18.7199993133545px; margin-bottom: 18px; max-height: 600px; max-width: 100%; overflow: auto; padding: 5px; tab-size: 4;"><span class="pun" style="color: #4d4d4c;"><?</span><span class="pln" style="color: #4d4d4c;">xml version</span><span class="pun" style="color: #4d4d4c;">=</span><span class="str" style="color: #718c00;">"1.0"</span><span class="pln" style="color: #4d4d4c;"> encoding</span><span class="pun" style="color: #4d4d4c;">=</span><span class="str" style="color: #718c00;">"utf-8"</span><span class="pun" style="color: #4d4d4c;">?></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><RelativeLayout</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">xmlns:android</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"http://schemas.android.com/apk/res/android"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"fill_parent"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"fill_parent"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:orientation</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"vertical"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><ListView</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:id</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/listView1"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"match_parent"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_marginBottom</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"80dp"</span><span class="tag" style="color: #c82829;">></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"></ListView></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><RelativeLayout</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:id</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/form"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"fill_parent"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignParentBottom</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignParentLeft</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:orientation</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"vertical"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><EditText</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:inputType</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"textMultiLine"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:ems</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"10"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:id</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/chatText"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignParentBottom</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignParentLeft</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignParentStart</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_toLeftOf</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/buttonSend"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><Button</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:text</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"Send"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:id</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/buttonSend"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignBottom</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/chatText"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignParentRight</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignParentEnd</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"></RelativeLayout></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"></RelativeLayout></span></pre>
<h3 style="font-family: Georgia, Times, serif; font-weight: normal;">
activity_chat_singlemessage.xml</h3>
<pre class="prettyprint lang-xml prettyprinted" style="border: 1px dashed rgb(204, 204, 204); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14.3999996185303px; height: auto; line-height: 18.7199993133545px; margin-bottom: 18px; max-height: 600px; max-width: 100%; overflow: auto; padding: 5px; tab-size: 4;"><span class="pun" style="color: #4d4d4c;"><?</span><span class="pln" style="color: #4d4d4c;">xml version</span><span class="pun" style="color: #4d4d4c;">=</span><span class="str" style="color: #718c00;">"1.0"</span><span class="pln" style="color: #4d4d4c;"> encoding</span><span class="pun" style="color: #4d4d4c;">=</span><span class="str" style="color: #718c00;">"utf-8"</span><span class="pun" style="color: #4d4d4c;">?></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><LinearLayout</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">xmlns:android</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"http://schemas.android.com/apk/res/android"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"fill_parent"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><LinearLayout</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:id</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/singleMessageContainer"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"fill_parent"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><TextView</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:id</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/singleMessage"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_gravity</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"center"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_margin</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"5dip"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:background</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@drawable/bubble_b"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:paddingLeft</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"10dip"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:text</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"Hello bubbles!"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:textColor</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@android:color/primary_text_light"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"></LinearLayout></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"></LinearLayout></span></pre>
<h3 style="font-family: Georgia, Times, serif; font-weight: normal;">
activity_user_list.xml</h3>
<pre class="prettyprint lang-xml prettyprinted" style="border: 1px dashed rgb(204, 204, 204); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14.3999996185303px; height: auto; line-height: 18.7199993133545px; margin-bottom: 18px; max-height: 600px; max-width: 100%; overflow: auto; padding: 5px; tab-size: 4;"><span class="tag" style="color: #c82829;"><RelativeLayout</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">xmlns:android</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"http://schemas.android.com/apk/res/android"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">xmlns:tools</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"http://schemas.android.com/tools"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"match_parent"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"match_parent"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:paddingLeft</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@dimen/activity_horizontal_margin"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:paddingRight</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@dimen/activity_horizontal_margin"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:paddingTop</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@dimen/activity_vertical_margin"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:paddingBottom</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@dimen/activity_vertical_margin"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">tools:context</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"com.javapapers.android.gcm.chat.UserListActivity"</span><span class="tag" style="color: #c82829;">></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><TextView</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">android:id</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/output"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:background</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@color/BrightBlue"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:padding</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@dimen/abc_action_bar_icon_vertical_padding"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:textColor</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"#ffffff"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:text</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"Click : "</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"fill_parent"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><ListView</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:id</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@android:id/list"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignParentTop</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignParentLeft</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignParentStart</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_marginTop</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"103dp"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><Button</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">style</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"</span><span class="pun" style="color: #4d4d4c;">?</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">:</span><span class="pln" style="color: #4d4d4c;">attr</span><span class="pun" style="color: #4d4d4c;">/</span><span class="pln" style="color: #4d4d4c;">buttonStyleSmall</span><span class="atv" style="color: #3e999f;">"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:text</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"Refresh"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:id</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/refreshButton"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_below</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/output"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignParentRight</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignParentEnd</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"></RelativeLayout></span></pre>
<h3 style="font-family: Georgia, Times, serif; font-weight: normal;">
activity_chat_singlemessage.xml</h3>
<pre class="prettyprint lang-xml prettyprinted" style="border: 1px dashed rgb(204, 204, 204); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14.3999996185303px; height: auto; line-height: 18.7199993133545px; margin-bottom: 18px; max-height: 600px; max-width: 100%; overflow: auto; padding: 5px; tab-size: 4;"><span class="tag" style="color: #c82829;"><RelativeLayout</span><span class="pln" style="color: #4d4d4c;"> </span><span class="atn" style="color: #f5871f;">xmlns:android</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"http://schemas.android.com/apk/res/android"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">xmlns:tools</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"http://schemas.android.com/tools"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"match_parent"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"match_parent"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:paddingLeft</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@dimen/activity_horizontal_margin"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:paddingRight</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@dimen/activity_horizontal_margin"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:paddingTop</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@dimen/activity_vertical_margin"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:paddingBottom</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@dimen/activity_vertical_margin"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">tools:context</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"com.javapapers.android.gcm.chat.SignUpActivity"</span><span class="tag" style="color: #c82829;">></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><ImageView</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_above</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/userName"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_centerHorizontal</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_margin</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"60dp"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_marginBottom</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"74dp"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:contentDescription</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"Application Logo"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:src</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@drawable/gcmchat"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><EditText</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:id</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/userName"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"fill_parent"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_centerInParent</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_marginBottom</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"20dp"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_marginLeft</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"20dp"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_marginRight</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"20dp"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:singleLine</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"true"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:hint</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@string/enter_username"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><Button</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:id</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/ButtonLogin"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">style</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"</span><span class="pun" style="color: #4d4d4c;">?</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">:</span><span class="pln" style="color: #4d4d4c;">attr</span><span class="pun" style="color: #4d4d4c;">/</span><span class="pln" style="color: #4d4d4c;">borderlessButtonStyle</span><span class="atv" style="color: #3e999f;">"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"120dp"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"45dp"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:background</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@color/BrightBlue"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:text</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@string/login"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_marginTop</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"37dp"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_below</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/editText"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignLeft</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/editText"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignStart</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/editText"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><Button</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:id</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/ButtonSignUp"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">style</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"</span><span class="pun" style="color: #4d4d4c;">?</span><span class="pln" style="color: #4d4d4c;">android</span><span class="pun" style="color: #4d4d4c;">:</span><span class="pln" style="color: #4d4d4c;">attr</span><span class="pun" style="color: #4d4d4c;">/</span><span class="pln" style="color: #4d4d4c;">borderlessButtonStyle</span><span class="atv" style="color: #3e999f;">"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"120dp"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"45dp"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:background</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@color/BrightBlue"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:text</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@string/signup"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:textColorHint</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@color/White"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignTop</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/ButtonLogin"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignRight</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/userName"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignEnd</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/userName"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"><EditText</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_width</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_height</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"wrap_content"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:inputType</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"textPassword"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:ems</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"10"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:id</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/editText"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_below</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/userName"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignLeft</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/userName"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignStart</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/userName"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignRight</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/userName"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:layout_alignEnd</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@+id/userName"</span><span class="pln" style="color: #4d4d4c;">
</span><span class="atn" style="color: #f5871f;">android:hint</span><span class="pun" style="color: #4d4d4c;">=</span><span class="atv" style="color: #3e999f;">"@string/enter_password"</span><span class="pln" style="color: #4d4d4c;"> </span><span class="tag" style="color: #c82829;">/></span><span class="pln" style="color: #4d4d4c;">
</span><span class="tag" style="color: #c82829;"></RelativeLayout></span></pre>
</div>
Android-help1http://www.blogger.com/profile/09731752225464386410noreply@blogger.com0