<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1474889468959966316</id><updated>2012-02-02T15:42:54.602-08:00</updated><category term='Scrollview'/><category term='Youtube'/><category term='Download'/><category term='FileWriter'/><category term='Custom Adapter'/><category term='Custom Widgets'/><category term='Gestures'/><category term='UI'/><category term='Files'/><category term='Android Tricks'/><category term='Security'/><category term='Progress Bar'/><category term='Automate'/><category term='honeycomb'/><category term='Froyo'/><category term='Signed apk'/><category term='Websockets'/><category term='GUI'/><category term='Eclair'/><category term='Android 2.0 Apps'/><category term='Videos'/><category term='notifications'/><category term='Streaming'/><category term='Audio'/><category term='Ice Cream Sandwich'/><category term='Gingerbread'/><category term='Apps'/><category term='SMS Blocking'/><category term='2.2'/><category term='Screen Sizes'/><category term='Android Hacks'/><category term='Animations'/><category term='Android'/><category term='Android Apps'/><category term='Webview'/><category term='SlidingDrawer'/><category term='Device Admin API'/><category term='Android 2.0'/><category term='SMS'/><category term='Zip'/><category term='Blogger Client'/><category term='jQuery'/><category term='PagerAdapter'/><category term='MediaPlayer'/><category term='Unzip'/><category term='Google Maps API'/><category term='CSS'/><category term='Javascript'/><category term='Android Market'/><category term='Html on TextView'/><category term='Android 1.5'/><category term='Market on Emulator'/><category term='RelativeLayout'/><category term='Radio'/><category term='List View'/><category term='Orientation change'/><category term='HTC Hero'/><category term='Programs'/><category term='Keystore'/><category term='ICS'/><category term='Widgets'/><category term='Android 2.1 upgrade'/><category term='Intents'/><category term='Signing android apps'/><category term='drag drop'/><category term='LinearLayout'/><category term='Android Development'/><category term='Layout'/><category term='Blogspot client'/><category term='Eclipse'/><category term='ViewPager'/><category term='TextView'/><category term='2.3'/><category term='Eclair UI'/><category term='Bluetooth'/><category term='network'/><category term='Tablet Emulators'/><category term='Third party libraries'/><category term='Html'/><category term='New Features'/><category term='Compatibilty Package'/><category term='Emulator and Paid Apps'/><category term='Ant'/><category term='examples'/><category term='OS'/><category term='Blogaway'/><title type='text'>Tech Droid</title><subtitle type='html'>Tips for Android Developers and my experiences with Android</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>50</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-606098021518946600</id><published>2012-01-12T09:25:00.000-08:00</published><updated>2012-01-12T09:39:29.514-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Download'/><category scheme='http://www.blogger.com/atom/ns#' term='Programs'/><category scheme='http://www.blogger.com/atom/ns#' term='Videos'/><category scheme='http://www.blogger.com/atom/ns#' term='examples'/><category scheme='http://www.blogger.com/atom/ns#' term='Youtube'/><title type='text'>Download Videos from Youtube Trick</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-n4vLlBOvAhQ/Tw8XTlutuwI/AAAAAAAADzE/ManNpaz9YVw/s1600/yt_powered_by_black.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-n4vLlBOvAhQ/Tw8XTlutuwI/AAAAAAAADzE/ManNpaz9YVw/s1600/yt_powered_by_black.png" /&gt;&lt;/a&gt;&lt;/div&gt;
First things first. Is it legal to download videos from Youtube?&lt;br /&gt;
&lt;br /&gt;
As much I have understood from the &lt;a href="http://www.youtube.com/t/terms"&gt;Terms of Service&lt;/a&gt;, it's not a straight yes or no. Basically, Youtube doesn't have a publicly available API or service that would allow users to download the videos. Of course, you can download back the videos that you had originally uploaded. But who would do that anyway?&lt;br /&gt;
&lt;br /&gt;
However, there are workarounds and tricks with which you can actually download any video from the website. There are many softwares/add-ons that easily do this job. Here is a snapshot from the published "&lt;a href="http://www.youtube.com/t/terms"&gt;Terms of Service&lt;/a&gt;".&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;br /&gt;
&lt;div style="color: blue;"&gt;
&lt;i&gt;You shall not download any Content unless you see a “download” or 
similar link displayed by YouTube on the Service for that Content.  You 
shall not copy, reproduce, make available online or electronically 
transmit, publish, adapt, distribute, transmit, broadcast, display, 
sell, license, or otherwise exploit any Content for any other purposes 
without the prior written consent of YouTube or the respective licensors
 of the Content. YouTube and its licensors reserve all rights not 
expressly granted in and to the Service and the Content.&lt;/i&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-WcI0UqPrzls/Tw8TxuQI0qI/AAAAAAAADy8/mz4F5zu3gGA/s1600/Youtube+Policy.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="195" src="http://2.bp.blogspot.com/-WcI0UqPrzls/Tw8TxuQI0qI/AAAAAAAADy8/mz4F5zu3gGA/s400/Youtube+Policy.png" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;From Youtube &lt;a href="http://www.youtube.com/t/terms"&gt;Terms of Service&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
It says, that you cannot exploit the content/content-owners by selling the videos or re-distributing it, thereby, making a profit against your sales. That's obviously illegal for any kind of content, unless of course, the license makes that content freely re-distributable. So, if you download the videos using those workarounds and tricks, only for your personal use (ex, offline viewing), you probably aren't breaking any rules. What about those add-ons/softwares that do this? Well, it's not illegal for them, since they are just distributing the software. So, they are off the hook. &lt;br /&gt;
&lt;br /&gt;
For personal use, it seems ok to download videos off from Youtube. So? let's see how hard or difficult it is to get this working.Actually, it's quite simple.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1:&lt;/b&gt; You should have the &lt;b style="color: blue;"&gt;VIDEO ID&lt;/b&gt; of the video that you want to download.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 2:&lt;/b&gt; You need to make a call to this api, to get the details for that video. The &lt;b&gt;fmt&lt;/b&gt; parameter is for getting the specified format of the videos. See the &lt;b&gt;"Quality and Codecs"&lt;/b&gt; section on &lt;a href="http://en.wikipedia.org/wiki/YouTube"&gt;this page on Wikipedia&lt;/a&gt;.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;&lt;i&gt;URL =&amp;gt; &lt;span style="color: blue;"&gt;http://www.youtube.com/get_video_info?video_id=VIDEO_ID&amp;amp;fmt=6&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
&lt;b&gt;Step 3:&lt;/b&gt; Process the response. You will get a plain string response. That response contains all the direct URLs to various formats of the video. Look for the key &lt;b&gt;"url_encoded_fmt_stream_map"&lt;/b&gt; and the value for this key is what you need from this response. You will need to filter out all the URLs from here, and get hold of the URL to the format you want to download. Here are some sample URLs.&lt;br /&gt;
&lt;blockquote class="tr_bq" style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: xx-small;"&gt;http://o-o.preferred.bharti-bom1.v8.lscache7.c.youtube.com/videoplayback?sparams=id,expire,ip,ipbits,itag,source,ratebypass,cp&amp;amp;fexp=904510,914501,908302,902315,916201,905267&amp;amp;itag=45&amp;amp;ip=203.0.0.0&amp;amp;signature=095A9503E49931B0B849257048E73EB7388F515A.C13F4074ED92A82DF94BBD73E808E917369C224D&amp;amp;sver=3&amp;amp;ratebypass=yes&amp;amp;source=youtube&amp;amp;expire=1326412828&amp;amp;key=yt1&amp;amp;ipbits=8&amp;amp;cp=U0hRS1RMUF9HUkNOMV9MRlRJOjZ2TTNoOG9ialZD&amp;amp;id=c418f3a4b0f1b751&amp;amp;quality=hd720&amp;amp;fallback_host=tc.v8.cache7.c.youtube.com&amp;amp;type=video/webm; codecs="vp8.0, vorbis"&amp;amp;itag=45&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b&gt;&lt;span style="font-size: xx-small;"&gt;&lt;span style="color: #990000;"&gt;http://o-o.preferred.bharti-bom1.v11.lscache3.c.youtube.com/videoplayback?sparams=id,expire,ip,ipbits,itag,source,ratebypass,cp&amp;amp;fexp=904510,914501,908302,902315,916201,905267&amp;amp;itag=22&amp;amp;ip=203.0.0.0&amp;amp;signature=2C46F096073FDACEFD3B4895EDBC3CA1162682AD.3BCAE9E76BBE98D3FB687AF16ECC595E35AD8173&amp;amp;sver=3&amp;amp;ratebypass=yes&amp;amp;source=youtube&amp;amp;expire=1326412828&amp;amp;key=yt1&amp;amp;ipbits=8&amp;amp;cp=U0hRS1RMUF9HUkNOMV9MRlRJOjZ2TTNoOG9ialZD&amp;amp;id=c418f3a4b0f1b751&amp;amp;quality=hd720&amp;amp;fallback_host=tc.v11.cache3.c.youtube.com&amp;amp;type=video/mp4; codecs="avc1.64001F, mp4a.40.2"&amp;amp;itag=22&lt;/span&gt; &lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
&amp;nbsp;If you notice the URLs, there is a type parameter, where you can determine which URL is for which format (&lt;b&gt;type=video/mp4&lt;/b&gt;, &lt;b&gt;type=video/webm&lt;/b&gt; etc).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 4:&lt;/b&gt; To finally be able to download the video, you need to strip off a few values from these URLs, just to make sure your calls don't fail due to long URLs. What I have noticed is that if you strip off (everything after the quality param) the last parts of the URLs, everything's just fine. So, the final URL would be something like:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;b style="color: #990000;"&gt;&lt;span style="font-size: xx-small;"&gt;http://o-o.preferred.bharti-bom1.v11.lscache3.c.youtube.com/videoplayback?sparams=id,expire,ip,ipbits,itag,source,ratebypass,cp&amp;amp;fexp=904510,914501,908302,902315,916201,905267&amp;amp;itag=22&amp;amp;ip=203.0.0.0&amp;amp;signature=2C46F096073FDACEFD3B4895EDBC3CA1162682AD.3BCAE9E76BBE98D3FB687AF16ECC595E35AD8173&amp;amp;sver=3&amp;amp;ratebypass=yes&amp;amp;source=youtube&amp;amp;expire=1326412828&amp;amp;key=yt1&amp;amp;ipbits=8&amp;amp;cp=U0hRS1RMUF9HUkNOMV9MRlRJOjZ2TTNoOG9ialZD&amp;amp;id=c418f3a4b0f1b751&amp;amp;quality=hd720&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;Step 5:&lt;/b&gt; Save the file with the proper extension. That's it. You are done.&lt;br /&gt;
&lt;br /&gt;
If you ask how I got to know about this trick? Well, everything's already out there on the web. A lot of people have already blogged about it before. But, I had to dig for it for almost 2 days. So, I hope someone finds it useful. So, if you want to make your own &lt;b&gt;Youtube Downloader&lt;/b&gt;, now you know "How to Download Youtube Videos programmatically".&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&lt;b style="color: blue;"&gt;Note: This method might stop working as and when Google/Youtube blocks this loophole. &lt;/b&gt;&lt;b style="color: blue;"&gt;In the past, Youtube has been known to block a few other workarounds that had existed.&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-606098021518946600?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/606098021518946600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2012/01/download-videos-from-youtube-trick.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/606098021518946600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/606098021518946600'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2012/01/download-videos-from-youtube-trick.html' title='Download Videos from Youtube Trick'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-n4vLlBOvAhQ/Tw8XTlutuwI/AAAAAAAADzE/ManNpaz9YVw/s72-c/yt_powered_by_black.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-638427975998296995</id><published>2011-12-28T10:17:00.000-08:00</published><updated>2011-12-29T09:33:09.796-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Apps'/><category scheme='http://www.blogger.com/atom/ns#' term='examples'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='Bluetooth'/><title type='text'>Bluetooth on Android : Part I</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="color: #0b5394;"&gt;
&lt;span style="font-size: small;"&gt;&lt;i&gt;This is a part of a series of posts in which I will put forward a full working app what uses bluetooth on your Android device to discover, connect, pair, send and receive files. The source code would be tagged with each part of this series.&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;&lt;a href="https://github.com/coomar2841/droid_bt_connect/zipball/v1.0"&gt;Part 1&lt;/a&gt;: The app should be able to discover and list out the devices (paired/unpaired).&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
To start off with learning about bluetooth on Android, visit the &lt;a href="http://developer.android.com/guide/topics/wireless/bluetooth.html"&gt;official documentation&lt;/a&gt;. The documentation is quite lucid and clear. Here I will try to explain parts of my code.&lt;br /&gt;
&lt;br /&gt;
The first activity (&lt;a href="https://github.com/coomar2841/droid_bt_connect/blob/master/src/com/beanie/bluetooth/HomeActivity.java"&gt;HomeActivity&lt;/a&gt;), for now, will have a single button "Discover Devices", which will take you to the activity(&lt;a href="https://github.com/coomar2841/droid_bt_connect/blob/master/src/com/beanie/bluetooth/DiscoverDevicesActivity.java"&gt;DiscoverDevicesActivity&lt;/a&gt;) where you can see the list of devices that are visible by your device.&lt;br /&gt;
&lt;br /&gt;
This activity does a few things, quite a few if-else conditions.&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;First, you need to check if your device supports bluetooth. If you don't have the hardware capability on your phone, you won't be able to run this application. Eh!! Most of the phones would obviously have bluetooth. Ummm...Yes... But the emulators don't. Arrggghhh!!!!&lt;/li&gt;
&lt;li&gt;Once you are sure that your device has bluetooth capability, the next thing to check if it is enabled or not. If it's enabled, move on to the next step, else you will need to turn it on first.&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;div style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;&lt;i&gt;Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b style="color: #990000;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;i&gt;startActivityForResult(intent, REQUEST_ENABLE_BT); &lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Once, you click on "Yes" on the confirmation dialog that you will see, bluetooth radio will be switched on for you. On the screen, the "Scan" button will become active. Once you tap the "Scan" button, the ListView will show the list of devices that your device can discover.&lt;/li&gt;
&lt;/ul&gt;
That's all for the first part of the series. But, there's a little more to understand abut discovery.&lt;br /&gt;
&lt;br /&gt;
The process of discovery is asynchronous. The list view, currently shows two kinds of devices.&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;Devices which your phone already knows about (Paired)&lt;/li&gt;
&lt;li&gt;Devices which are discovered (Which are not paired with your device)&lt;/li&gt;
&lt;/ol&gt;
Getting the already paired devices is simple. The &lt;a href="http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html"&gt;BluetoothAdapter&lt;/a&gt; will give you details about such devices. &lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;div style="color: #990000;"&gt;
&lt;i&gt;&lt;span style="font-size: x-small;"&gt;&lt;b&gt;// Check already discovered devices&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;i style="color: #990000;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;b&gt;Set&amp;lt;BluetoothDevice&amp;gt; devices = bluetoothAdapter.getBondedDevices();&lt;br /&gt;for (BluetoothDevice device : devices) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; adapter.addDevice(device);&lt;br /&gt;}&lt;br /&gt;adapter.notifyDataSetChanged();&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;
Now comes the actual discovery part. For this, you will need to register a broadcast receiver which will be called whenever a new device is found. After registering the receiver, you need to trigger the discovery by calling the &lt;a href="http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#startDiscovery%28%29"&gt;startDiscovery()&lt;/a&gt; method of the &lt;a href="http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html"&gt;BluetoothAdapter&lt;/a&gt;.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i style="color: #990000;"&gt;&lt;b&gt;&lt;span style="font-size: x-small;"&gt;// Scan for new devices&lt;br /&gt;IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);&lt;br /&gt;registerReceiver(devicesReceiver, filter);&lt;br /&gt;&lt;br /&gt;bluetoothAdapter.startDiscovery();&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;/blockquote&gt;
On the receiver's onReceive() method, we pick up the details about the new device found, and add it to our ListView.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;div style="color: #990000;"&gt;
&lt;span style="font-size: x-small;"&gt;&lt;i&gt;&lt;b&gt;public void onReceive(Context context, Intent intent) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String action = intent.getAction();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // When discovery finds a device&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (BluetoothDevice.ACTION_FOUND.equals(action)) {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Log.i(TAG, "Device found");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the BluetoothDevice object from the Intent&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BluetoothDevice device = intent&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Add the name and address to an array adapter to show in a ListView&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; adapter.addDevice(device);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; adapter.notifyDataSetChanged();&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style="font-size: x-small;"&gt;&lt;i style="color: #990000;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;
The &lt;a href="https://github.com/coomar2841/droid_bt_connect/blob/master/src/com/beanie/bluetooth/DevicesAdapter.java"&gt;DevicesAdapter&lt;/a&gt; is a custom adapter for the ListView which we will be updating in the subsequent posts to show more information about the devices.&lt;br /&gt;
&lt;br /&gt;
As always, you should unregister your receiver, once your activity is paused. Also, in addition to this, you should also cancel the discovery if at all you have started by calling the cancelDiscovery() method of the BluetoothAdapter. &lt;br /&gt;
&lt;br /&gt;
The part 1 of the project can be checked out by fetching the source code and checking out the v1.0 tag from the repository. The &lt;a href="https://github.com/coomar2841/droid_bt_connect/"&gt;complete source code can be found here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Alternately, if you want to download the source of Part 1 as a zip, use &lt;a href="https://github.com/coomar2841/droid_bt_connect/zipball/v1.0"&gt;this link to Part 1&lt;/a&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-638427975998296995?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/638427975998296995/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2011/12/bluetooth-on-android-part-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/638427975998296995'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/638427975998296995'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2011/12/bluetooth-on-android-part-i.html' title='Bluetooth on Android : Part I'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-7223521547698986358</id><published>2011-10-31T15:33:00.000-07:00</published><updated>2011-10-31T15:40:06.514-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='drag drop'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='honeycomb'/><category scheme='http://www.blogger.com/atom/ns#' term='Ice Cream Sandwich'/><category scheme='http://www.blogger.com/atom/ns#' term='ICS'/><title type='text'>Drag and Drop (Honeycomb/ICS)</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Drag and drop is already available with Honeycomb and up. In this example, we will see how to implement a simple Drag and Drop Operation.&lt;br /&gt;
&lt;br /&gt;
We have a ListView with some items. The other half of the screen would have a drop area which has a single &lt;a href="http://developer.android.com/reference/android/widget/TextView.html"&gt;TextView&lt;/a&gt;. We will see, how to drag items from the &lt;a href="http://developer.android.com/reference/android/widget/ListView.html"&gt;ListView&lt;/a&gt;, drop them into the drop area, which will update the &lt;a href="http://developer.android.com/reference/android/widget/TextView.html"&gt;TextView&lt;/a&gt; with the list item's title, and also, that particular item would be removed from the &lt;a href="http://developer.android.com/reference/android/widget/ListView.html"&gt;ListView&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
We will trigger the drag operation, when you long tap on an item in the ListView. After the drag operation is started, you will see a floating view of the selected item, which you can move around the screen. When you approach the drop area, the background of the drop area would change, which means that you can now drop your item. Once you leave the item, the TextView inside the drop area will show the text of the selected item.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-Z5LmFxAaVF4/Tq8cD1H7RPI/AAAAAAAADpM/bTT91_KMtxw/s1600/drag_drop_hc_1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="250" src="http://2.bp.blogspot.com/-Z5LmFxAaVF4/Tq8cD1H7RPI/AAAAAAAADpM/bTT91_KMtxw/s400/drag_drop_hc_1.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-XUv9NWijsPI/Tq8cE3hp6rI/AAAAAAAADpU/b4_7DviGiKk/s1600/drag_drop_hc_2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="250" src="http://2.bp.blogspot.com/-XUv9NWijsPI/Tq8cE3hp6rI/AAAAAAAADpU/b4_7DviGiKk/s400/drag_drop_hc_2.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-rWxZ3sK9Sh0/Tq8cGYD4NKI/AAAAAAAADpc/YpumZ3deL1Y/s1600/drag_drop_hc_3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="250" src="http://3.bp.blogspot.com/-rWxZ3sK9Sh0/Tq8cGYD4NKI/AAAAAAAADpc/YpumZ3deL1Y/s400/drag_drop_hc_3.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-JWgaK41ov9A/Tq8cHQYRMYI/AAAAAAAADpg/jmd2gr4GPX0/s1600/drag_drop_hc_4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="250" src="http://4.bp.blogspot.com/-JWgaK41ov9A/Tq8cHQYRMYI/AAAAAAAADpg/jmd2gr4GPX0/s400/drag_drop_hc_4.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
This should also work on Ice Cream Sandwich. You can find the whole &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn%2Ftrunk%2FHCDragDrop"&gt;source code here&lt;/a&gt;. The code is quite self-explanatory. But, if you have any queries, let me know through the comment form. There are a few comments in the code to help you.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-7223521547698986358?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/7223521547698986358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2011/10/drag-and-drop-honeycombics.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7223521547698986358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7223521547698986358'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2011/10/drag-and-drop-honeycombics.html' title='Drag and Drop (Honeycomb/ICS)'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-Z5LmFxAaVF4/Tq8cD1H7RPI/AAAAAAAADpM/bTT91_KMtxw/s72-c/drag_drop_hc_1.png' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-4467713618518475432</id><published>2011-10-18T15:49:00.000-07:00</published><updated>2011-10-24T11:40:37.481-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Custom Adapter'/><category scheme='http://www.blogger.com/atom/ns#' term='Compatibilty Package'/><category scheme='http://www.blogger.com/atom/ns#' term='ViewPager'/><category scheme='http://www.blogger.com/atom/ns#' term='Widgets'/><category scheme='http://www.blogger.com/atom/ns#' term='PagerAdapter'/><title type='text'>Simple ViewPager for Android</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
You would have seen many applications recently, which make use of the new and awesome &lt;b&gt;ViewPager&lt;/b&gt; that allows views to be horizontally scrollable. The new &lt;b&gt;Android Market&lt;/b&gt; app also implements a flavor of the ViewPager, although it's a little more complex that what we will see here. This class is not available directly for you to use. Check &lt;a href="http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html"&gt;this blog&lt;/a&gt; for some insight. It would required you to download a &lt;b&gt;compatibility library&lt;/b&gt; from Google, add it to your project wherever you would like to use it, and go about paging views.&lt;br /&gt;
&lt;br /&gt;
And yes, it's very simple to implement. I have coded up a little sample where it shows you how to use a &lt;b&gt;ViewPager&lt;/b&gt; with a simple &lt;b&gt;PagerAdapter&lt;/b&gt;. More or less, it works like the &lt;b&gt;ListViews&lt;/b&gt;. Although there is not much documentation for this, it's quite easy to set up everything.&lt;br /&gt;
&lt;br /&gt;
Firstly, you would need to add the ViewPager into your layout file.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Listing of main.xml&lt;/b&gt;&lt;br /&gt;
&lt;blockquote&gt;
&lt;b style="color: #990000;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;&amp;lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:orientation="vertical" android:layout_width="fill_parent"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_height="fill_parent"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextView android:text="Page 1" android:id="@+id/textViewHeader"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_width="fill_parent" android:layout_height="wrap_content"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:gravity="center" android:padding="10dip" android:textStyle="bold"&amp;gt;&amp;lt;/TextView&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;android.support.v4.view.ViewPager&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_width="fill_parent" android:layout_height="fill_parent"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:id="@+id/viewPager" /&amp;gt;&lt;br /&gt;&amp;lt;/LinearLayout&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
In this sample, we are using an extra TextView which would show the current page you are on.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Setting up the ViewPager&lt;/b&gt;&lt;br /&gt;
&lt;blockquote&gt;
&lt;div style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;MyPagerAdapter adapter = new MyPagerAdapter(this);&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style="color: #990000; font-size: x-small;"&gt;viewPager.setAdapter(adapter);&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
This code is almost identical to what we would do for a ListView or Gallery. The only difference is that the adapter here, extends a PagerAdapter instead.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;The PagerAdapter&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The PagerAdapter has a few methods that you would implement. For this example, I have four different views, one for each page. 2 are ListViews, a TextView and a Button, not in that order. Here are the methods that you would need to implement. Look at the &lt;b&gt;MyPageAdapter&lt;/b&gt; class for more.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
&lt;div style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;@Override&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;public void destroyItem(View view, int arg1, Object object) {&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((ViewPager) view).removeView((View)object);&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;}&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;@Override&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;public int getCount() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; return views.size();&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;}&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;@Override&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;public Object instantiateItem(View view, int position) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; View view = views.get(position);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; ((ViewPager) view).addView(view);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; return view;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;}&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;@Override&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="color: #990000;"&gt;
&lt;b&gt;&lt;span style="font-size: x-small;"&gt;public boolean isViewFromObject(View view, Object object) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; return view == object;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style="color: #990000; font-size: x-small;"&gt;}&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
&amp;nbsp;And you are done!!! Sweet.... You can find the whole &lt;a href="https://github.com/coomar2841/SimpleViewPager"&gt;source code here&lt;/a&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-4467713618518475432?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/4467713618518475432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2011/10/simple-viewpager-for-android.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/4467713618518475432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/4467713618518475432'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2011/10/simple-viewpager-for-android.html' title='Simple ViewPager for Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-2297910505729072060</id><published>2011-09-24T14:03:00.000-07:00</published><updated>2011-09-24T14:07:35.920-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ant'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Signing android apps'/><category scheme='http://www.blogger.com/atom/ns#' term='Automate'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='Signed apk'/><title type='text'>Automating Builds on Android - Part 2</title><content type='html'>In the previous post, &lt;a href="http://techdroid.kbeanie.com/2011/09/automating-builds-on-android-part-1.html"&gt;Automating Builds on Android - Part 1&lt;/a&gt;, we saw how to setup our projects to automate the build process. In this post, we will automate the process further to make Ant automatically use the passwords for our keystore and alias, label our builds to whatever name we like and put it in a specific location on your system (from where others can access it).&lt;br /&gt;
&lt;br /&gt;
1. To make Ant use the passwords for our keystore automatically, we will create a separate properties file in our project folder where. Let's name it "&lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/HelloWorldAnt/passwords.properties"&gt;passwords.properties&lt;/a&gt;". This file would contain two properties as listed below.&lt;br /&gt;
&lt;blockquote&gt;
&lt;b&gt;&lt;span style="color: purple;"&gt;key.store.password=sample&lt;/span&gt;&lt;br style="color: purple;" /&gt;&lt;span style="color: purple;"&gt;key.alias.password=sample&lt;/span&gt; &lt;/b&gt;&lt;/blockquote&gt;
2. We will need to make a small change in our &lt;b&gt;build.xml&lt;/b&gt; file to tell Ant to load this property file while building. To do this, we simply add this one line in the &lt;b&gt;build.xml&lt;/b&gt; file.&lt;br /&gt;
&lt;blockquote&gt;
&lt;b&gt;&lt;span style="color: purple;"&gt;&amp;lt;property file="passwords.properties" /&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
If you try to run &lt;b&gt;"ant release"&lt;/b&gt; command in your terminal, you will notice that Ant doesn't ask you to enter your passwords anymore. It has picked up the passwords from your &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/HelloWorldAnt/passwords.properties"&gt;passwords.properties&lt;/a&gt; file.&lt;br /&gt;
&lt;br /&gt;
3. Adding a name and a time-stamp to your builds while making a release build needs a little more effort. We will now create another properties file called "&lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/HelloWorldAnt/extras.properties"&gt;extras.properties&lt;/a&gt;". This file would contain two more properties as listed below.&lt;br /&gt;
&lt;blockquote&gt;
&lt;div style="color: purple;"&gt;
&lt;b&gt;file_name_format=test_build_hello_world&lt;/b&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style="color: purple;"&gt;build_location=C:/Builds/HelloWorld&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
The &lt;b&gt;file_name_format&lt;/b&gt; would be used to name your output builds. Sometimes, you would want to name your builds differently based on whether it is a "daily_build" or "weekly_build" or a "release_build". Instead of renaming the output file manually, you could just change this property accordingly just before your type in &lt;b&gt;"ant release"&lt;/b&gt;, and your builds would automatically be named as you like. The other property, &lt;b&gt;build_location&lt;/b&gt; is again a configurable value here, where Ant would put all your builds in the specified location. This could be a shared folder on your system from where anyone else can access it easily.&lt;br /&gt;
&lt;br /&gt;
4. Now comes the lengthy part. To accommodate these changes in our build process, our original &lt;b&gt;build.xml&lt;/b&gt; is not enough. We will have to tweak the actual underlying &lt;b&gt;build.xml&lt;/b&gt; to make our build process more streamlined. Let's see how to do it. Pick up the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/HelloWorldAnt/build.xml"&gt;build.xml from the sample project&lt;/a&gt; and replace the previous build.xml with this one. It will have a whole lot of Ant scripts. You don't have to worry about most of it, except for these lines.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
&lt;span style="font-size: small;"&gt;&lt;b&gt;&lt;span style="color: purple;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!-- Date/Time format for naming the file--&amp;gt;&lt;/span&gt;&lt;br style="color: purple;" /&gt;&lt;span style="color: purple;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;tstamp&amp;gt;&lt;/span&gt;&lt;br style="color: purple;" /&gt;&lt;span style="color: purple;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;format property="time" pattern="dd_MMM" /&amp;gt;&lt;/span&gt;&lt;br style="color: purple;" /&gt;&lt;span style="color: purple;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/tstamp&amp;gt;&lt;/span&gt;&lt;span style="color: purple;"&gt;&lt;/span&gt;&lt;br style="color: purple;" /&gt;&lt;span style="color: purple;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property file="local.properties" /&amp;gt;&lt;/span&gt;&lt;br style="color: purple;" /&gt;&lt;span style="color: purple;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property file="passwords.properties" /&amp;gt;&lt;/span&gt;&lt;br style="color: purple;" /&gt;&lt;span style="color: purple;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property file="extras.properties" /&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
Notice, that, we are using a time-stamp property which we would be using in our &lt;b&gt;build.xml&lt;/b&gt; to version our builds based on the specific format. Our builds will be names as &lt;b&gt;"test_build_hello_world_22_SEP.apk"&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
The last thing you need to change is this piece of code. You will find it somewhere in the new &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/HelloWorldAnt/build.xml"&gt;build.xml&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
&lt;span style="font-size: x-small;"&gt;&lt;b style="color: purple;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property name="out.release.file.name" value="${file_name_format}_${time}.apk" /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property name="out.release.file" location="${build_location}/${out.release.file.name}" /&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
5. Here, you can see that we have changed the property &lt;b&gt;"out.release.file.name"&lt;/b&gt; to a value that we want the output file to be named as. And also, we changed the &lt;b&gt;"out.release.file"&lt;/b&gt; to use our configured directory from the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/HelloWorldAnt/extras.properties"&gt;extras.properties&lt;/a&gt; file.&lt;br /&gt;
&lt;br /&gt;
The final step is to run &lt;b&gt;"ant release"&lt;/b&gt; for the last time, and you will see your final release build placed at your desired location.&lt;br /&gt;
&lt;br /&gt;
You can find the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn%2Ftrunk%2FHelloWorldAnt"&gt;sample project here&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-2297910505729072060?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/2297910505729072060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2011/09/automating-builds-on-android-part-2.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/2297910505729072060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/2297910505729072060'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2011/09/automating-builds-on-android-part-2.html' title='Automating Builds on Android - Part 2'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-9148315770744784988</id><published>2011-09-24T13:14:00.000-07:00</published><updated>2011-09-24T14:07:19.463-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ant'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Signing android apps'/><category scheme='http://www.blogger.com/atom/ns#' term='Automate'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='Signed apk'/><title type='text'>Automating Builds on Android - Part 1</title><content type='html'>Do you find it hard to get a release build of an Android app? Well, you could say that it's not at all difficult. It just takes about 1 minute to get a build, sign it with your release keys and you are done. For a typical moderately big Android app, you could have a QA process where you send out builds for testing or verification to someone else. And you could be sending out the builds multiple times a day. In such situations, it becomes a tad tedious getting release builds out of your eclipse. In this post, we will try to automate this process of preparing the release builds.&lt;br /&gt;
&lt;br /&gt;
Our tool of choice is Ant. Most of you perhaps already know how to do set it up. We will, however, also see how to version or auto-label your builds in next post. In this post, we will go through the basics.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1.&lt;/b&gt; To start off with, create a &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn%2Ftrunk%2FHelloWorldAnt"&gt;"HelloWorldAnt" Android project&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2.&lt;/b&gt; The next step is to prepare our project to use Ant scripts. To do this, fire up your terminal, go to the directory where your project rests and type out this command.&lt;br /&gt;
&lt;blockquote&gt;
&lt;b&gt;&lt;span style="color: purple;"&gt;android update project -p . &lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
3. A few files would be added to your project. Among these, the &lt;b&gt;build.xml&lt;/b&gt; is the file that Ant would read and package your apk.&lt;br /&gt;
&lt;blockquote&gt;
&lt;div style="color: purple;"&gt;
&lt;b&gt;Updated local.properties&lt;/b&gt;&lt;/div&gt;
&lt;div style="color: purple;"&gt;
&lt;b&gt;Added file ./build.xml&lt;/b&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style="color: purple;"&gt;Updated file ./proguard.cfg&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
4. Now try running this command in the terminal. After we setup everything, this is the one single command that we would run every time we need to create a release build.&lt;br /&gt;
&lt;blockquote&gt;
&lt;b&gt;&lt;span style="color: purple;"&gt;ant release&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
5. You will see a long log of what Ant is doing. Look towards the end of the logs and you will notice these lines:&lt;br /&gt;
&lt;blockquote&gt;
&lt;div style="color: purple;"&gt;
&lt;b&gt;-release-nosign:&lt;/b&gt;&lt;/div&gt;
&lt;div style="color: purple;"&gt;
&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [echo] No key.store and key.alias properties found in build.properties.&lt;/b&gt;&lt;/div&gt;
&lt;div style="color: purple;"&gt;
&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [echo] Please sign /workspace/HelloWorldAnt/bin/HelloWorldAntActivity-unsigned.apk manually&lt;/b&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style="color: purple;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [echo] and run zipalign from the Android SDK tools. &lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
&lt;br /&gt;
6. So, till this point, the Ant tool has prepared an &lt;b&gt;unsigned apk&lt;/b&gt; which it has kept in the bin folder of your project and it asks you to manually sign this apk with your release keys. Next step is to automate this process.&lt;br /&gt;
&lt;br /&gt;
7. Put your keystore inside your project folder. For this project, &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/HelloWorldAnt/sample_keystore"&gt;&lt;b&gt;sample_keystore&lt;/b&gt;&lt;/a&gt; is the keystore that we would be using to sign this application. Now, we need to tell Ant to use this keystore to sign our builds with. Here, we will add a few files to our project.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Filename: &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/HelloWorldAnt/build.properties"&gt;build.properties&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;File Listing:&lt;/b&gt;&lt;br /&gt;
&lt;blockquote&gt;
&lt;b&gt;&lt;span style="color: purple;"&gt;key.store=sample_keystore&lt;/span&gt;&lt;br style="color: purple;" /&gt;&lt;span style="color: purple;"&gt;key.alias=samplekeystore&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
&amp;nbsp;8. At this point, if you try running &lt;b&gt;"ant release"&lt;/b&gt; command, it will ask you to enter the password for the keystore and the alias name, and finally, it would put the release and signed builds in your bin folder.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
The next post will talk about customizing the build process to the next level.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://techdroid.kbeanie.com/2011/09/automating-builds-on-android-part-2.html"&gt;Automating Builds on Android - Part 2&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn%2Ftrunk%2FHelloWorldAnt"&gt;You can find the sample project here. &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-9148315770744784988?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/9148315770744784988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2011/09/automating-builds-on-android-part-1.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/9148315770744784988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/9148315770744784988'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2011/09/automating-builds-on-android-part-1.html' title='Automating Builds on Android - Part 1'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-2362315829849160952</id><published>2011-07-14T12:45:00.000-07:00</published><updated>2011-07-14T13:08:34.487-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Animations'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='examples'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><title type='text'>Flip animation in Android</title><content type='html'>&lt;div style="text-align: center;"&gt;
&lt;span style="font-size: large;"&gt;I love animations. Let's see the video first. If you are excited, go peek at the code.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;object width="320" height="266" class="BLOG_video_class" id="BLOG_video-e2eec46f6f35dcec" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;&lt;param name="movie" value="http://www.youtube.com/get_player"&gt;
&lt;param name="bgcolor" value="#FFFFFF"&gt;
&lt;param name="allowfullscreen" value="true"&gt;
&lt;param name="flashvars" value="flvurl=http://v12.nonxt7.googlevideo.com/videoplayback?id%3De2eec46f6f35dcec%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1330379288%26sparams%3Did,itag,ip,ipbits,expire%26signature%3D8A54913BD73E6525297D5E191B723DBD551A7CF.49C7116CA5120CD6FAF7ED2CF7538465AD9072E8%26key%3Dck1&amp;amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3De2eec46f6f35dcec%26offsetms%3D5000%26itag%3Dw160%26sigh%3DtiBUhBBkK15uqBXU2iualnLm0tk&amp;amp;autoplay=0&amp;amp;ps=blogger"&gt;
&lt;embed src="http://www.youtube.com/get_player" type="application/x-shockwave-flash"
width="320" height="266" bgcolor="#FFFFFF"
flashvars="flvurl=http://v12.nonxt7.googlevideo.com/videoplayback?id%3De2eec46f6f35dcec%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1330379288%26sparams%3Did,itag,ip,ipbits,expire%26signature%3D8A54913BD73E6525297D5E191B723DBD551A7CF.49C7116CA5120CD6FAF7ED2CF7538465AD9072E8%26key%3Dck1&amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3De2eec46f6f35dcec%26offsetms%3D5000%26itag%3Dw160%26sigh%3DtiBUhBBkK15uqBXU2iualnLm0tk&amp;autoplay=0&amp;ps=blogger"
allowFullScreen="true" /&gt;&lt;/object&gt;
&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
In this example, the main layout contains two &lt;a href="http://developer.android.com/reference/android/widget/ImageView.html"&gt;ImageView&lt;/a&gt; widgets with two different images that are to be animated. The image views actually overlapp each other, at first, but as the animation starts, only one of them is visible at a time, while the other is invisible.&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: left;"&gt;
For the animation, we are using a &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/FlipAnimatorExample/src/com/beanie/examples/animation/FlipAnimator/FlipAnimator.java"&gt;FlipAnimator&lt;/a&gt; class, which extends the &lt;a href="http://developer.android.com/reference/android/view/animation/Animation.html"&gt;Animation&lt;/a&gt; class. Here is how we need to initialize and setup the animation.&lt;/div&gt;
&lt;blockquote&gt;
&lt;div style="text-align: left;"&gt;
&lt;i style="color: #b45f06;"&gt;&lt;b&gt;FlipAnimator animator = new FlipAnimator(imageViewOriginal, imageViewFlip,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; imageViewFlip.getWidth() / 2, imageViewFlip.getHeight() / 2);&lt;br /&gt;&amp;nbsp;if (imageViewOriginal.getVisibility() == View.GONE) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; animator.reverse();&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;layout.startAnimation(animator);&lt;/b&gt; &lt;/i&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&amp;nbsp;There is a small check to tell the animator where to reverse the animation. This is not the perfect way, but you will get an idea. To initialize the animator, you will need to pass the original view and the flipped view and the x and y position of the axes about which it will be flipped.&lt;br /&gt;
&lt;br /&gt;
The animator, internally uses a &lt;a href="http://developer.android.com/reference/android/view/animation/AccelerateDecelerateInterpolator.html"&gt;AccelerateDecelerateInterpolator&lt;/a&gt;.&lt;br /&gt;
&lt;i&gt;"An interpolator where the rate of change starts and ends slowly but
 accelerates through the middle."&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The main logic of the animation is written inside this method:&lt;br /&gt;
&lt;i&gt;&lt;a href="http://developer.android.com/reference/android/view/animation/Animation.html#applyTransformation%28float,%20android.view.animation.Transformation%29"&gt;protected void applyTransformation(float interpolatedTime, Transformation t)&lt;/a&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;You can find the whole &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn%2Ftrunk%2FFlipAnimatorExample%253Fstate%253Dclosed"&gt;source code here&lt;/a&gt;.&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;References:&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;a href="http://www.inter-fuser.com/2009/08/android-animations-3d-flip.html"&gt;http://www.inter-fuser.com/2009/08/android-animations-3d-flip.html&lt;/a&gt;&amp;nbsp;&lt;i&gt; &lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-2362315829849160952?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/2362315829849160952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2011/07/flip-animation-in-android.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/2362315829849160952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/2362315829849160952'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2011/07/flip-animation-in-android.html' title='Flip animation in Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-2938453992424069192</id><published>2011-07-10T12:35:00.000-07:00</published><updated>2011-07-10T12:35:56.070-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Intents'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='examples'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><title type='text'>Understanding Intents and Intent-Filters in Android</title><content type='html'>&lt;a href="http://developer.android.com/reference/android/content/Intent.html"&gt;Intents&lt;/a&gt; or &lt;a href="http://developer.android.com/reference/android/content/Intent.html"&gt;Intent&lt;/a&gt; messaging is the Android’s way to pass messages/information to various components of Android. An &lt;a href="http://developer.android.com/reference/android/content/Intent.html"&gt;Intent&lt;/a&gt; object contains information that the target component can act upon. Through &lt;a href="http://developer.android.com/reference/android/content/Intent.html"&gt;Intents&lt;/a&gt;, your apps can trigger &lt;a href="http://developer.android.com/reference/android/app/Activity.html"&gt;Activities&lt;/a&gt;, &lt;a href="http://developer.android.com/reference/android/app/Service.html"&gt;Services&lt;/a&gt; and &lt;a href="http://developer.android.com/guide/topics/manifest/receiver-element.html"&gt;Broadcast Receivers&lt;/a&gt;.
 The most common use of intents in any application is to directly launch
 an Activity or Service to perform action on the data being passed with 
the Intent object.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;A sample use of Intent is shown in the following example.&lt;/b&gt;&lt;br /&gt;
&lt;i&gt;1. To launch an Activity&lt;/i&gt;&lt;br /&gt;
&lt;blockquote&gt;
&lt;pre style="color: #b45f06;"&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;&lt;b&gt;Intent intent = new Intent(context, TagetActivity.class);
startActivity(intent);&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;i&gt;2. To launch a Service&lt;/i&gt;&lt;br /&gt;
&lt;blockquote style="color: #b45f06;"&gt;
&lt;pre&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;&lt;b&gt;Intent intent = new Intent(context, TargetService.class);
startService(intent);&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
To pass some data within your intents you need pass them within the Intent object like this.&lt;br /&gt;
&lt;blockquote style="color: #b45f06;"&gt;
&lt;pre&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;&lt;b&gt;intent.put(key, value);&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
This way you can pass basic data-types that are supported by the 
Intent class. In these examples, we are specifying the component names 
explicitly, i.e, TagetActivity activity and TargetService service. These
 intents are examples of &lt;a href="http://developer.android.com/guide/topics/intents/intents-filters.html#ires"&gt;Explicit Intents&lt;/a&gt; wherein you specify the target component that you want to handle your data.&lt;br /&gt;
&lt;br /&gt;
There would be situations where you would want the user to choose the
 target component, or to put in another way, the target component is 
determined dynamically at run-time depending on various factors. For an 
example, you would like to write a E-Mail app. The basic requirement 
would be that whenever a user clicks on an e-mail address, your app 
should be triggered, and it should be designed to capture the e-mail 
address that was clicked. This is where, &lt;a href="http://developer.android.com/guide/topics/intents/intents-filters.html#ires"&gt;Implicit Intents&lt;/a&gt;
 come into picture. Since, the e-mail address link that the user clicks 
on might not necessarily be a part of your application, you do not have 
the privilege of launching your Compose Activity on the click event of 
the link. What would you do in such a case?&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What happens when the e-mail link is clicked?&lt;/b&gt;&lt;br /&gt;
When an email link is clicked, the app would create an Implicit Intent 
setting it up with the proper data and broadcast it. Something like 
this:&lt;br /&gt;
&lt;blockquote style="color: #b45f06;"&gt;
&lt;pre&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;&lt;b&gt;Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.put(Intent.EXTRA_EMAIL, {email addresses}];
startActivity(intent);&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
In the above code snippet, we can see that the Intent here doesn’t 
specify the component name. However, it specifies an action and the list
 of email addresses. For this example, we just need to pass a string 
array with just one email address that the user has clicked on.&lt;br /&gt;
&lt;br /&gt;
How would Android know which activity should be launched (or service 
for example). In such cases, Android tries to find the best match, i.e, 
the component that can handle such a payload. In case it finds multiple 
components, it gives the user a choice to make. For instance, if you 
have multiple email clients installed and all of them can handle such 
type of Intents, the user gets a list of all these apps (see image). He 
can then select one which would launch that particular component 
(Activity for this example). If it fails to find any components to 
handle this Intent, an exception will be thrown (&lt;a href="http://developer.android.com/reference/android/content/ActivityNotFoundException.html"&gt;ActivityNotFoundException&lt;/a&gt;
 in this case). Here we have two email applications that can handle this
 intent. The user is given a choice to select one of them when an e-mail
 link is clicked. Depending on the user’s choice, the corresponding 
activity will be launched.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
How do we write an Activity that can handle such Intents?&lt;/b&gt;&lt;br /&gt;
We have to specify or rather design one of our activity, the compose 
screen of our email client that can handle such intents. For that, we 
need to specify Intent-Filters for this specific activity in the &lt;a href="http://developer.android.com/guide/topics/manifest/manifest-intro.html"&gt;AndroidManifest.xml&lt;/a&gt; file.&lt;br /&gt;
&lt;blockquote&gt;
&lt;span style="font-size: small;"&gt;&lt;i&gt;&lt;b&gt;&lt;span style="color: #b45f06;"&gt;&amp;lt;activity android:name=".ComposeActivity"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:label="@string/app_name"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;intent-filter android:label="@string/app_name"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;action android:name="android.intent.action.SEND" /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;data android:scheme="mailto" /&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;category android:name="android.intent.category.DEFAULT"/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/intent-filter&amp;gt;&lt;br /&gt;&amp;lt;/activity&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;
The above code itself is self-explanatory. Your activity now can handle 
intents that are launched with this signature. The action is “&lt;a href="http://developer.android.com/reference/android/content/Intent.html#ACTION_SEND"&gt;android.intent.action.ACTION_SEND&lt;/a&gt;”
 and the data scheme is “mailto”, i.e, any email address. So, in your 
ComposeActivity, you can retrieve the email address list by querying the
 intent for the key, &lt;a href="http://developer.android.com/reference/android/content/Intent.html#EXTRA_EMAIL"&gt;EXTRA_EMAIL&lt;/a&gt;
 and you will get the list of email addresses (one in this case). 
Typically, you will need to populate the Send To address field of your 
ComposeActivity now.&lt;br /&gt;
&lt;br /&gt;
The intent resolution process tries to find a best match for the intent.
 Once it finds an Intent and launches the Activity with or without user 
interruption(in case multiple matches are found), the responsibility of 
handling the intent now lies with the target component. To finish off 
the article, here is the way to extract the email address that had been 
clicked.&lt;br /&gt;
&lt;blockquote style="color: #b45f06;"&gt;
&lt;pre&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;&lt;b&gt;Bundle data = getIntent().getExtras();
String[] emailAddresses = data.get(Intent.EXTRA_EMAIL);&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
The &lt;a href="http://developer.android.com/guide/topics/intents/intents-filters.html"&gt;developer docs&lt;/a&gt;
 on Intent, Intent Filters and Intent Resolution mechanism is a nice 
read to understand the Intent mechanism of Android. You can find other 
examples of the types of data and schemes that you can design your apps 
for.&amp;nbsp;&lt;i&gt;&lt;/i&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-2938453992424069192?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/2938453992424069192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2011/07/understanding-intents-and-intent.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/2938453992424069192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/2938453992424069192'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2011/07/understanding-intents-and-intent.html' title='Understanding Intents and Intent-Filters in Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-8117510989760296906</id><published>2011-07-05T10:18:00.000-07:00</published><updated>2011-09-26T11:17:30.271-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Apps'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='examples'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='GUI'/><category scheme='http://www.blogger.com/atom/ns#' term='Custom Widgets'/><title type='text'>Custom title for your apps</title><content type='html'>The default title bar for the apps might not suit the theme of your app.  You also might want to add a few more things to the title bar which the  default title bar doesn’t help you with. This example will help you  develop your own Title Widget which you can directly embed in your  layouts containing a left icon, a title text and a progress bar. You can  also control the contents of these three widgets and change it as  required in your activities. Here we go.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1.&lt;/b&gt; &lt;b&gt;The first thing you should do is to switch off the default title.&lt;/b&gt; You can do this easily by specifying in your &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/TitleWidgetSample/AndroidManifest.xml" target="_blank"&gt;AndroidManifest.xml&lt;/a&gt; file that do not intend to use it. &lt;br /&gt;
&lt;br /&gt;
&lt;blockquote style="color: #b45f06;"&gt;
&lt;span style="font-size: small;"&gt;&lt;i&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;
&amp;lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;package="com.beanie.samples.titlewidget" android:versionCode="1"&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;android:versionName="1.0"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;application android:icon="@drawable/icon" android:label="@string/app_name"&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;android:theme="@android:style/Theme.NoTitleBar"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;activity android:name=".TitleWidgetActivity"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:label="@string/app_name"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;intent-filter&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;action android:name="android.intent.action.MAIN" /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;category android:name="android.intent.category.LAUNCHER" /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;/intent-filter&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;/activity&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;/application&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;uses-sdk android:minSdkVersion="4" /&amp;gt;&lt;br /&gt;
&amp;lt;/manifest&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;
Here, in the application tag, set the theme of your app to use the &lt;b&gt;NoTitleBar&lt;/b&gt; theme.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2.&lt;/b&gt; Create a &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/TitleWidgetSample/res/layout/title_widget.xml" target="_blank"&gt;title_widget.xml&lt;/a&gt;  which would be the custom layout for your title bar. You can  technically add any number of widgets here and finally display it with  your custom title. As an example, we will add an &lt;a href="http://developer.android.com/reference/android/widget/ImageView.html" target="_blank"&gt;ImageView&lt;/a&gt;, a &lt;a href="http://developer.android.com/reference/android/widget/TextView.html" target="_blank"&gt;TextView&lt;/a&gt; and a &lt;a href="http://developer.android.com/reference/android/widget/ProgressBar.html" target="_blank"&gt;ProgressBar&lt;/a&gt; here.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3.&lt;/b&gt; Create a &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/TitleWidgetSample/src/com/beanie/samples/titlewidget/TitleWidget.java" target="_blank"&gt;TitleWidget.java&lt;/a&gt;  class which extends LinearLayout(you can use any Layout) which loads  this layout file and exposes methods to modify the contents of the  widgets.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;4.&lt;/b&gt; Add the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/TitleWidgetSample/src/com/beanie/samples/titlewidget/TitleWidget.java" target="_blank"&gt;TitleWidget&lt;/a&gt; class as the first view in all your activity layouts’ files to display your custom title bar.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote style="color: #b45f06;"&gt;
&lt;pre&gt;&lt;i&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;LinearLayout 
&amp;nbsp;xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical" android:layout_width="fill_parent"
 android:layout_height="fill_parent"&amp;gt;
 &amp;lt;com.beanie.samples.titlewidget.TitleWidget
android:id="@+id/titleWidget"
  android:layout_width="fill_parent"
android:layout_height="wrap_content"&amp;gt;
 &amp;lt;/com.beanie.samples.titlewidget.TitleWidget&amp;gt;
&amp;lt;/LinearLayout&amp;gt;&lt;/i&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;b&gt;5.&lt;/b&gt; Now, in your activity, you can initialize this  TitleWidget as any view, since it is a LinearLayout now, and can control  the contents of all the widgets.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote style="color: #b45f06;"&gt;
&lt;pre&gt;&lt;i&gt;    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        // Initialize title Widget
        TitleWidget titleWidget = (TitleWidget)&lt;/i&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;blockquote style="color: #b45f06;"&gt;
&lt;pre&gt;&lt;i&gt;                             findViewById(R.id.titleWidget);

        // Call the methods to change the underlying widgets
        titleWidget.setTitle("My Custom Title");
        titleWidget.setIcon(R.drawable.icon);
        titleWidget.showProgressBar();
        titleWidget.hideProgressBar();
    }&lt;/i&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-Th_sycSOr8M/ThNGOdG5ZnI/AAAAAAAAC8E/ol65j_t60Do/s1600/custom_title_bar.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="86" src="http://2.bp.blogspot.com/-Th_sycSOr8M/ThNGOdG5ZnI/AAAAAAAAC8E/ol65j_t60Do/s320/custom_title_bar.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Now you have your own custom title. On the surface, it doesn’t  actually feel like a title bar, and yes, it isn’t. It’s just a custom  view, that you are trying to make it look like a title bar. Remember!!  We switched off the titles by specifying that our app’s theme to  “NoTitleBar”. &lt;img alt=":)" class="wp-smiley" src="http://castlerockresearch.in/blog/dev/wp-includes/images/smilies/icon_smile.gif" /&gt; &lt;br /&gt;
You can find the whole &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn/trunk/TitleWidgetSample" target="_blank"&gt;source code here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-8117510989760296906?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/8117510989760296906/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2011/07/custom-title-for-your-apps.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/8117510989760296906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/8117510989760296906'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2011/07/custom-title-for-your-apps.html' title='Custom title for your apps'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-Th_sycSOr8M/ThNGOdG5ZnI/AAAAAAAAC8E/ol65j_t60Do/s72-c/custom_title_bar.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-7276655422161794051</id><published>2011-06-24T03:42:00.000-07:00</published><updated>2011-06-24T17:18:30.992-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='examples'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><title type='text'>Simple canvas-based Ball game</title><content type='html'>This is a small project that does this.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;i style="color: #38761d;"&gt;"On your phone's screen, you will have a ball lying at the bottom part, in the middle. Once you touch any part of the screen, the ball starts moving in that direction. It continues to move till it hits one of the walls, bounces off the wall, and keeps moving. Depending on the point of touch, the ball will hit the left/right walls a few times, before it eventually escapes out of the view when it crosses the upper boundary." &lt;/i&gt;&lt;/blockquote&gt;&amp;nbsp;Not super fancy stuff or algorithms. You can find the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn%2Ftrunk%2Fsample_ball_game"&gt;source code here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-lpNmD7Hgpgs/TgRp2tKh4LI/AAAAAAAAC4c/NPP5DUvUmlg/s1600/sample_ball_game_android.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://2.bp.blogspot.com/-lpNmD7Hgpgs/TgRp2tKh4LI/AAAAAAAAC4c/NPP5DUvUmlg/s400/sample_ball_game_android.png" width="270" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-7276655422161794051?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/7276655422161794051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2011/06/simple-canvas-based-ball-game.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7276655422161794051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7276655422161794051'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2011/06/simple-canvas-based-ball-game.html' title='Simple canvas-based Ball game'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-lpNmD7Hgpgs/TgRp2tKh4LI/AAAAAAAAC4c/NPP5DUvUmlg/s72-c/sample_ball_game_android.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-1846942223278916156</id><published>2011-06-03T12:28:00.000-07:00</published><updated>2012-01-05T20:26:00.081-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='2.3'/><category scheme='http://www.blogger.com/atom/ns#' term='Audio'/><category scheme='http://www.blogger.com/atom/ns#' term='MediaPlayer'/><category scheme='http://www.blogger.com/atom/ns#' term='Gingerbread'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Streaming'/><category scheme='http://www.blogger.com/atom/ns#' term='examples'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='Radio'/><category scheme='http://www.blogger.com/atom/ns#' term='2.2'/><title type='text'>Streaming Radio Stations on Android</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Streaming radio stations or audio files hosted on streaming servers on Android is pretty straight-forward. But then, Android has it's limitations. It won't stream just any file or radio station. In this post, I would not be specifying the formats or protocols that Android supports. Rather, this example is just a walk through of how the &lt;a href="http://developer.android.com/reference/android/media/MediaPlayer.html"&gt;MediaPlayer&lt;/a&gt; class should be used to stream audio files/radio stations.&lt;br /&gt;
&lt;br /&gt;
For an example here, I have used a &lt;a href="http://www.shoutcast.com/"&gt;SHOUTcast&lt;/a&gt; radio station. The URL for the source is:&lt;br /&gt;
&lt;a href="http://shoutcast2.omroep.nl:8104/"&gt;http://shoutcast2.omroep.nl:8104/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The accompanying sample project contains a ProgressBar, two Buttons (for playing and stopping the &lt;a href="http://developer.android.com/reference/android/media/MediaPlayer.html"&gt;MediaPlayer&lt;/a&gt;).&lt;br /&gt;
&lt;br /&gt;
Before running the example, one should look into the documentation of the &lt;a href="http://developer.android.com/reference/android/media/MediaPlayer.html"&gt;MediaPlayer &lt;/a&gt;class. A look at the state diagram would perhaps help you clear to understand how it actually works.&lt;br /&gt;
&lt;br /&gt;
To initialize the MediaPlayer, you need a few lines of code. There you go:&lt;br /&gt;
&lt;blockquote&gt;
&lt;div style="color: #b45f06;"&gt;
&lt;i&gt;&lt;b&gt;&lt;span style="font-size: x-small;"&gt;MediaPlayer player = new MediaPlayer();&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;
&lt;i&gt;&lt;b&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="color: #b45f06;"&gt;player.setDataSource("http://shoutcast2.omroep.nl:8104/");&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;/blockquote&gt;
Now that the MediaPlayer object is initialized, you are ready to start streaming. Ok, not actually. You will need to issue the MediaPlayer's prepare command. There are 2 variations of this.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="http://developer.android.com/reference/android/media/MediaPlayer.html#prepare%28%29"&gt;prepare()&lt;/a&gt;: This is a synchronous call, which is blocked until the MediaPlayer object gets into the prepared state. This is okay if you are trying to play local files that would take the MediaPlayer longer, else your main thread will be blocked.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developer.android.com/reference/android/media/MediaPlayer.html#prepareAsync%28%29"&gt;prepareAsync()&lt;/a&gt;: This is, as the name suggests, an asynchronous call. It returns immediately. But, that obvisouly, doesn't mean that the MediaPlayer is prepared yet. You will still have to wait for it to get into the prepared state, but since this method will not block your main thread, you can use this method when you are trying to stream some content from somewhere else. You will get a callback, when the MediaPlayer is ready through onPrepared(MediaPlayer mp) method, and then, the playing can start.&lt;/li&gt;
&lt;/ol&gt;
So, for our example, the best choice would be:&lt;br /&gt;
&lt;blockquote&gt;
&lt;i style="color: #b45f06;"&gt;&lt;b&gt;&lt;span style="font-size: x-small;"&gt;player.prepareAsync();&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;/blockquote&gt;
You need to attach a listener to the MediaPlayer to receive the callback when it is prepared. This is the code for that.&lt;br /&gt;
&lt;blockquote style="color: #b45f06;"&gt;
&lt;span style="font-size: x-small;"&gt;&lt;i&gt;&lt;b&gt;player.setOnPreparedListener(new OnPreparedListener(){&lt;/b&gt;&lt;/i&gt;&lt;/span&gt; &lt;/blockquote&gt;
&lt;blockquote style="color: #b45f06;"&gt;
&lt;span style="font-size: x-small;"&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void onPrepared(MediaPlayer mp) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; player.start();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote style="color: #b45f06;"&gt;
&lt;span style="font-size: x-small;"&gt;&lt;i&gt;&lt;b&gt;});&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;
Once, it goes into the prepared state, you can now &lt;b&gt;start playing&lt;/b&gt;. Simple???? Yes, of course. Just to wrap it up, to stop the MediaPlayer, you need to call the &lt;a href="http://developer.android.com/reference/android/media/MediaPlayer.html#stop%28%29"&gt;stop()&lt;/a&gt; method.&lt;br /&gt;
&lt;br /&gt;
There are several other helper methods which lets you query the progress or status of the player. Jump to the docs page and you will find more information on them. You can &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn%2Ftrunk%2FStreamingRadio"&gt;checkout the source code here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="color: red;"&gt;
&lt;span style="font-size: x-small;"&gt;&lt;i&gt;&lt;b&gt;Project source for the new Eclipse + Android tool chain. &lt;a href="http://code.google.com/p/myandroidwidgets/downloads/detail?name=StreamingRadio.zip"&gt;Download here&lt;/a&gt;.&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style="color: red; font-size: x-small;"&gt;&lt;i&gt;&lt;b&gt;NOTE: This sample project is tested on Gingerbread(2.3) and should work on Froyo(2.2) and above.&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-1846942223278916156?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/1846942223278916156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2011/06/streaming-radio-stations-on-android.html#comment-form' title='25 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/1846942223278916156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/1846942223278916156'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2011/06/streaming-radio-stations-on-android.html' title='Streaming Radio Stations on Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>25</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-7751750546596559974</id><published>2011-05-04T17:19:00.000-07:00</published><updated>2011-05-04T17:19:29.781-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='2.3'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><title type='text'>Sensors to Handle on Nexus S</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-P5p1QZIVLCQ/TcHslfQXEAI/AAAAAAAAC2o/UOR2b9RTqMo/s1600/Sensors+on+Nexus+S.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://3.bp.blogspot.com/-P5p1QZIVLCQ/TcHslfQXEAI/AAAAAAAAC2o/UOR2b9RTqMo/s400/Sensors+on+Nexus+S.png" width="240" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
So many sensors to sense!!! Hmm, I don't yet know if there are appropriate APIs available yet on Gingerbread to access all these sensors. Got to read up now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-7751750546596559974?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/7751750546596559974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2011/05/sensors-to-handle-on-nexus-s.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7751750546596559974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7751750546596559974'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2011/05/sensors-to-handle-on-nexus-s.html' title='Sensors to Handle on Nexus S'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-P5p1QZIVLCQ/TcHslfQXEAI/AAAAAAAAC2o/UOR2b9RTqMo/s72-c/Sensors+on+Nexus+S.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-5598990156639793354</id><published>2011-04-08T15:07:00.000-07:00</published><updated>2011-04-08T15:08:35.478-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclair UI'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='Widgets'/><category scheme='http://www.blogger.com/atom/ns#' term='examples'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Hacks'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='GUI'/><category scheme='http://www.blogger.com/atom/ns#' term='Custom Widgets'/><title type='text'>Using Custom fonts on Android</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-TXjapEK6xKE/TZ-DLL7bkcI/AAAAAAAAC18/HMbca8GK8xs/s1600/custom_fonts_android.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="199" src="http://1.bp.blogspot.com/-TXjapEK6xKE/TZ-DLL7bkcI/AAAAAAAAC18/HMbca8GK8xs/s320/custom_fonts_android.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;I had to do this for a project that I am working on, and I felt that it wasn't possible to achieve this. Well, there are several examples on the internet regarding this and nothing seemed to be working for me. So, in this post, we will see how to use custom fonts for your application on Android.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Few things before we start off:&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Not all fonts are compatible with Android &lt;/li&gt;
&lt;li&gt;You need to package the ttf files with your apk&lt;/li&gt;
&lt;li&gt;It's obviously a little bit of extra work&lt;/li&gt;
&lt;/ul&gt;So for this example, we have a &lt;a href="http://developer.android.com/reference/android/widget/TextView.html"&gt;TextView&lt;/a&gt; and a &lt;a href="http://developer.android.com/reference/android/widget/Button.html"&gt;Button&lt;/a&gt; with different fonts. To be able to use your custom font everywhere, ie, on all the TextView and Button widgets in your app, you will have to extend these classes to create your own TextView and Button classes. I have named them as &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/CustomFont/src/com/beanie/samples/customfont/MyTextView.java"&gt;MyTextView&lt;/a&gt; and &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/CustomFont/src/com/beanie/samples/customfont/MyButton.java"&gt;MyButton&lt;/a&gt;. And then, I can use these buttons in my layout xml files, with the fully-qualified name of my custom classes.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;&amp;lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:orientation="vertical" android:layout_width="fill_parent"&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_height="fill_parent"&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;com.beanie.samples.customfont.MyTextView&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_marginTop="10dip" android:id="@+id/textView"&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_width="fill_parent" android:layout_height="wrap_content"&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:text="@string/hello" android:textSize="20sp"&amp;gt;&amp;lt;/com.beanie.samples.customfont.MyTextView&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;com.beanie.samples.customfont.MyButton&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_marginTop="10dip" android:id="@+id/textView"&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_width="fill_parent" android:layout_height="wrap_content"&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:text="@string/hello" android:textSize="20sp"&amp;gt;&amp;lt;/com.beanie.samples.customfont.MyButton&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;&amp;lt;/LinearLayout&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;In both these classes, we have a method called &lt;span style="font-size: large;"&gt;&lt;b&gt;init()&lt;/b&gt;&lt;/span&gt; which is called from all the constructors. The method is just 3 line long.&lt;br /&gt;
&lt;blockquote&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;&amp;nbsp;&lt;span style="font-size: x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;&lt;span style="color: blue;"&gt;if (!isInEditMode()) {&lt;/span&gt;&lt;br style="color: blue;" /&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/ds_digib.ttf");&lt;/span&gt;&lt;br style="color: blue;" /&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setTypeface(tf);&lt;/span&gt;&lt;br style="color: blue;" /&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;Simple!!! You might notice that there is an if condition. This is not required, but it does help when you are preparing your layouts on eclipse, and you need to keep checking if everything's fine. This method, &lt;a href="http://developer.android.com/reference/android/view/View.html#isInEditMode%28%29"&gt;isInEditMode()&lt;/a&gt; returns true while eclipses tries to render the view from the XML.&lt;br /&gt;
&lt;br /&gt;
This is what the documentation says:&lt;br /&gt;
&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;span style="color: black;"&gt;&lt;span style="color: #351c75;"&gt;Indicates whether this View is currently in edit mode. A View is usually  in edit mode when displayed within a developer tool. For instance, if  this View is being drawn by a visual user interface builder, this  method  should return true.   Subclasses should check the return value of this method to provide  different behaviors if their normal behavior might interfere with the  host environment. For instance: the class spawns a thread in its  constructor, the drawing code relies on device-specific features, etc.   This method is usually checked in the drawing code of custom widgets. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;If you don't put this condition, the layout editor will complain about not being able to set the TypeFace. So, in the layout editor, you will see your TextView and Button widgets with the default font. But, when you run your app on an emulator or a device, you can see the goodness of your custom fonts. &lt;br /&gt;
&lt;br /&gt;
The source code for the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn%2Ftrunk%2FCustomFont%253Fstate%253Dclosed"&gt;sample project can be found here&lt;/a&gt;. You can find 3 different fonts (ttf file) in the assets folder to play with.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-5598990156639793354?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/5598990156639793354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2011/04/using-custom-fonts-on-android.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/5598990156639793354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/5598990156639793354'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2011/04/using-custom-fonts-on-android.html' title='Using Custom fonts on Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-TXjapEK6xKE/TZ-DLL7bkcI/AAAAAAAAC18/HMbca8GK8xs/s72-c/custom_fonts_android.png' height='72' width='72'/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-4499456189749468029</id><published>2011-04-03T14:34:00.000-07:00</published><updated>2011-04-03T14:37:31.817-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Widgets'/><category scheme='http://www.blogger.com/atom/ns#' term='examples'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='UI'/><category scheme='http://www.blogger.com/atom/ns#' term='GUI'/><category scheme='http://www.blogger.com/atom/ns#' term='Custom Widgets'/><title type='text'>Inverted Android Button</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-Ne5ZNdfjVYI/TZjjXVcjouI/AAAAAAAAC1M/8vpOep-r_zE/s1600/inverted_button_android.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-Ne5ZNdfjVYI/TZjjXVcjouI/AAAAAAAAC1M/8vpOep-r_zE/s1600/inverted_button_android.png" /&gt;&lt;/a&gt;&lt;/div&gt;Nothing complex. Just a few lines of code to invert your button. A horizontal flip of 180 degrees is pretty simple to achieve. If you want it with a specific angle, it might be a bit tricky.&lt;br /&gt;
&lt;br /&gt;
Lets start with a creating a custom button class that extends the android &lt;a href="http://developer.android.com/reference/android/widget/Button.html"&gt;Button&lt;/a&gt; class. Name it as &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/Inverted_Button/src/com/beanie/examples/invertedbutton/InvertedButton.java"&gt;InvertedButton.java&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
You will need to override it's onDraw() method to rotate the canvas, so that before any drawing is done, you rotate it by 180 degrees. To make the text-alignment perfect, you will also need to do a few calculations.&lt;br /&gt;
&lt;blockquote&gt;&lt;span style="font-size: x-small;"&gt;&lt;b style="color: blue;"&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; protected void onDraw(Canvas canvas) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int left = getPaddingLeft();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int top = getPaddingTop();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int right = getPaddingRight();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int bottom = getPaddingBottom();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int width = getWidth() - left - right;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int height = getHeight() - top - bottom;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int saveCount = canvas.getSaveCount();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; canvas.translate(left + width / 2, top + height / 2);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; canvas.rotate(-180);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; canvas.translate((-width / 2)-left, (-height / 2)-top);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; canvas.restoreToCount(saveCount);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; super.onDraw(canvas);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/blockquote&gt;There you go. You can now add this button anywhere in your XML layouts and you will always get an inverted button.&lt;br /&gt;
&lt;blockquote style="color: blue;"&gt;&lt;b&gt;&lt;span style="font-size: x-small;"&gt;&lt;i&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;
&amp;lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; android:orientation="vertical" android:layout_width="fill_parent"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_height="fill_parent"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Button android:text="Button" android:id="@+id/button1"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_width="wrap_content" android:layout_height="wrap_content"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_gravity="center_horizontal|top" android:textStyle="bold"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;com.beanie.examples.invertedbutton.InvertedButton&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_height="wrap_content" android:layout_gravity="center_horizontal|bottom"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:textStyle="bold"&amp;gt;&amp;lt;/com.beanie.examples.invertedbutton.InvertedButton&amp;gt;&lt;br /&gt;
&amp;lt;/LinearLayout&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;&lt;br /&gt;
You can find the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/Inverted_Button/"&gt;source code here&lt;/a&gt;. Happy coding!!!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-4499456189749468029?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/4499456189749468029/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2011/04/inverted-android-button.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/4499456189749468029'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/4499456189749468029'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2011/04/inverted-android-button.html' title='Inverted Android Button'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-Ne5ZNdfjVYI/TZjjXVcjouI/AAAAAAAAC1M/8vpOep-r_zE/s72-c/inverted_button_android.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-7414477857909087685</id><published>2011-03-26T00:24:00.000-07:00</published><updated>2011-03-26T00:26:14.156-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Websockets'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='Third party libraries'/><title type='text'>Websockets on Android</title><content type='html'>Have you ever tried to use &lt;a href="http://en.wikipedia.org/wiki/WebSockets"&gt;Websockets&lt;/a&gt; on Android? In a recent project that I have been working on, it was required to use WebSockets to build a native Android app. Why a native app? Well, the current webkit that ships with the Android devices is not as fast as we would have liked. So, we had to figure out a way to build a native app that would be able to connect through WebSockets.&lt;br /&gt;
&lt;br /&gt;
There are quite a few libraries available out there. And it took a bit of time to figure out the best library available. Well, the library isn't that huge. The one that we finally decided to use had only 2 java files that got our work done. Simple, isn't it?&lt;br /&gt;
&lt;br /&gt;
The link to the source is &lt;a href="https://github.com/anismiles/websocket-android-phonegap/tree/master/src/com/strumsoft/websocket/phonegap"&gt;here&lt;/a&gt;. You just need these two files:&lt;br /&gt;
1. &lt;a href="https://github.com/anismiles/websocket-android-phonegap/blob/master/src/com/strumsoft/websocket/phonegap/WebSocket.java"&gt;WebSocket.java&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="https://github.com/anismiles/websocket-android-phonegap/blob/master/src/com/strumsoft/websocket/phonegap/WebSocketFactory.java"&gt;WebSocketFactory.java&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Out of these two files, the main file that you would be working on is the WebSocket.java. The WebSocketFactory.java, is just an extension of the other class that gives you WebSocket instances, based one of the two Drafts (75/76) that you request for. I am using the Draft-76 of the implementation.&lt;br /&gt;
&lt;br /&gt;
For our use, we didn't require the WebView portion embedded in the source. So we removed it.&lt;br /&gt;
This is how you instantiate and use a WebSocket.&lt;br /&gt;
&lt;blockquote style="color: #783f04;"&gt;&lt;i&gt;&lt;span style="font-size: small;"&gt;WebSocket webSocket = new WebSocket(URI.create("ws://yourserver.com"), DRAFT-76, "any_id");&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style="font-size: small;"&gt;webSocket.connect();&lt;/span&gt;&lt;/i&gt;&lt;/blockquote&gt;After you connect to the server, there are different event callbacks that you could listen for.&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;b&gt;onOpen()&lt;/b&gt; : This method will be called when the WebSocket is connected and ready for sending and receiving data.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;onClose()&lt;/b&gt; : This method will be called when the connection is terminated. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;onMessage()&lt;/b&gt; : This method will be called then a message is received over the socket.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;onError()&lt;/b&gt; : This method is used to notify any error message that might occur. According to the project doc on github, this currently doesn't work properly.&lt;/li&gt;
&lt;/ol&gt;When you need to send a message to the server, the WebSocket class has a send method which takes in a String as the message.&lt;br /&gt;
&lt;blockquote&gt;&lt;i style="color: #783f04;"&gt;webSocket.send("Your message");&lt;/i&gt;&lt;/blockquote&gt;&amp;nbsp;To know more about the project, visit &lt;a href="https://github.com/anismiles/websocket-android-phonegap"&gt;anismiles' github project&lt;/a&gt;. Thanks anismiles. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-7414477857909087685?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/7414477857909087685/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2011/03/websockets-on-android.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7414477857909087685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7414477857909087685'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2011/03/websockets-on-android.html' title='Websockets on Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-770489143750930751</id><published>2011-01-12T12:32:00.000-08:00</published><updated>2011-01-12T12:32:57.333-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Market'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Hacks'/><category scheme='http://www.blogger.com/atom/ns#' term='Market on Emulator'/><category scheme='http://www.blogger.com/atom/ns#' term='2.2'/><title type='text'>Android Market on Emulator (2.2)</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/__9PneCDHGgs/TS4PAphuI6I/AAAAAAAACyg/9KuoqNzVkqI/s1600/Android+market+on+Froyo.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="200" src="http://4.bp.blogspot.com/__9PneCDHGgs/TS4PAphuI6I/AAAAAAAACyg/9KuoqNzVkqI/s200/Android+market+on+Froyo.png" width="135" /&gt;&lt;/a&gt;It's been some time that I had tried getting the Market up and running on a 2.2 a.k.a Froyo emulator. On a &lt;a href="http://techdroid.kbeanie.com/2009/11/android-market-on-emulator.html"&gt;previous post&lt;/a&gt;, I had described how to setup an emulator (1.5 and 1.6) with the Market app. Today, I got a comment on that post which points to a 2.2 image that does the same. You just have to download that image file and follow exactly the same steps to set it up.&lt;br /&gt;
&lt;br /&gt;
This is the link to the &lt;a href="http://www.4shared.com/get/qjANIsHH/system.html"&gt;system.img&lt;/a&gt; file. &lt;b&gt;Thanks Anonymous&lt;/b&gt; for your contribution. I have tried this, and it works. Here's a &lt;a href="http://anythingsimple.blogspot.com/2010/09/how-to-use-android-market-on-android.html"&gt;link (David's Blog)&lt;/a&gt; that anonymous referred to. He has described all the steps to create this system image needed to put the Market app on emulator.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;A few things:&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
- This image will only work on a 2.2 emulator&lt;br /&gt;
- While creating the emulator, you should specify the cache partition size as 96 MB. &lt;br /&gt;
&lt;br /&gt;
Check out the &lt;a href="http://techdroid.kbeanie.com/2009/11/android-market-on-emulator.html"&gt;previous post&lt;/a&gt; for more details.&lt;br /&gt;
&lt;br /&gt;
There are however a few limitations that I found with this hack.&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;The Android Market app doesn't seem to update itself to the new UI that we currently have on our phones.&lt;/li&gt;
&lt;li&gt;There are only a limited number of apps that show up on the Market. (No Angry Birds for example)&lt;/li&gt;
&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-770489143750930751?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/770489143750930751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2011/01/android-market-on-emulator-22.html#comment-form' title='19 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/770489143750930751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/770489143750930751'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2011/01/android-market-on-emulator-22.html' title='Android Market on Emulator (2.2)'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/__9PneCDHGgs/TS4PAphuI6I/AAAAAAAACyg/9KuoqNzVkqI/s72-c/Android+market+on+Froyo.png' height='72' width='72'/><thr:total>19</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-6725371481086015428</id><published>2010-12-16T01:05:00.000-08:00</published><updated>2010-12-16T09:08:04.361-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Webview'/><category scheme='http://www.blogger.com/atom/ns#' term='OS'/><category scheme='http://www.blogger.com/atom/ns#' term='Gingerbread'/><category scheme='http://www.blogger.com/atom/ns#' term='Gestures'/><category scheme='http://www.blogger.com/atom/ns#' term='UI'/><title type='text'>Improved Copy/Paste in Gingerbread</title><content type='html'>It's really important for the copy/paste feature to work on a mobile even if you don't have a mouse to select text you want to copy. Apple's implementation is nice. Till Froyo, there wasn't a unified concept of copy/paste feature implemented. But, the Gingerbread has actually changed a few things :) . Copying phone numbers from your mails and email addresses from web pages should be trivial and should involve the least amount of button presses. Prior to Gingerbread, this wasn't the case, but Gingerbread has this &lt;b&gt;"New Feature now".&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://developer.android.com/sdk/android-2.3-highlights.html"&gt;Here's the link where you can find out more about this.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Some images and videos&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://developer.android.com/sdk/images/2.3/onetouch.png"&gt;Official documentation&lt;/a&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/__9PneCDHGgs/TQnF1JMDsVI/AAAAAAAACxY/IBNaT1RJrFw/s1600/copy_paste_gingerbread.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="184" src="http://1.bp.blogspot.com/__9PneCDHGgs/TQnF1JMDsVI/AAAAAAAACxY/IBNaT1RJrFw/s320/copy_paste_gingerbread.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
You need to double-tap on the text before you can bring up the text selection controls. Once you are done with the selection, single tap on the text copies the selected text to the clipboard, and then you can extract the data from the clipboard. This is really nice. Else, you would have to write a bit of extra code to trigger text selection mode first. This copy/paste selector works on an EditText and on the Browser. I haven't tested it further.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Gingerbread Stuff!!!! **It works on the emulator**.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-6725371481086015428?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/6725371481086015428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/12/improved-cpoypaste-in-gingerbread.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/6725371481086015428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/6725371481086015428'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/12/improved-cpoypaste-in-gingerbread.html' title='Improved Copy/Paste in Gingerbread'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/__9PneCDHGgs/TQnF1JMDsVI/AAAAAAAACxY/IBNaT1RJrFw/s72-c/copy_paste_gingerbread.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-9076031032366099239</id><published>2010-11-16T12:30:00.000-08:00</published><updated>2010-11-16T12:30:33.771-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Animations'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='examples'/><category scheme='http://www.blogger.com/atom/ns#' term='UI'/><title type='text'>Getting animations to work</title><content type='html'>This is a simple project that will explain how to use animations in android through &lt;a href="http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html"&gt;AnimationDrawable&lt;/a&gt;. The documentation was a bit outdated. But you might hit a dead-end if you try to call the animation's start method from within any of the Activity's life-cycle methods.&lt;br /&gt;
&lt;br /&gt;
In this example, there is an ImageView with it's "src" value set to an image. The &lt;a href="http://developer.android.com/reference/android/widget/ImageView.html"&gt;ImageView&lt;/a&gt;'s background is set with you own AnimationDrawable, basically an xml in your res/drawable folder. In the activity, the &lt;a href="http://developer.android.com/reference/android/widget/ImageView.html"&gt;ImageView&lt;/a&gt; has a click listener, which creates an AnimationDrawable from the ImageView's background, and just calls the start method of the &lt;a href="http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html"&gt;AnimationDrawable&lt;/a&gt; class.&lt;br /&gt;
&lt;br /&gt;
Here is a sample AnimationDrawable described through XML.&lt;br /&gt;
&lt;blockquote style="color: blue;"&gt; &lt;span style="font-size: x-small;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;animation-list xmlns:android="http://schemas.android.com/apk/res/android"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; android:oneshot="false"&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;item android:drawable="@drawable/black" android:duration="200" /&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;item android:drawable="@drawable/cyan" android:duration="200" /&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;item android:drawable="@drawable/green" android:duration="200" /&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;item android:drawable="@drawable/magenta" android:duration="200" /&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;item android:drawable="@drawable/navy" android:duration="200" /&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;item android:drawable="@drawable/orange" android:duration="200" /&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;item android:drawable="@drawable/pink" android:duration="200" /&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;item android:drawable="@drawable/white" android:duration="200" /&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;item android:drawable="@drawable/yellow" android:duration="200" /&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;/animation-list&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;gt;&lt;/span&gt;&lt;/blockquote&gt;And here is the code that gets your animation started.&lt;br /&gt;
&lt;blockquote&gt;&lt;span style="color: blue; font-size: x-small;"&gt;imageView = (ImageView) findViewById(R.id.ImageButton01);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; imageView.setOnClickListener(new OnClickListener() {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void onClick(View v) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AnimationDrawable animator = (AnimationDrawable) imageView.getBackground();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; imageView.setImageDrawable(null);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; animator.start();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/span&gt;&lt;/blockquote&gt;One point to notice is that, you have to remove the ImageView's "src" value, so that the animation is visible, since the animation works by changing the background of the ImageView, else, your animation would be blocked by the ImageView's "src" image.&lt;br /&gt;
&lt;br /&gt;
Once you are done, you can stop the animation, and reset the ImageView's "src" to it's original image.&lt;br /&gt;
&lt;blockquote&gt;&lt;span style="color: blue; font-size: x-small;"&gt;// Call this method to stop the animation&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public void stopAnimation(){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AnimationDrawable animator = (AnimationDrawable) imageView.getBackground();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; animator.stop();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; imageView.setImageResource(R.drawable.icon);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/blockquote&gt;&amp;nbsp;You can find the whole &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn/trunk/AnimationSample"&gt;source code for this example here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-9076031032366099239?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/9076031032366099239/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/11/getting-animations-to-work.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/9076031032366099239'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/9076031032366099239'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/11/getting-animations-to-work.html' title='Getting animations to work'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-3117287372175510466</id><published>2010-10-24T15:13:00.000-07:00</published><updated>2010-11-23T04:11:07.808-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Unzip'/><category scheme='http://www.blogger.com/atom/ns#' term='examples'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='Zip'/><category scheme='http://www.blogger.com/atom/ns#' term='Files'/><title type='text'>Unzip files in Android</title><content type='html'>You need an app that can unzip files? Android provides the classes that are required for this. Basically you will need to checkout two classes. There are other related classes also which would help you with various other things.&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;a href="http://developer.android.com/reference/java/util/zip/ZipInputStream.html"&gt;ZipInputStream&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developer.android.com/reference/java/util/zip/ZipEntry.html"&gt;ZipEntry&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;This example shows you how to unzip a zip file through these classes. If you want to create zip files, that's also possible, but we will keep it for later. In this project, there is a zip file, called &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/UnzipTest/assets/ZipTest.zip"&gt;ZipTest.zip&lt;/a&gt; in the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn/trunk/UnzipTest/assets"&gt;assets folder&lt;/a&gt;. It's pretty easy to pick up any zip file on your phone through code. For simplicity, I have placed out test file in the assets folder.&lt;br /&gt;
&lt;br /&gt;
The code is simple enough to need any more explanations. I have put comments in the code. So, do check it out and run it. I have logged the steps on the Activity. &lt;strike&gt;The output files are not readable yet in this example due to the format of writing that I have done here&lt;/strike&gt; &lt;i style="color: red;"&gt;(Update: As per rekin's comment, this is fixed now)&lt;/i&gt;. But you get idea about how to unzip those files. You can find the whole &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn/trunk/UnzipTest"&gt;working code here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note: &lt;/b&gt;There's not much error handling code put in place.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-3117287372175510466?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/3117287372175510466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/10/unzip-files-in-android.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/3117287372175510466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/3117287372175510466'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/10/unzip-files-in-android.html' title='Unzip files in Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-6322836380578399376</id><published>2010-10-19T13:22:00.000-07:00</published><updated>2011-07-23T13:38:19.796-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Webview'/><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><title type='text'>Android WebView, Javascript and CSS</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/__9PneCDHGgs/TL39vni6kpI/AAAAAAAACu0/yTR2iPVyJTQ/s1600/Android+WebView,+Javascript%28jquery%29+and+CSS.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/__9PneCDHGgs/TL39vni6kpI/AAAAAAAACu0/yTR2iPVyJTQ/s1600/Android+WebView,+Javascript%28jquery%29+and+CSS.png" /&gt;&lt;/a&gt;&lt;/div&gt;
Using &lt;a href="http://developer.android.com/reference/android/webkit/WebView.html"&gt;WebView&lt;/a&gt;s on Android is pretty interesting. I have come across some situations where I had to use a WebView to display some HTML content. Displaying HTML content is pretty straight-forward. But when it comes to controlling the web view, it gets a little complex. Things like showing alerts, manipulating divs and controlling the activity (closing/finishing). This example shows a few techniques that will get you going with Javascript and CSS with &lt;a href="http://developer.android.com/reference/android/webkit/WebView.html"&gt;WebView&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. CSS:&lt;/b&gt; Applying CSS is just the same as you would do with normal HTML pages. The &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/JQueryExample/assets/sample_page.html"&gt;sample_page.html&lt;/a&gt; in the assets folder refers to the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/JQueryExample/assets/sample_style.css"&gt;sample_style.css&lt;/a&gt; file in the same folder. One thing you might notice is how we get the rounder corners for the divs. This CSS attribute does the trick.&lt;br /&gt;
&lt;blockquote&gt;
&lt;span class="lit"&gt;&lt;/span&gt;&lt;span class="pun"&gt;&lt;/span&gt;&lt;span class="pln"&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -webkit-border-radius: 5px;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;span class="pln"&gt;&lt;b&gt;2. Javascript:&lt;/b&gt; To make it simpler, I have used the &lt;a href="http://jquery.com/"&gt;JQuery library&lt;/a&gt;. The mobile version released recently gave some errors. So, I have used the normal library available. The &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/JQueryExample/assets/jquery-1.4.2.min.js"&gt;jquery-1.4.2.min.js&lt;/a&gt;&lt;i&gt;&lt;b&gt; &lt;/b&gt;&lt;/i&gt;also resides in the assets folder and is referenced in the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/JQueryExample/assets/sample_page.html"&gt;sample_page.html&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln"&gt;&lt;i&gt;&lt;b&gt; &lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln"&gt;&lt;b&gt;3. All together:&lt;/b&gt; In the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/JQueryExample/assets/sample_page.html"&gt;sample_page.html&lt;/a&gt; I have a header, a body and the controls. The controls have four buttons&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;a: JToggle:&lt;/b&gt; This toggles the visibility of the body section. This is a pure javascript method call from the html.&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;b: NToggle:&lt;/b&gt; This also toggles the visibility of the body section. But it does it differently. The javascript calls to the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/JQueryExample/src/com/beanie/samples/jquery/jsinterfaces/JSInterface.java"&gt;JSInterface.java&lt;/a&gt; method, which in turn calls the same Javascript method.&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;c. Exit:&lt;/b&gt; This button basically closes/exits the app, by calling the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/JQueryExample/src/com/beanie/samples/jquery/jsinterfaces/JSInterface.java"&gt;JSInterface.java&lt;/a&gt; method which is bound to the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/JQueryExample/src/com/beanie/samples/jquery/HomeActivity.java"&gt;HomeActivity.java&lt;/a&gt; via &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/JQueryExample/src/com/beanie/samples/jquery/OnExitAppListener.java"&gt;OnExitAppListener.java&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;d. Alert:&lt;/b&gt; This shows an alert which is basically an &lt;a href="http://developer.android.com/reference/android/app/AlertDialog.html"&gt;AlertDialog&lt;/a&gt; in Android.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;u&gt;&lt;span class="pln"&gt;Calling a Javascript method from your Java code:&lt;/span&gt;&lt;/u&gt;&lt;/i&gt;&lt;br /&gt;
&lt;span class="pln"&gt;&lt;i&gt;&lt;b&gt;webView.loadUrl("javascript:jsToggle()");&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;u&gt;&lt;span class="pln"&gt;Calling a Java method from Javascript:&lt;/span&gt;&lt;/u&gt;&lt;/i&gt;&lt;br /&gt;
&lt;span class="pln"&gt;&lt;i&gt;&lt;b&gt;window.jsinterface.nativeToggle();&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln"&gt;&lt;i&gt;&lt;b&gt;/*&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln"&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp; // Before using the above code, you have to inject the interface object which&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln"&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp; // has a name "jsinterface"&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln"&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp; webView.addJavascriptInterface(jsInterface, "jsinterface"); &lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln"&gt;&lt;i&gt;&lt;b&gt;*/&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;i&gt;&lt;span class="pln"&gt;Controlling the Alerts from Javascript:&lt;/span&gt;&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
&lt;span class="pln"&gt;The &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/JQueryExample/src/com/beanie/samples/jquery/client/SampleChromeClient.java"&gt;SampleChromeClient.java&lt;/a&gt; which extends the &lt;a href="http://developer.android.com/reference/android/webkit/WebChromeClient.html"&gt;WebChromeClient&lt;/a&gt; has several methods which provide hooks which allow you to customize their behaviour. For an example, you can override the behaviour of the alert function and do whatever you want. You can show your own dialog with Yes/No buttons and depending on the input, you can send back the result to your Javascript code. &lt;/span&gt;&lt;br /&gt;
&lt;span class="pln"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;&lt;i&gt;&amp;nbsp;@Override&lt;br /&gt;
&amp;nbsp;public boolean onJsAlert(WebView view, String url, String message, JsResult result)&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url = "Sample App Alert";&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return super.onJsAlert(view, url, message, result);&lt;br /&gt;
&amp;nbsp;}&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln"&gt;You can checkout the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn/trunk/JQueryExample%3Fstate%3Dclosed"&gt;whole source code here&lt;/a&gt;. It's ready to run. Let me know if you have any issues.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-6322836380578399376?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/6322836380578399376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/10/android-webview-javascript-and-css.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/6322836380578399376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/6322836380578399376'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/10/android-webview-javascript-and-css.html' title='Android WebView, Javascript and CSS'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/__9PneCDHGgs/TL39vni6kpI/AAAAAAAACu0/yTR2iPVyJTQ/s72-c/Android+WebView,+Javascript%28jquery%29+and+CSS.png' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-1897846258882960900</id><published>2010-10-15T04:49:00.000-07:00</published><updated>2010-10-15T04:49:32.366-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='Device Admin API'/><category scheme='http://www.blogger.com/atom/ns#' term='Froyo'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='New Features'/><category scheme='http://www.blogger.com/atom/ns#' term='2.2'/><title type='text'>More security for your Android</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/__9PneCDHGgs/TLg_mz5mKvI/AAAAAAAACuo/k80cXoZJGRA/s1600/secured+android_small.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/__9PneCDHGgs/TLg_mz5mKvI/AAAAAAAACuo/k80cXoZJGRA/s1600/secured+android_small.png" /&gt;&lt;/a&gt;&lt;/div&gt;Android has been criticized by a few of not having stricter security policies, on which a user could count on if his device is lost or stolen. Since more and more data, both personal and confidential are finding there way into our smart phones, we do need a more secure system to ensure that our data never fall into the wrong hands. Well, with Android 2.2(Froyo), your Android phones can be more secure by using the new &lt;a href="http://developer.android.com/guide/topics/admin/device-admin.html"&gt;Device Administration API&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;b&gt;What could this API do?&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
Using these APIs, the IT-Admins can install a Admin App, which enforces system wide security policies.&lt;br /&gt;
&lt;br /&gt;
- Enable Passwords (Only lock screen as of now)&lt;br /&gt;
- Set minimum password length&lt;br /&gt;
- Alphanumeric password required&lt;br /&gt;
- Maximum password attempts&lt;br /&gt;
- Maximum inactivity time lock&lt;br /&gt;
- Lock device immediately&lt;br /&gt;
- Wipe the device data (to factory settings) (Remote/Local)&lt;br /&gt;
&lt;br /&gt;
The key to all these features are that you have to have that admin app installed and activated as well. Also, you can have multiple admin apps that enforce multiple security policies. In situations of clash, the most strict policy will be enforced. This admin app controls how your device behaves in different situations. You can set parameters as to when and under what conditions your device should be wiped out. Say, after 20 failed password attempts, you want to wipe out the data to factory settings, the Admin app can do this using the Device Administration API.&lt;br /&gt;
&lt;br /&gt;
For more information and samples on how to start with this API, visit the &lt;a href="http://developer.android.com/guide/topics/admin/device-admin.html"&gt;official documentation here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
With more and more features being packed into Android, now it is probably targeting the enterprises. Not having a way of enforcing such policies have indeed been a setback for Android to entice the Business users, but now, I can hear them come running. :D&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-1897846258882960900?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/1897846258882960900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/10/more-security-for-your-android.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/1897846258882960900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/1897846258882960900'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/10/more-security-for-your-android.html' title='More security for your Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/__9PneCDHGgs/TLg_mz5mKvI/AAAAAAAACuo/k80cXoZJGRA/s72-c/secured+android_small.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-1940502069175861868</id><published>2010-09-16T15:01:00.000-07:00</published><updated>2012-01-12T06:02:59.288-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android Tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='List View'/><category scheme='http://www.blogger.com/atom/ns#' term='UI'/><category scheme='http://www.blogger.com/atom/ns#' term='Custom Widgets'/><title type='text'>ExpandableListView on Android</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
ListView is pretty widely used. There are situations when you would like to group/categorize your list items. To achieve such a thing on Android, you would probably use the &lt;a href="http://developer.android.com/reference/android/widget/ExpandableListView.html"&gt;ExpandableListView&lt;/a&gt;. The data to the ExpandableListView is supplied by a special kind of adapter called the &lt;a href="http://developer.android.com/reference/android/widget/SimpleExpandableListAdapter.html"&gt;SimpleExpandableListAdapter&lt;/a&gt; which extends the &lt;a href="http://developer.android.com/reference/android/widget/BaseExpandableListAdapter.html"&gt;BaseExpandableListAdapter&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/__9PneCDHGgs/TJKOEOIl--I/AAAAAAAACt0/HI8ui6yN7JQ/s1600/sample_expandable_list_view_android.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/__9PneCDHGgs/TJKOEOIl--I/AAAAAAAACt0/HI8ui6yN7JQ/s320/sample_expandable_list_view_android.png" width="213" /&gt;&lt;/a&gt;&lt;/div&gt;
As with any other widget on Android, you are free to customize the widgets as per your needs. Here, I will show how to create such a custom list adapter for the ExpandableListView.&lt;br /&gt;
&lt;br /&gt;
For this example, I want to show a list of vehicles with their names. Also, I want to group them according to their category.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;I have 4 classes.&lt;/b&gt;&lt;br /&gt;
1. &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/CustomExpandableListView/src/com/beanie/example/list/classes/Vehicle.java"&gt;Vehicle&lt;/a&gt; : The parent class for the rest.&lt;br /&gt;
2. &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/CustomExpandableListView/src/com/beanie/example/list/classes/Car.java"&gt;Car&lt;/a&gt;: Extends the Vehicle class.&lt;br /&gt;
3. &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/CustomExpandableListView/src/com/beanie/example/list/classes/Bus.java"&gt;Bus&lt;/a&gt;: Extends the Vehicle class.&lt;br /&gt;
4. &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/CustomExpandableListView/src/com/beanie/example/list/classes/Bike.java"&gt;Bike&lt;/a&gt;: Extends the Vehicle class.&lt;br /&gt;
&lt;br /&gt;
I have a method called &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/CustomExpandableListView/src/com/beanie/example/list/data/MockDataProvider.java"&gt;getRandomVehicle(String name)&lt;/a&gt; which returns a random vehicle instance setting the name that I pass. The vehicle can be a Bus, Car or a Bike. Its completely random.&lt;br /&gt;
&lt;br /&gt;
In the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/CustomExpandableListView/src/com/beanie/example/list/adapter/ExpandableListAdapter.java"&gt;ExpandableListAdapter&lt;/a&gt;, (the custom adapter), there's a method called &lt;b&gt;addItem(Vehicle vehicle)&lt;/b&gt;, which manages the groups and their children.&lt;br /&gt;
&lt;br /&gt;
In the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/CustomExpandableListView/src/com/beanie/example/list/SampleActivity.java"&gt;SampleActivity&lt;/a&gt;, I have initialized a blank ExpandableListAdapter and set it to the list view. Now, I start a thread, which gets a random vehicle after every 2 seconds, and adds it to the adapter, and calls the adapter to notify that the data has changed. &lt;br /&gt;
&lt;br /&gt;
There are a few methods, in the ExpandableListAdapter, which you should go through carefully. I have two layout files, &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/CustomExpandableListView/res/layout/child_layout.xml"&gt;group_layout.xml&lt;/a&gt; and &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/CustomExpandableListView/res/layout/child_layout.xml"&gt;child_layout.xml&lt;/a&gt; which are used as the layout for the group views and the child views of the ExpandableListView.&lt;br /&gt;
&lt;br /&gt;
There you go, you have a custom ExpandableListView. You can find the full source code for this &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/trunk/CustomExpandableListView/"&gt;example here&lt;/a&gt;, ready to run.&lt;br /&gt;
&lt;br /&gt;
There are some more methods that you might be interested in, like, how to change the "arrow icon" for the group views&lt;a href="http://developer.android.com/reference/android/widget/ExpandableListView.html#setGroupIndicator%28android.graphics.drawable.Drawable%29"&gt;(official doc link)&lt;/a&gt;, or how to expand or collapse a group at will, or how to handle specific events like group collapsed or group expanded. Read the docs on &lt;a href="http://developer.android.com/reference/android/widget/ExpandableListView.html"&gt;ExpandableListView&lt;/a&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-1940502069175861868?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/1940502069175861868/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/09/expandablelistview-on-android.html#comment-form' title='77 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/1940502069175861868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/1940502069175861868'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/09/expandablelistview-on-android.html' title='ExpandableListView on Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/__9PneCDHGgs/TJKOEOIl--I/AAAAAAAACt0/HI8ui6yN7JQ/s72-c/sample_expandable_list_view_android.png' height='72' width='72'/><thr:total>77</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-6549997507245076812</id><published>2010-09-12T15:22:00.000-07:00</published><updated>2010-09-12T15:26:21.807-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='Screen Sizes'/><category scheme='http://www.blogger.com/atom/ns#' term='GUI'/><title type='text'>SDK Tools - ADT Plugin updated</title><content type='html'>Here comes a new update to the ADT plugin for eclipse and SDK tools.&lt;br /&gt;
&lt;br /&gt;
After you update the SDK tools(r7) from the Android SDK manager or otherwise, you would be prompted to update the ADT plugin(0.9.8) as well. Go for it, and you will see quite a few changes.&lt;br /&gt;
&lt;br /&gt;
In the SDK Tools:&lt;br /&gt;
&lt;a href="http://developer.android.com/sdk/tools-notes.html"&gt;http://developer.android.com/sdk/tools-notes.html&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
In the ADT Plugin:&lt;br /&gt;
&lt;a href="http://developer.android.com/sdk/eclipse-adt.html"&gt;http://developer.android.com/sdk/eclipse-adt.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;For SDK Tools&lt;/b&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;- Support for library projects.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;- Support for aidl files in library projects&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;- Support for extension targets in Ant build to perform tasks between the normal tasks&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;- Support for "headless" SDK update&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;- Fixes location control in DDMS to work in any locale not using '.' as a decimal point&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;For ADT Plugin&lt;/b&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;- Rename package : One click change of project's package&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;- Support for library projects that don't have a source folder called &lt;code&gt;src/&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&lt;code&gt;-&lt;/code&gt; Support for library projects that depend on other library projects&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&lt;code&gt;- &lt;/code&gt;Support for additional resource qualifiers: &lt;code&gt;car&lt;/code&gt;/&lt;code&gt;desk&lt;/code&gt;, &lt;code&gt;night&lt;/code&gt;/&lt;code&gt;notnight&lt;/code&gt; and &lt;code&gt;navexposed&lt;/code&gt;/&lt;code&gt;navhidden&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&lt;code&gt;- &lt;/code&gt;Adds more device screen types in the layout editor. (Nice)&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&lt;code&gt;- &lt;/code&gt;Fixes problems with handling of library project names&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The most important update for me is the inclusion of more layout editor configurations by default. My last post on creating different configurations for different screen sizes &lt;a href="http://techdroid.kbeanie.com/2010/09/getting-started-with-tablets-they-are.html%20"&gt;here&lt;/a&gt; was just an example to create a configuration for working with different screen sizes at design time. It's a bonus that they are now included in there by default.&lt;br /&gt;
&lt;br /&gt;
Once click package renaming is also a nice feature, in case you want to fork your project into different versions. Check them out.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;dl&gt;&lt;dd&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-6549997507245076812?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/6549997507245076812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/09/sdk-tools-adt-plugin-updated.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/6549997507245076812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/6549997507245076812'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/09/sdk-tools-adt-plugin-updated.html' title='SDK Tools - ADT Plugin updated'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-7710580797571329292</id><published>2010-09-04T17:34:00.000-07:00</published><updated>2010-09-04T17:34:31.052-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tablet Emulators'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Tricks'/><title type='text'>Getting started with Tablets - They are coming</title><content type='html'>So, Android phones are done. Now's the time to give the iPads a rest. If you would like to develop applications for Android Tablets, you need to get a few things up first.&lt;br /&gt;
&lt;br /&gt;
First of all, you need to setup a few tablet emulators for your apps. This bit is rather simple. Create a new AVD. I guess this screenshot explains the rest. For some reasons, I have not been able to create Tablet AVDs on 1.6. But it definitely works on Android 2.2 (Froyo).&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/__9PneCDHGgs/TILe-CcQBLI/AAAAAAAACso/Sl6HyMjlFRg/s1600/create_emulator.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/__9PneCDHGgs/TILe-CcQBLI/AAAAAAAACso/Sl6HyMjlFRg/s320/create_emulator.png" width="259" /&gt;&lt;/a&gt;&lt;/div&gt;After you create this AVD, fire it up. And you should be able to see the Droid up and jumping. &lt;br /&gt;
&lt;br /&gt;
You can now test out your apps on this tablet emulator. Well, since tablet devices will obviously come under large-screens, to make your designing layouts for large screens easy, you need to tweak up a few things on eclipse. Since, large screen devices take up the xml layouts from the &lt;b&gt;"layout-large"&lt;/b&gt; and &lt;b&gt;"layout-large-land"&lt;/b&gt; folders, if it all you have different layouts for large screens, to visualize your designs during your development, you need to add one more configuration for large screens.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;b&gt;Steps to add a new configuration&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
- Open eclipse. Open any layout xml, so that you can get to the screen where you can add a custom configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/__9PneCDHGgs/TILhJhyt7TI/AAAAAAAACss/LcRw4QrPDBI/s1600/add_config.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="50" src="http://2.bp.blogspot.com/__9PneCDHGgs/TILhJhyt7TI/AAAAAAAACss/LcRw4QrPDBI/s400/add_config.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
- In the devices drop down, select custom to create a new configuration. Click on "Create" which will open up the configuration screen.&lt;br /&gt;
&lt;br /&gt;
- On the new configuration screen, select "Nexus One" and click on "Copy" to create a copy which you can edit later.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/__9PneCDHGgs/TILi3vFwTcI/AAAAAAAACsw/ND7r9YM1cCI/s1600/custom_1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="167" src="http://2.bp.blogspot.com/__9PneCDHGgs/TILi3vFwTcI/AAAAAAAACsw/ND7r9YM1cCI/s400/custom_1.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
- Once you get a copy, you can rename it to your own configuration name.&lt;br /&gt;
&lt;br /&gt;
- Before you are done, you need to change a few values for both the layouts, landscape and portrait. Follow the screen shot.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/__9PneCDHGgs/TILjvtkbxzI/AAAAAAAACs0/8X33U7AHkyM/s1600/config_2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/__9PneCDHGgs/TILjvtkbxzI/AAAAAAAACs0/8X33U7AHkyM/s400/config_2.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;blockquote&gt;&lt;i&gt;&lt;b&gt;Change x dpi, y dpi, Screen Size, Resolution and set it to values as shown above. Do it for both the orientations.&lt;/b&gt;&lt;/i&gt;&lt;/blockquote&gt;&lt;br /&gt;
- Save the configuration. Now, whenever you change the configuration to your custom config, since this custom config is for the large screen devices, it would show you how your layouts will look on a real device. It will pick up the xml files correctly whenever you switch your configuration to large screens.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-7710580797571329292?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/7710580797571329292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/09/getting-started-with-tablets-they-are.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7710580797571329292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7710580797571329292'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/09/getting-started-with-tablets-they-are.html' title='Getting started with Tablets - They are coming'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/__9PneCDHGgs/TILe-CcQBLI/AAAAAAAACso/Sl6HyMjlFRg/s72-c/create_emulator.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-7244966018489838811</id><published>2010-08-08T12:23:00.000-07:00</published><updated>2010-08-08T12:23:50.408-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OS'/><category scheme='http://www.blogger.com/atom/ns#' term='Android 1.5'/><category scheme='http://www.blogger.com/atom/ns#' term='New Features'/><title type='text'>Android OS Versions in the Wild</title><content type='html'>The latest stats from &lt;a href="http://www.google.com/"&gt;Google&lt;/a&gt; reveal that most of the Android phones are being upgraded to the latest versions of the OS. Every manufacturer is very keen to get on the bandwagon and capture the market share, which is good for the users and the community.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/__9PneCDHGgs/TF8B4PFyhDI/AAAAAAAACrQ/dKo1FUCrVI8/s1600/chart.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="216" src="http://1.bp.blogspot.com/__9PneCDHGgs/TF8B4PFyhDI/AAAAAAAACrQ/dKo1FUCrVI8/s400/chart.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="font-size: x-small;"&gt;Image Source : &lt;a href="http://developer.android.com/resources/dashboard/platform-versions.html"&gt;http://developer.android.com/resources/dashboard/platform-versions.html&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The above chart gives us an idea of the overall OS spread (August 2, 2010). 59.7% of the Android phones are now running on Android 2.1(Donut). Isn't that great. Nice. And we will definitely see the percentage for Android 2.2(Froyo) increase manifold when manufacturers push updates on the latest version. But, there is a substantial amount of phones still out there running on 1.5, though not a majority. But, if we talk about only numbers, 20.3% of the total Android phones is still a huge number. Now that's a problem.&lt;br /&gt;
&lt;br /&gt;
With Android 1.6 and up, apps can be designed and developed for different density and screen resolutions. The cupcake update doesn't have this feature. There are a few workarounds which enable you to develop in 1.6 and up and still support devices on 1.5, but it's a pain. I am sure many developers will agree with this. Apart from this, there aren't major differences that would hinder developers in making apps to suit all platforms.&lt;br /&gt;
&lt;br /&gt;
And with Android 3.0(Gingerbread), rumors say that it will bring support for tablet sized devices, I am not sure how to absorb this piece of news.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-7244966018489838811?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/7244966018489838811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/08/android-os-versions-in-wild.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7244966018489838811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7244966018489838811'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/08/android-os-versions-in-wild.html' title='Android OS Versions in the Wild'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/__9PneCDHGgs/TF8B4PFyhDI/AAAAAAAACrQ/dKo1FUCrVI8/s72-c/chart.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-8108442231871821202</id><published>2010-07-17T03:07:00.000-07:00</published><updated>2010-07-17T03:07:50.294-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='notifications'/><category scheme='http://www.blogger.com/atom/ns#' term='examples'/><title type='text'>Ongoing notifications in Android</title><content type='html'>There is a concept of an Ongoing notifications in Android where you just show a notification for the duration you are performing some background task/process. This special kind of notification cannot be canceled by the used. Also, if you would like to use an animated icon on the status bar, you can do it. As mentioned in the developer docs, you can also use a custom view for your notification.&lt;br /&gt;
&lt;a href="http://draft.blogger.com/goog_60089094"&gt;&lt;br /&gt;
&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://www.castlerockresearch.in/dev/2010/07/ongoing-notifications-in-android/"&gt;I have blogged about is here&lt;/a&gt;. There's also a link to the source there which you can directly run.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-8108442231871821202?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/8108442231871821202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/07/ongoing-notifications-in-android.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/8108442231871821202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/8108442231871821202'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/07/ongoing-notifications-in-android.html' title='Ongoing notifications in Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-6883384841773375870</id><published>2010-06-26T22:53:00.000-07:00</published><updated>2010-06-26T22:53:13.886-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTC Hero'/><category scheme='http://www.blogger.com/atom/ns#' term='Android 2.1 upgrade'/><title type='text'>India get's Android 2.1 upgrade for HTC Hero</title><content type='html'>What a good morning it is! I thought, I HTC hero would never get a firmware upgrade, and I would be stuck with Android 1.5 forever. But, this morning, I found a dialog asking me to upgrade the firmware. NICE!!!!&lt;br /&gt;
&lt;br /&gt;
But, it seems that this is a two step upgrade process. The first one is the:&lt;br /&gt;
&amp;nbsp;"&lt;span id="ctl00_ContentPlaceHolder1_RepContent_ctl01_lblContent"&gt;&lt;span style="font-size: x-small;"&gt;&lt;strong&gt;&lt;span lang="EN-US"&gt;&lt;span style="color: black;"&gt;Firmware  over-the-air (FOTA) client update &amp;amp; YouTube player Update.&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="color: #82786f; font-size: x-small;"&gt;&lt;span lang="EN-US"&gt;" &lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="color: black;"&gt;&lt;span style="font-size: small;"&gt;&lt;span id="ctl00_ContentPlaceHolder1_RepContent_ctl01_lblContent"&gt;&lt;strong&gt;&lt;span lang="EN-US"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span id="ctl00_ContentPlaceHolder1_RepContent_ctl01_lblContent"&gt;&lt;span style="font-size: x-small;"&gt;&lt;strong&gt;&lt;span style="color: #82786f; font-size: x-small;"&gt;&lt;span lang="EN-US"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black; font-weight: normal;"&gt;After you install this upgrade, you will finally be able to upgrade to Android 2.1 when the FOTA client is upgraded. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span id="ctl00_ContentPlaceHolder1_RepContent_ctl01_lblContent"&gt;&lt;span style="font-size: x-small;"&gt;&lt;strong&gt;&lt;span style="color: #82786f; font-size: x-small;"&gt;&lt;span lang="EN-US"&gt;&lt;br /&gt;
"&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_RepContent_ctl00_lblContent"&gt;&lt;span style="font-size: x-small;"&gt;&lt;strong&gt;&lt;span lang="EN-US"&gt;&lt;span style="color: black;"&gt;Android 2.1 Platform Upgrade&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="color: #82786f; font-size: x-small;"&gt;&lt;span lang="EN-US"&gt; "&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span id="ctl00_ContentPlaceHolder1_RepContent_ctl00_lblContent"&gt;&lt;span style="font-size: x-small;"&gt;&lt;strong&gt;&lt;span style="color: #82786f; font-size: x-small;"&gt;&lt;span lang="EN-US"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="color: black;"&gt;&lt;span style="font-size: small;"&gt;&lt;span id="ctl00_ContentPlaceHolder1_RepContent_ctl00_lblContent"&gt;&lt;strong&gt;&lt;span lang="EN-US"&gt;You can find information about this update on HTC india's website. Here is the link.&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: black;"&gt;&lt;span style="font-size: small;"&gt;&lt;span id="ctl00_ContentPlaceHolder1_RepContent_ctl00_lblContent"&gt;&lt;strong&gt;&lt;span lang="EN-US"&gt;&lt;a href="http://www.htc.com/in/support.aspx"&gt;http://www.htc.com/in/support.aspx &lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span id="ctl00_ContentPlaceHolder1_RepContent_ctl00_lblContent"&gt;&lt;span style="font-size: x-small;"&gt;&lt;strong&gt;&lt;span style="color: #82786f; font-size: x-small;"&gt;&lt;span lang="EN-US"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-6883384841773375870?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/6883384841773375870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/06/india-gets-android-21-upgrade-for-htc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/6883384841773375870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/6883384841773375870'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/06/india-gets-android-21-upgrade-for-htc.html' title='India get&apos;s Android 2.1 upgrade for HTC Hero'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-7573208421683663936</id><published>2010-06-16T13:52:00.000-07:00</published><updated>2010-06-16T14:28:10.225-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android Tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='examples'/><title type='text'>Parcelable - How to do that in Android</title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;   &lt;p&gt;Passing data between activities is quite easy. You would normally do that using the Bundle packed into an intent. But sometimes you need to pass complex objects from one activity to another. One workaround would be to keep a static instance of the object int your Activity and access it from you new Activity. This might help, but it's definitely not a good way to do this. To pass such objects directly through the Bundle, your class would need to implement the Parcelable interface.     &lt;br /&gt;      &lt;br /&gt;For example you have a class called Student, which has three fields.      &lt;br /&gt;1. id      &lt;br /&gt;2. name      &lt;br /&gt;3. grade      &lt;br /&gt;      &lt;br /&gt;You can create a POJO class for this, but you need to add some extra code to make it Parcelable. Have a look at the implementation.&lt;/p&gt;    &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;     &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;       &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Student &lt;span style="color: #0000ff"&gt;implements&lt;/span&gt; Parcelable{&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; String id;&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum3" style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; String name;&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum4" style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; String grade;&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum5" style="color: #606060"&gt;   5:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum6" style="color: #606060"&gt;   6:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Constructor&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum7" style="color: #606060"&gt;   7:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Student(String id, String name, String grade){&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum8" style="color: #606060"&gt;   8:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.id = id;&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum9" style="color: #606060"&gt;   9:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.name = name;&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum10" style="color: #606060"&gt;  10:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.grade = grade;&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum11" style="color: #606060"&gt;  11:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum12" style="color: #606060"&gt;  12:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Getter and setter methods&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum13" style="color: #606060"&gt;  13:&lt;/span&gt;     .........&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum14" style="color: #606060"&gt;  14:&lt;/span&gt;     .........&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum15" style="color: #606060"&gt;  15:&lt;/span&gt;     &lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum16" style="color: #606060"&gt;  16:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Parcelling part&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum17" style="color: #606060"&gt;  17:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Student(Parcel in){&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum18" style="color: #606060"&gt;  18:&lt;/span&gt;         String[] data = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; String[3];&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum19" style="color: #606060"&gt;  19:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum20" style="color: #606060"&gt;  20:&lt;/span&gt;         in.readStringArray(data);&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum21" style="color: #606060"&gt;  21:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.id = data[0];&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum22" style="color: #606060"&gt;  22:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.name = data[1];&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum23" style="color: #606060"&gt;  23:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.grade = data[2];&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum24" style="color: #606060"&gt;  24:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum25" style="color: #606060"&gt;  25:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum26" style="color: #606060"&gt;  26:&lt;/span&gt;     @override&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum27" style="color: #606060"&gt;  27:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; describeContents(){&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum28" style="color: #606060"&gt;  28:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; 0;&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum29" style="color: #606060"&gt;  29:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum30" style="color: #606060"&gt;  30:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum31" style="color: #606060"&gt;  31:&lt;/span&gt;     @Override&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum32" style="color: #606060"&gt;  32:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; writeToParcel(Parcel dest, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; flags) {&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum33" style="color: #606060"&gt;  33:&lt;/span&gt;         dest.writeStringArray(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; String[] {&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.id,&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum34" style="color: #606060"&gt;  34:&lt;/span&gt;                                             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.name,&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum35" style="color: #606060"&gt;  35:&lt;/span&gt;                                             &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.grade});&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum36" style="color: #606060"&gt;  36:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum37" style="color: #606060"&gt;  37:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;final&lt;/span&gt; Parcelable.Creator CREATOR = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Parcelable.Creator() {&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum38" style="color: #606060"&gt;  38:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Student createFromParcel(Parcel in) {&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum39" style="color: #606060"&gt;  39:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Student(in); &lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum40" style="color: #606060"&gt;  40:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum41" style="color: #606060"&gt;  41:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum42" style="color: #606060"&gt;  42:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Student[] newArray(&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; size) {&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum43" style="color: #606060"&gt;  43:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Student[size];&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum44" style="color: #606060"&gt;  44:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum45" style="color: #606060"&gt;  45:&lt;/span&gt;     };&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum46" style="color: #606060"&gt;  46:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;
    &lt;br /&gt;Once you have created this class, you can easily pass objects of this class through the Intent like this, and recover this object in the target activity.&lt;/p&gt;

  &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;
    &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;
      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; intent.putExtra(&lt;span style="color: #006080"&gt;&amp;quot;student&amp;quot;&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Student(&lt;span style="color: #006080"&gt;&amp;quot;1&amp;quot;&lt;/span&gt;,&lt;span style="color: #006080"&gt;&amp;quot;Mike&amp;quot;&lt;/span&gt;,&lt;span style="color: #006080"&gt;&amp;quot;6&amp;quot;&lt;/span&gt;));&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;Here, the student is the key which you would require to unparcel the data from the bundle.&lt;/p&gt;

  &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;
    &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;
      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; Bundle data = getIntent().getExtras();&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt; Student student = data.getParcelable(&lt;span style="color: #006080"&gt;&amp;quot;student&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
  &lt;/div&gt;

  &lt;p&gt;This example shows only String types. But, you can parcel any kind of data you want. Try it out.&lt;/p&gt;
&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-7573208421683663936?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/7573208421683663936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/06/parcelable-how-to-do-that-in-android.html#comment-form' title='22 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7573208421683663936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7573208421683663936'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/06/parcelable-how-to-do-that-in-android.html' title='Parcelable - How to do that in Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>22</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-5206182494196126461</id><published>2010-06-08T06:00:00.000-07:00</published><updated>2010-06-19T09:04:31.060-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Html on TextView'/><category scheme='http://www.blogger.com/atom/ns#' term='TextView'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='Html'/><title type='text'>TextView with HTML content with Images</title><content type='html'>Handling HTML content on a TextView is simple as far as the HTML coming in contains a few tags that are by default supported by Android. Simple formatting like bold, italics, font sizes can be handled without even coding a single extra line.&lt;br /&gt;
&lt;br /&gt;
Say, if you have a TextView tv, and there's some HTML string with bold and italicized text, bringing it up on the TextView is pretty simple.&lt;br /&gt;
&lt;br /&gt;
One line code for that:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;tv.setText(Html.fromHtml(source));&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
where the source is actually your HTML string. This works perfectly. But how do we show images if there are any. Well, it's a bit tricky. You have to use the other method that takes in an ImageGetter and a TagHandler.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="sympad"&gt;&lt;a href="http://developer.android.com/reference/android/text/Html.html#fromHtml%28java.lang.String,%20android.text.Html.ImageGetter,%20android.text.Html.TagHandler%29"&gt;fromHtml&lt;/a&gt;&lt;/span&gt;(&lt;a href="http://developer.android.com/reference/java/lang/String.html"&gt;String&lt;/a&gt; source, &lt;a href="http://developer.android.com/reference/android/text/Html.ImageGetter.html"&gt;Html.ImageGetter&lt;/a&gt; imageGetter, &lt;a href="http://developer.android.com/reference/android/text/Html.TagHandler.html"&gt;Html.TagHandler&lt;/a&gt; tagHandler)&lt;br /&gt;
&lt;br /&gt;
The tagHandler is for situations where you wish to handle specific tags differently. I didn't wish to do that, so I just passed null there.&lt;br /&gt;
&lt;br /&gt;
Now comes the main task. How do you get the image on to the TextView!!!!&lt;br /&gt;
&lt;br /&gt;
Implement the Html.ImageGetter's getDrawable method which handles downloading the image, or accessing it from the net, and then create a drawable and return that object.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static ImageGetter imgGetter = new Html.ImageGetter() {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public Drawable getDrawable(String source) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Drawable drawable = null;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; drawable = Drawable.createFromPath(source);&amp;nbsp; // Or fetch it from the URL&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Important&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .getIntrinsicHeight());&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return drawable;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;br /&gt;
&lt;br /&gt;
and use the method on the TextView like this.&lt;br /&gt;
&lt;b&gt;tv.setText(Html.fromHtml(source, imgGetter, null);&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This will load the TextView with the image. But this call to the getDrawable method is not asynchronous. So, until and unless that method returns, you UI will be blocked. In my case, I am creating the drawable from a local image, so, it didn't take much time. But, if you want to fetch an image from the web, you have to make this call in a separate thread, so that the UI is not blocked.&lt;br /&gt;
&lt;br /&gt;
So, check your HTML string if they contain any images that have to be downloaded. If you find any, create a thread that download that image, saves it somewhere and returns you the location of that file. Now, change the src tags to point to the local images, and call setText method on the TextView.&lt;br /&gt;
&lt;br /&gt;
And that should do it. The important thing to remember is, you have to change the HTML to point it to the file that you have downloaded.&lt;br /&gt;
&lt;br /&gt;
Sample Source code : &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn/trunk/TextViewHTML"&gt;http://code.google.com/p/myandroidwidgets/source/browse/#svn/trunk/TextViewHTML&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This sample doesn't use threads. So, your UI will be blocked unitl the image here is downloaded. So, keep waiting. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-5206182494196126461?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/5206182494196126461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/06/textview-with-html-content.html#comment-form' title='50 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/5206182494196126461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/5206182494196126461'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/06/textview-with-html-content.html' title='TextView with HTML content with Images'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>50</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-582775246708527387</id><published>2010-06-01T12:14:00.000-07:00</published><updated>2010-06-01T12:14:42.496-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='network'/><category scheme='http://www.blogger.com/atom/ns#' term='examples'/><title type='text'>Checking Network Availability</title><content type='html'>I have seen a few applications which first try to initiate a network connection before checking if any network is available or not. And then, if the request fails, they toast a message saying "No network available". This might not be the right approach in most of the situations. Before initiating a connection, we should always check the availability of a network and then proceed. Android provides a simple way by which you can know the status of the active network if any. So, why not use it. It's very simple.&lt;br /&gt;
&lt;br /&gt;
The code:&lt;br /&gt;
&lt;blockquote&gt;&amp;nbsp;public static boolean isNetworkAvailable(Context context) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; boolean value = false;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ConnectivityManager manager = (ConnectivityManager) context&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .getSystemService(Context.CONNECTIVITY_SERVICE);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NetworkInfo info = manager.getActiveNetworkInfo();&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (info != null &amp;amp;&amp;amp; info.isAvailable()) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value = true;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return value;&lt;br /&gt;
&amp;nbsp;} &lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-582775246708527387?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/582775246708527387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/06/checking-network-availability.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/582775246708527387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/582775246708527387'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/06/checking-network-availability.html' title='Checking Network Availability'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-4294766895512685096</id><published>2010-04-07T12:20:00.001-07:00</published><updated>2010-09-18T13:21:21.645-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='drag drop'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='UI'/><title type='text'>Simple Drag n Drop on Android</title><content type='html'>Till now, there is no Drag and Drop like control on the Android. This feature might come in handy in a few situations to improve the usability of your apps. Here is a simple Drag and Drop app which allows you to drag a button and drop it anywhere on the screen.&lt;br /&gt;
&lt;b&gt;Theory: Go for a FrameLayout.&lt;/b&gt;&lt;br /&gt;
FrameLayout is designed to block out an area on the screen to display a single item. You can add multiple children to a FrameLayout, but all children are pegged to the top left of the screen. Children are drawn in a stack, with the most recently added child on top.&lt;br /&gt;
&lt;b&gt;In our main layout, we have a single button. We write a touch listener which will track the touch events and also help us to move the button around the screen. In this example, we will not be moving the button, but it’s image which we set to a ImageView. Also, instead of actually moving the ImageView, we will change the padding of the ImageView as the mouse moves, which will give an impression of the ImageView being moved. &lt;/b&gt;&lt;br /&gt;
&lt;a href="http://lh6.ggpht.com/__9PneCDHGgs/S7za84Y2DnI/AAAAAAAACOo/VXC2360DtBs/s1600-h/1%5B5%5D.png"&gt;&lt;img alt="1" border="0" height="244" src="http://lh6.ggpht.com/__9PneCDHGgs/S7za92Ty8_I/AAAAAAAACOs/vidkr4Ps4e8/1_thumb%5B1%5D.png?imgmax=800" style="border: 0px none; display: inline;" title="1" width="170" /&gt;&lt;/a&gt;&lt;a href="http://lh4.ggpht.com/__9PneCDHGgs/S7za-4NIDDI/AAAAAAAACOw/2gQoJTb9P5g/s1600-h/2%5B6%5D.png"&gt;&lt;img alt="2" border="0" height="244" src="http://lh4.ggpht.com/__9PneCDHGgs/S7zbAG5P1UI/AAAAAAAACO0/IU_MUoPyBdU/2_thumb%5B2%5D.png?imgmax=800" style="border: 0px none; display: inline;" title="2" width="166" /&gt;&lt;/a&gt; &lt;br /&gt;
The source code for this can be found on this link.&lt;br /&gt;
&lt;a href="https://myandroidwidgets.googlecode.com/svn/trunk/DragDrop"&gt;Drag and Drop example&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-4294766895512685096?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/4294766895512685096/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/04/simple-drag-n-drop-on-android.html#comment-form' title='26 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/4294766895512685096'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/4294766895512685096'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/04/simple-drag-n-drop-on-android.html' title='Simple Drag n Drop on Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/__9PneCDHGgs/S7za92Ty8_I/AAAAAAAACOs/vidkr4Ps4e8/s72-c/1_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>26</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-6954778405659273551</id><published>2010-04-05T02:33:00.000-07:00</published><updated>2010-04-05T02:33:10.407-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Progress Bar'/><category scheme='http://www.blogger.com/atom/ns#' term='UI'/><category scheme='http://www.blogger.com/atom/ns#' term='Custom Widgets'/><title type='text'>Custom ProgressBar for Android</title><content type='html'>We will try to make a new progress bar with our own progress animation. It's pretty simple and can be easily set up to run in few minutes. Here we go.&lt;br /&gt;
&lt;br /&gt;
1. MyProgressBar.java&lt;br /&gt;
This class extends the ProgressBar class and has two methods that we would need to call to start and stop the animation.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; To start the animation: call startAnimation()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; To stop the animation: call dismiss()&lt;br /&gt;
&lt;br /&gt;
Basically, we run a thread which keeps on switching the images. That's it. &lt;br /&gt;
&lt;br /&gt;
2. myprogressbar.xml&lt;br /&gt;
&lt;br /&gt;
This is the layout that the MyProgressBar would be using. This animation would be using 9 images which are in the drawable folder.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/__9PneCDHGgs/S7mrfNVxWzI/AAAAAAAACOc/0j4u9iB2PxM/s1600/2.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/__9PneCDHGgs/S7mrfNVxWzI/AAAAAAAACOc/0j4u9iB2PxM/s320/2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;a href="http://2.bp.blogspot.com/__9PneCDHGgs/S7mrbiX4C_I/AAAAAAAACOU/FTWwj4SPnro/s1600/1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/__9PneCDHGgs/S7mrbiX4C_I/AAAAAAAACOU/FTWwj4SPnro/s320/1.png" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can check out the whole project from the SVN. Here is the link.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="https://myandroidwidgets.googlecode.com/svn/trunk/Custom_Progress_Bar"&gt;https://myandroidwidgets.googlecode.com/svn/trunk/Custom_Progress_Bar&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-6954778405659273551?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/6954778405659273551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/04/custom-progressbar-for-android.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/6954778405659273551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/6954778405659273551'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/04/custom-progressbar-for-android.html' title='Custom ProgressBar for Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/__9PneCDHGgs/S7mrfNVxWzI/AAAAAAAACOc/0j4u9iB2PxM/s72-c/2.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-5200924367779214758</id><published>2010-04-03T12:59:00.001-07:00</published><updated>2011-08-11T23:51:27.946-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Widgets'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Hacks'/><category scheme='http://www.blogger.com/atom/ns#' term='UI'/><category scheme='http://www.blogger.com/atom/ns#' term='Custom Widgets'/><title type='text'>Custom AutoComplete for Android</title><content type='html'>The default custom AutoCompleteTextView is quite a nice widget. But if you want to extend it's functionality, you will need to write your own custom widget. As an example, if you wish to have a EditText for a "To" address field as any email application has, where you want to collect multiple selections from the list that pops up, you will need to extend the AutoCompleteTextView class and write your own small little widget. It's very simple to create one that will suit your need.&lt;br /&gt;
So here we go.&lt;br /&gt;
1. Class CustomAutoComplete.java&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;
&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &lt;span style="color: blue;"&gt;package&lt;/span&gt; com.beanie.example.widgets;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; &lt;span style="color: blue;"&gt;import&lt;/span&gt; android.content.Context;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt; &lt;span style="color: blue;"&gt;import&lt;/span&gt; android.text.TextUtils;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt; &lt;span style="color: blue;"&gt;import&lt;/span&gt; android.util.AttributeSet;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt; &lt;span style="color: blue;"&gt;import&lt;/span&gt; android.widget.AutoCompleteTextView;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; CustomAutoComplete &lt;span style="color: blue;"&gt;extends&lt;/span&gt; AutoCompleteTextView {&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;     &lt;span style="color: blue;"&gt;private&lt;/span&gt; String previous = &lt;span style="color: #006080;"&gt;""&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;     &lt;span style="color: blue;"&gt;private&lt;/span&gt; String seperator = &lt;span style="color: #006080;"&gt;";"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; CustomAutoComplete(&lt;span style="color: blue;"&gt;final&lt;/span&gt; Context context, &lt;span style="color: blue;"&gt;final&lt;/span&gt; AttributeSet attrs, &lt;span style="color: blue;"&gt;final&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; defStyle) {&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;         &lt;span style="color: blue;"&gt;super&lt;/span&gt;(context, attrs, defStyle);&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;         &lt;span style="color: blue;"&gt;this&lt;/span&gt;.setThreshold(0);&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; CustomAutoComplete(&lt;span style="color: blue;"&gt;final&lt;/span&gt; Context context, &lt;span style="color: blue;"&gt;final&lt;/span&gt; AttributeSet attrs) {&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum15" style="color: #606060;"&gt;  15:&lt;/span&gt;         &lt;span style="color: blue;"&gt;super&lt;/span&gt;(context, attrs);&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum16" style="color: #606060;"&gt;  16:&lt;/span&gt;         &lt;span style="color: blue;"&gt;this&lt;/span&gt;.setThreshold(0);&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum17" style="color: #606060;"&gt;  17:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum18" style="color: #606060;"&gt;  18:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; CustomAutoComplete(&lt;span style="color: blue;"&gt;final&lt;/span&gt; Context context) {&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum19" style="color: #606060;"&gt;  19:&lt;/span&gt;         &lt;span style="color: blue;"&gt;super&lt;/span&gt;(context);&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum20" style="color: #606060;"&gt;  20:&lt;/span&gt;         &lt;span style="color: blue;"&gt;this&lt;/span&gt;.setThreshold(0);&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum21" style="color: #606060;"&gt;  21:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum22" style="color: #606060;"&gt;  22:&lt;/span&gt;     &lt;span style="color: green;"&gt;/**&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum23" style="color: #606060;"&gt;  23:&lt;/span&gt; &lt;span style="color: green;"&gt;     * This method filters out the existing text till the separator&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum24" style="color: #606060;"&gt;  24:&lt;/span&gt; &lt;span style="color: green;"&gt;     * and launched the filtering process again&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum25" style="color: #606060;"&gt;  25:&lt;/span&gt; &lt;span style="color: green;"&gt;     */&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum26" style="color: #606060;"&gt;  26:&lt;/span&gt;     @Override&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum27" style="color: #606060;"&gt;  27:&lt;/span&gt;     &lt;span style="color: blue;"&gt;protected&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; performFiltering(&lt;span style="color: blue;"&gt;final&lt;/span&gt; CharSequence text, &lt;span style="color: blue;"&gt;final&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; keyCode) {&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum28" style="color: #606060;"&gt;  28:&lt;/span&gt;         String filterText = text.toString().trim();&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum29" style="color: #606060;"&gt;  29:&lt;/span&gt;         previous = filterText.substring(0,filterText.lastIndexOf(getSeperator())+1);&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum30" style="color: #606060;"&gt;  30:&lt;/span&gt;         filterText = filterText.substring(filterText.lastIndexOf(getSeperator()) + 1);&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum31" style="color: #606060;"&gt;  31:&lt;/span&gt;         &lt;span style="color: blue;"&gt;if&lt;/span&gt;(!TextUtils.isEmpty(filterText)){&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum32" style="color: #606060;"&gt;  32:&lt;/span&gt;             &lt;span style="color: blue;"&gt;super&lt;/span&gt;.performFiltering(filterText, keyCode);&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum33" style="color: #606060;"&gt;  33:&lt;/span&gt;         }&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum34" style="color: #606060;"&gt;  34:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum35" style="color: #606060;"&gt;  35:&lt;/span&gt;     &lt;span style="color: green;"&gt;/**&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum36" style="color: #606060;"&gt;  36:&lt;/span&gt; &lt;span style="color: green;"&gt;     * After a selection, capture the new value and append to the existing&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum37" style="color: #606060;"&gt;  37:&lt;/span&gt; &lt;span style="color: green;"&gt;     * text&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum38" style="color: #606060;"&gt;  38:&lt;/span&gt; &lt;span style="color: green;"&gt;     */&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum39" style="color: #606060;"&gt;  39:&lt;/span&gt;     @Override&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum40" style="color: #606060;"&gt;  40:&lt;/span&gt;     &lt;span style="color: blue;"&gt;protected&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; replaceText(&lt;span style="color: blue;"&gt;final&lt;/span&gt; CharSequence text) {&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum41" style="color: #606060;"&gt;  41:&lt;/span&gt;         &lt;span style="color: blue;"&gt;super&lt;/span&gt;.replaceText(previous+text+getSeperator());&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum42" style="color: #606060;"&gt;  42:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum43" style="color: #606060;"&gt;  43:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; String getSeperator() {&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum44" style="color: #606060;"&gt;  44:&lt;/span&gt;         &lt;span style="color: blue;"&gt;return&lt;/span&gt; seperator;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum45" style="color: #606060;"&gt;  45:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum46" style="color: #606060;"&gt;  46:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; setSeperator(&lt;span style="color: blue;"&gt;final&lt;/span&gt; String seperator) {&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum47" style="color: #606060;"&gt;  47:&lt;/span&gt;         &lt;span style="color: blue;"&gt;this&lt;/span&gt;.seperator = seperator;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum48" style="color: #606060;"&gt;  48:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum49" style="color: #606060;"&gt;  49:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
This class is the main widget class that extends thet AutoCompleteTextView. You have to override 2 methods,&lt;br /&gt;
&lt;blockquote&gt;
protected void replaceText(final CharSequence text) &lt;/blockquote&gt;
&lt;blockquote&gt;
protected void performFiltering(final CharSequence text, final int keyCode) &lt;/blockquote&gt;
2. You main layout file (main.xml)&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;
&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &amp;amp;lt;?xml version=&lt;span style="color: #006080;"&gt;"1.0"&lt;/span&gt; encoding=&lt;span style="color: #006080;"&gt;"utf-8"&lt;/span&gt;?&amp;amp;gt;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; &amp;amp;lt;LinearLayout xmlns:android=&lt;span style="color: #006080;"&gt;"http://schemas.android.com/apk/res/android"&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;     android:orientation=&lt;span style="color: #006080;"&gt;"vertical"&lt;/span&gt; android:layout_width=&lt;span style="color: #006080;"&gt;"fill_parent"&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;     android:layout_height=&lt;span style="color: #006080;"&gt;"fill_parent"&lt;/span&gt;&amp;amp;gt;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;     &amp;amp;lt;com.beanie.example.widgets.CustomAutoComplete android:layout_width=&lt;span style="color: #006080;"&gt;"fill_parent"&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;         android:layout_height=&lt;span style="color: #006080;"&gt;"wrap_content"&lt;/span&gt; android:id=&lt;span style="color: #006080;"&gt;"@+id/autocomplete"&lt;/span&gt;/&amp;amp;gt;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt; &amp;amp;lt;/LinearLayout&amp;amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
3. Now we test it. This is your activity class. &lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;
&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &lt;span style="color: blue;"&gt;package&lt;/span&gt; com.beanie.example;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; &lt;span style="color: blue;"&gt;import&lt;/span&gt; android.app.Activity;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt; &lt;span style="color: blue;"&gt;import&lt;/span&gt; android.os.Bundle;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt; &lt;span style="color: blue;"&gt;import&lt;/span&gt; android.widget.ArrayAdapter;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt; &lt;span style="color: blue;"&gt;import&lt;/span&gt; com.beanie.example.widgets.CustomAutoComplete;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; TestAutoComplete &lt;span style="color: blue;"&gt;extends&lt;/span&gt; Activity {&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;     &lt;span style="color: green;"&gt;/** Called when the activity is first created. */&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;     @Override&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; onCreate(Bundle savedInstanceState) {&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;         &lt;span style="color: blue;"&gt;super&lt;/span&gt;.onCreate(savedInstanceState);&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;         setContentView(R.layout.main);&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;         CustomAutoComplete myAutoComplete = (CustomAutoComplete)findViewById(R.id.autocomplete);&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt;         ArrayAdapter&amp;amp;lt;String&amp;amp;gt; adapter = &lt;span style="color: blue;"&gt;new&lt;/span&gt; ArrayAdapter&amp;amp;lt;String&amp;amp;gt;(&lt;span style="color: blue;"&gt;this&lt;/span&gt;, android.R.layout.simple_dropdown_item_1line);&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum15" style="color: #606060;"&gt;  15:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum16" style="color: #606060;"&gt;  16:&lt;/span&gt;         adapter.add(&lt;span style="color: #006080;"&gt;"aaaa"&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum17" style="color: #606060;"&gt;  17:&lt;/span&gt;         adapter.add(&lt;span style="color: #006080;"&gt;"abaa"&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum18" style="color: #606060;"&gt;  18:&lt;/span&gt;         adapter.add(&lt;span style="color: #006080;"&gt;"acaa"&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum19" style="color: #606060;"&gt;  19:&lt;/span&gt;         adapter.add(&lt;span style="color: #006080;"&gt;"adaa"&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum20" style="color: #606060;"&gt;  20:&lt;/span&gt;         adapter.add(&lt;span style="color: #006080;"&gt;"aaba"&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum21" style="color: #606060;"&gt;  21:&lt;/span&gt;         adapter.add(&lt;span style="color: #006080;"&gt;"aaca"&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum22" style="color: #606060;"&gt;  22:&lt;/span&gt;         adapter.add(&lt;span style="color: #006080;"&gt;"aaba"&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum23" style="color: #606060;"&gt;  23:&lt;/span&gt;         adapter.add(&lt;span style="color: #006080;"&gt;"aaae"&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum24" style="color: #606060;"&gt;  24:&lt;/span&gt;         &lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum25" style="color: #606060;"&gt;  25:&lt;/span&gt;         myAutoComplete.setAdapter(adapter);&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum26" style="color: #606060;"&gt;  26:&lt;/span&gt;     }&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum27" style="color: #606060;"&gt;  27:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href="http://lh3.ggpht.com/__9PneCDHGgs/S7eeL-UA2UI/AAAAAAAACNw/Z-MZVUkcLfc/s1600-h/1%5B3%5D.png" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img align="right" alt="1" border="0" height="244" src="http://lh5.ggpht.com/__9PneCDHGgs/S7eeOZXsaUI/AAAAAAAACN0/CgJkDiN7FRY/1_thumb%5B1%5D.png?imgmax=800" style="border-color: -moz-use-text-color; border-style: none; border-width: 0px; display: inline; margin-left: 0px; margin-right: 0px;" title="1" width="166" /&gt;&lt;/a&gt;Voila, you are done. Here’s a screenshot of our Custom Auto-Complete Text view at work.&lt;br /&gt;
 &lt;br /&gt;
You can also change the separator from the default “;” to any other character like a “,” or anything else.&lt;br /&gt;
On the adapter, you call the method setSeparator(String any);&lt;br /&gt;
Now you have your own custom auto-complete widget for Android.&lt;br /&gt;
&lt;br /&gt;
For this particular example, however, Android provides you a widget by default. &lt;a href="http://developer.android.com/reference/android/widget/MultiAutoCompleteTextView.html"&gt;MultiAutoCompleteTextView&lt;/a&gt; is specifically designed to handle such kind of input. &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-5200924367779214758?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/5200924367779214758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/04/custom-autocomplete-for-android.html#comment-form' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/5200924367779214758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/5200924367779214758'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/04/custom-autocomplete-for-android.html' title='Custom AutoComplete for Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/__9PneCDHGgs/S7eeOZXsaUI/AAAAAAAACN0/CgJkDiN7FRY/s72-c/1_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-7536459437748019284</id><published>2010-03-24T11:22:00.000-07:00</published><updated>2010-03-24T11:22:58.560-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='UI'/><category scheme='http://www.blogger.com/atom/ns#' term='Custom Widgets'/><title type='text'>Custom Buttons on Android</title><content type='html'>The default buttons are a kind of ugly when you change the background of an activity. In some scenarios, you will be forced to change the way your Buttons look. To achieve this, you need not create your own custom Button class. The Android framework provides ways to achieve this with minimum effort.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's say we have a Button in a simple layout for which we need to do this. Here is a simple layout with just a button.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;
&amp;lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; android:orientation="vertical"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_width="fill_parent"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_height="fill_parent"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&lt;br /&gt;
&amp;lt;Button&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_width="fill_parent"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_height="wrap_content"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; android:text="@string/click"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; android:background="@drawable/custom_button"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; /&amp;gt;&lt;br /&gt;
&amp;lt;/LinearLayout&amp;gt;&lt;/blockquote&gt;Note the android:background attribute on the Button. This refers to a drawable which is an xml in your drawable folder which will determine the different states of your button, namely,&lt;br /&gt;
1. default&lt;br /&gt;
2. pressed&lt;br /&gt;
3. focussed&lt;br /&gt;
&lt;br /&gt;
This is the code for custom_button.xml:&lt;br /&gt;
&lt;blockquote&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;
&amp;lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/focussed" /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/focussedandpressed" /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/pressed" /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;item android:drawable="@drawable/default" /&amp;gt;&lt;br /&gt;
&amp;lt;/selector&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;
For this selector tag, note all the drawable attributes. You will have different png images for each of the states which you would put in your drawable folder.&lt;br /&gt;
&lt;br /&gt;
Now you have your own custom button with customized look and feel.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-7536459437748019284?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/7536459437748019284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/03/custom-buttons-on-android.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7536459437748019284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7536459437748019284'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/03/custom-buttons-on-android.html' title='Custom Buttons on Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-3406668428472813281</id><published>2010-03-11T04:07:00.000-08:00</published><updated>2010-03-11T04:25:37.075-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Intents'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='Youtube'/><title type='text'>Youtube/Market Intent for Search in Android</title><content type='html'>Here is a trick that would help other applications that need to open search results for videos based on a particular keyword.&lt;br /&gt;
&lt;br /&gt;
You need to create an implicit Intent and trigger it. Here is a snippet of code that works.&lt;br /&gt;
&lt;br /&gt;
&lt;b style="color: #ffd966;"&gt;For Youtube&lt;/b&gt;&lt;br /&gt;
Intent intent = new Intent(Intent.ACTION_SEARCH);&lt;br /&gt;
&lt;b&gt;intent.setPackage("com.google.android.youtube");&lt;/b&gt;&lt;br /&gt;
intent.putExtra("query", &lt;b&gt;"Android"&lt;/b&gt;);&lt;br /&gt;
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);&lt;br /&gt;
startActivity(intent);&lt;br /&gt;
&lt;br /&gt;
Here, "Android" is the keyword. Now, the Youtube app will show you videos with the keyword "Android"&lt;br /&gt;
&lt;br /&gt;
&lt;b style="color: #ffd966;"&gt;For Market &lt;/b&gt;&lt;br /&gt;
Similarly, by changing only the package name, you can bring up search results with the Android Market app as well.&lt;br /&gt;
&lt;br /&gt;
Intent intent = new Intent(Intent.ACTION_SEARCH);&lt;br /&gt;
&lt;b&gt;intent.setPackage("com.android.vending");&lt;/b&gt;&lt;br /&gt;
intent.putExtra("query", &lt;b&gt;"Android"&lt;/b&gt;);&lt;br /&gt;
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);&lt;br /&gt;
startActivity(intent);&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #ffd966;"&gt;For Contacts&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The package name for the Contacts app is "com.google.contacts". &lt;br /&gt;
&lt;br /&gt;
You just need the package name of the target app if you don't want the Resolver activity to show up. This might work for other google apps as well. I haven't checked though.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-3406668428472813281?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/3406668428472813281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/03/youtube-intent-for-search-in-android.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/3406668428472813281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/3406668428472813281'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/03/youtube-intent-for-search-in-android.html' title='Youtube/Market Intent for Search in Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-2656867643790458241</id><published>2010-02-25T23:00:00.000-08:00</published><updated>2010-02-25T23:16:15.807-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Apps'/><category scheme='http://www.blogger.com/atom/ns#' term='Signing android apps'/><category scheme='http://www.blogger.com/atom/ns#' term='Keystore'/><category scheme='http://www.blogger.com/atom/ns#' term='Signed apk'/><title type='text'>Sign your Android applications for release</title><content type='html'>&lt;div style="text-align: left;"&gt;&lt;b&gt;&lt;span style="font-size: x-large;"&gt;T&lt;/span&gt;&lt;/b&gt;he process of application signing can be very confusing for new developers. But, once you have done it 2-3 times, it will be more like a chore for you after that. It's not very complicated at all. So, here are the steps that you need to follow.&lt;/div&gt;&lt;br /&gt;
Note: If you already have a self-signed certificate/keystore, skip to step 2(b):&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1:&lt;/b&gt; Right click on the Android project. From the context menu, select, &lt;b&gt;Android Tools -&amp;gt; Export Signed application package&lt;/b&gt;. In the dialog that will open, you will see the name of your project. If you have selected the wrong project, here is a chance to correct yourself. Click on "Next".&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&amp;nbsp;&lt;a href="http://3.bp.blogspot.com/__9PneCDHGgs/S4drWyCeguI/AAAAAAAACHE/yXIHn5R28fc/s1600-h/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/__9PneCDHGgs/S4drWyCeguI/AAAAAAAACHE/yXIHn5R28fc/s320/1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;b&gt;Step 2:&lt;/b&gt;&amp;nbsp; The next screen is the most complicated screen that you will get in this process. Here, you can have two situations.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;b&gt;a.&lt;/b&gt; If you don't have a keystore already, you will need to create one first. Once created, you should preserve this keystore somewhere, safely, so that you don't accidentally delete it. You will need this keystore everytime you want to sign and update your application to the Android Market. Please, please, please, DO NOT LOSE THIS KEYSTORE. &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href="http://4.bp.blogspot.com/__9PneCDHGgs/S4dtDeQRj7I/AAAAAAAACHU/cZNExzIm338/s1600-h/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/__9PneCDHGgs/S4dtDeQRj7I/AAAAAAAACHU/cZNExzIm338/s320/3.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Since, we are creating a new keystore this time, select the second radio, and browse to a location where you want you new keystore to be saved. Enter and confirm a password. Remember this password. Click on "Next". &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/__9PneCDHGgs/S4dtwlNfW5I/AAAAAAAACHc/Ry45iqFRzEU/s1600-h/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/__9PneCDHGgs/S4dtwlNfW5I/AAAAAAAACHc/Ry45iqFRzEU/s320/4.png" /&gt; &lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Enter all the fields in this screen and press enter. Now your keystore will be created. Please rememeber all your passwords. Else, this keystore will be useless for you later.For simplicity, keep both the passwords same.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/__9PneCDHGgs/S4duQowO6VI/AAAAAAAACHk/nQO_tiPfVLo/s1600-h/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/__9PneCDHGgs/S4duQowO6VI/AAAAAAAACHk/nQO_tiPfVLo/s320/5.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;On this screen, specify a name and location of the apk and click on "Finish". Your signed application package will be created for you in the location you have mentioned here. You can now take this apk and directly upload it to the Android market, or put it on your phone.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;b&gt;b.&lt;/b&gt; When you already have a kestore, it's more easier to sign your application. On the second screen, select, "Use existing keystore". Enter the location of the keystore and password. Click on "Next". On the next screen, select you alias from the drop down, enter the alias password, click on "Next". On the next screen, specify a name and location where you want the apk to be created and click "Finish". You are done now. &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/__9PneCDHGgs/S4dv19ZyIPI/AAAAAAAACHs/jj9iHp0i5HE/s1600-h/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="273" src="http://3.bp.blogspot.com/__9PneCDHGgs/S4dv19ZyIPI/AAAAAAAACHs/jj9iHp0i5HE/s320/6.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/__9PneCDHGgs/S4dv7aBgLyI/AAAAAAAACH0/-0nl2F4ztQc/s1600-h/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="268" src="http://3.bp.blogspot.com/__9PneCDHGgs/S4dv7aBgLyI/AAAAAAAACH0/-0nl2F4ztQc/s320/7.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Isn't it simple? Just one point to note: If you are using an old ADT version, this option of signing your apps from eclipse might now be there. In such a case, you will have to do it through command line. You can find many tutorials on how to achieve that.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;The official document can be found here: &lt;a href="http://developer.android.com/guide/publishing/app-signing.html#signing"&gt;http://developer.android.com/guide/publishing/app-signing.html#signing&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Thanks,&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Kumar&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&amp;nbsp; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-2656867643790458241?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/2656867643790458241/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/02/sign-your-android-applications-for.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/2656867643790458241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/2656867643790458241'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/02/sign-your-android-applications-for.html' title='Sign your Android applications for release'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/__9PneCDHGgs/S4drWyCeguI/AAAAAAAACHE/yXIHn5R28fc/s72-c/1.png' height='72' width='72'/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-6798696427890482457</id><published>2010-02-02T02:46:00.000-08:00</published><updated>2010-02-02T03:09:03.753-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android Apps'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Market'/><title type='text'>Market your apps aggresively</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/__9PneCDHGgs/S2gBczA9N2I/AAAAAAAACFw/94kQQapkGu4/s1600-h/logo-market.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/__9PneCDHGgs/S2gBczA9N2I/AAAAAAAACFw/94kQQapkGu4/s1600/logo-market.png" /&gt;&lt;/a&gt;You have created a cool app, and have also updated it unto the Android Market. Great!!!! So, do you sit idle and wait for people to buy your app? Is your work done? A big "NO".&lt;br /&gt;
&lt;br /&gt;
The Android Market has around 20000 apps today. And new apps are pouring in daily in large numbers. How do you tell people/users, "Hey, people, here is a cool app that you should check out"? From among these 20000 apps, people will never bother to enter your app's name in the search box. They just don't have the time.&lt;br /&gt;
&lt;br /&gt;
So, how do you go about and spread the word about your app? Well, here are some tips.&lt;br /&gt;
&lt;br /&gt;
1. Create a website for your app and update it regularly.&lt;br /&gt;
2. Create a blog for your app and provide as much information as you want about upcoming features, bugs and maybe tutorials.&lt;br /&gt;
3. Use twitter to reach to your friends.&lt;br /&gt;
4. Facebook also is quite a good medium through which you can broadcast your message on everybody's walls.&lt;br /&gt;
5. Create a forum for your app where people can come in and enter their issues/experiences.&lt;br /&gt;
6. Request some Android app websites to publish a review for your app.&lt;br /&gt;
7. Submit links to your website/blog to a few bookmarking websites, don't over-do it though.&lt;br /&gt;
8. If you want, you can also submit to alternate websites for the Android Market for people who don't have access to the market.&lt;br /&gt;
9. Make sure that your app has an apt description about what it does when you upload it to the market.&lt;br /&gt;
10. Ask for feedback from people who use your application regularly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-6798696427890482457?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/6798696427890482457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2010/02/market-you-apps-aggresively.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/6798696427890482457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/6798696427890482457'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2010/02/market-you-apps-aggresively.html' title='Market your apps aggresively'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/__9PneCDHGgs/S2gBczA9N2I/AAAAAAAACFw/94kQQapkGu4/s72-c/logo-market.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-3424118063026941146</id><published>2009-11-06T09:22:00.001-08:00</published><updated>2009-11-06T09:31:37.173-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android Hacks'/><category scheme='http://www.blogger.com/atom/ns#' term='Market on Emulator'/><category scheme='http://www.blogger.com/atom/ns#' term='Emulator and Paid Apps'/><title type='text'>Market on Emulator</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/__9PneCDHGgs/SvRdUYPFYEI/AAAAAAAABus/DKNasulX208/s1600-h/android-market-europe1.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 188px;" src="http://1.bp.blogspot.com/__9PneCDHGgs/SvRdUYPFYEI/AAAAAAAABus/DKNasulX208/s200/android-market-europe1.jpg" alt="" id="BLOGGER_PHOTO_ID_5401044457808552002" border="0" /&gt;&lt;/a&gt;
So, finally, we have Android Market on our emulators. Now, since it is possible, a developer can create any number of emulators with the android market on it, and login to different google accounts, and try to increase his app's ratings.

This is actually too dangerous. Google doesn't discriminate requests from market apps on such emulators, and still accepts ratings and reviews. I don't know how Google can now stop this, since, everybody and anybody can now have access to the market place from his emulator.

But, I am happy, :)

Till Google takes any steps to curb this backdoor entry through the emulators, we can obviously expect some of those comments/reviews on the apps to be just spam.  :(

Google market has got to do something to stop this, and probably they will.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-3424118063026941146?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/3424118063026941146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2009/11/market-on-emulator.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/3424118063026941146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/3424118063026941146'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2009/11/market-on-emulator.html' title='Market on Emulator'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/__9PneCDHGgs/SvRdUYPFYEI/AAAAAAAABus/DKNasulX208/s72-c/android-market-europe1.jpg' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-2043710543164597441</id><published>2009-11-04T12:03:00.000-08:00</published><updated>2009-12-04T13:14:32.438-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android Hacks'/><category scheme='http://www.blogger.com/atom/ns#' term='Market on Emulator'/><category scheme='http://www.blogger.com/atom/ns#' term='Emulator and Paid Apps'/><title type='text'>Android Market on Emulator</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/__9PneCDHGgs/SvHggC8-64I/AAAAAAAABuk/MScQZTv0dg0/s1600-h/untitled.GIF" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5400344269347023746" src="http://2.bp.blogspot.com/__9PneCDHGgs/SvHggC8-64I/AAAAAAAABuk/MScQZTv0dg0/s200/untitled.GIF" style="cursor: pointer; float: right; height: 200px; margin: 0pt 0pt 10px 10px; width: 160px;" /&gt;&lt;/a&gt;Wow, This is cool. Finally, I am able to run the Android Market on the emulator. And also, see all the paid apps and copy-protected app, right here on my emulator.&lt;br /&gt;
&lt;br /&gt;
What do you need?&lt;br /&gt;
&lt;br /&gt;
Well, the basic SDK. 1.5, 1.6 or 1.1&lt;br /&gt;
&lt;br /&gt;
And then, go to the HTC website where you can find the images/recovery images. Download the version (system image only) which you want to run.&lt;br /&gt;
&lt;br /&gt;
http://developer.htc.com/google-io-device.html#s3&lt;br /&gt;
(Download the System Image zip)&lt;br /&gt;
&lt;br /&gt;
Extract the files of this zip. There's a system.img file which you will need in the next steps.&lt;br /&gt;
&lt;br /&gt;
Create an AVD (1.1, 1.5 or 1.6) depending on your requirements.&lt;br /&gt;
&lt;br /&gt;
Copy this system.img file into the avd directory. For example, if you created an avd named "MyPhone",  go to .avd\MyPhone\  and paste this system.img file here.&lt;br /&gt;
&lt;br /&gt;
Now start the emulator. Voila, You are ready to go. After you sign in with a google account, your phone is ready to use. You now have access to all the market apps right from your emulator.&lt;br /&gt;
&lt;br /&gt;
Note: If you are not able to run it successfully, and if you are getting Network communication error, please download the AVD that I have created from this link.&lt;br /&gt;
&lt;br /&gt;
Link for 1.5 image&lt;br /&gt;
&lt;a href="http://www.4shared.com/file/147420185/da5381e1/avd.html"&gt;www.4shared.com/file/147420185/da5381e1/avd.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Link for 1.6 image&lt;br /&gt;
&lt;a href="http://www.4shared.com/file/165624746/fc72c3ed/system.html"&gt;http://www.4shared.com/file/165624746/fc72c3ed/system.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-2043710543164597441?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/2043710543164597441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2009/11/android-market-on-emulator.html#comment-form' title='208 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/2043710543164597441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/2043710543164597441'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2009/11/android-market-on-emulator.html' title='Android Market on Emulator'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/__9PneCDHGgs/SvHggC8-64I/AAAAAAAABuk/MScQZTv0dg0/s72-c/untitled.GIF' height='72' width='72'/><thr:total>208</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-1701659529250105572</id><published>2009-10-29T12:20:00.000-07:00</published><updated>2009-10-30T14:08:51.210-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Blogspot client'/><category scheme='http://www.blogger.com/atom/ns#' term='Blogger Client'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='Blogaway'/><title type='text'>Blogaway 1.0 for Android Phones</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/__9PneCDHGgs/Sunuu-yB4sI/AAAAAAAABto/nQT5yqlass4/s1600-h/33.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 134px; height: 200px;" src="http://4.bp.blogspot.com/__9PneCDHGgs/Sunuu-yB4sI/AAAAAAAABto/nQT5yqlass4/s200/33.png" alt="" id="BLOGGER_PHOTO_ID_5398108119274480322" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/__9PneCDHGgs/SununWfLQAI/AAAAAAAABtg/VJXVPsUCa14/s1600-h/22.png"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 134px; height: 200px;" src="http://4.bp.blogspot.com/__9PneCDHGgs/SununWfLQAI/AAAAAAAABtg/VJXVPsUCa14/s200/22.png" alt="" id="BLOGGER_PHOTO_ID_5398107988198899714" border="0" /&gt;&lt;/a&gt;











A simple blogger client to read, post and manage your blogspot account feeds. A convenient way to keep you connected. This initial version is still under active development.

More and more features will get added so that you can have a real Blogging experience.

Features for 1.0
- Multiple blog account support
- Multiple feeds under one account
- Create, publish or save as drafts
- Blogroll to read public Blogspot feeds
- Captcha unlock account
- Set default account to create new post, comments etc.


Future improvements
- View Comments
- Post Comments
- Add pictures/videos to posts
- Manage your accounts
- Delete feeds and accounts
- Support for other blog feeds other than Blogspot

I will be updating this application at regular intervals with more features.


Currently, adding tags to your posts is not supported. I suppose this feature is one of the most important feature for such a client.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-1701659529250105572?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/1701659529250105572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2009/10/blogaway-10-for-android-phones.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/1701659529250105572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/1701659529250105572'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2009/10/blogaway-10-for-android-phones.html' title='Blogaway 1.0 for Android Phones'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/__9PneCDHGgs/Sunuu-yB4sI/AAAAAAAABto/nQT5yqlass4/s72-c/33.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-1123495930391264992</id><published>2009-10-27T23:13:00.001-07:00</published><updated>2009-10-27T23:21:44.640-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android 2.0 Apps'/><category scheme='http://www.blogger.com/atom/ns#' term='Android 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclair UI'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclair'/><category scheme='http://www.blogger.com/atom/ns#' term='New Features'/><title type='text'>Android 2.0 !!  Overview</title><content type='html'>Here is a list of apps that have been removed from the emulator.

1. Calendar
2. Camcorder
3. Google Maps

The icons now have a new look and feel. Though I like the Donut icons, I guess, icons will keep changing.

One issue with the default-email client that is supposed to support Exchange.

I have successfully added an exchange account. But I am not able to see any new mails, and also, the mails I sent are still in the Outbox.

When I go to contacts to add contacts from my Exchange Account, the application crashed. I couldn't test if the Contact's application can really synchronize with the exchange server.

As for Google Maps, I think it will be shipped with the handsets only, as a separate application, and your code that uses Google Maps features will work on handsets, but as of now, there is no way to test such applications, unless you get it installed on your emulator.

A lot of animated transitions when you switch between screens. And the new "Unlock" feature to unlock the key pad looks cool, but I guess, it would be a bit uncomfortable to use. You should  need minimum effort to unlock your keypad.

On the surface, you will basically find a complete UI change. I haven't yet digged into the new APIs.

Have an Eclair !!!!!  :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-1123495930391264992?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/1123495930391264992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2009/10/android-20-overview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/1123495930391264992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/1123495930391264992'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2009/10/android-20-overview.html' title='Android 2.0 !!  Overview'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-5479073188216739228</id><published>2009-10-27T14:01:00.001-07:00</published><updated>2009-10-27T14:11:16.517-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Google Maps API'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclair'/><title type='text'>Android 2.0 !!! Where is Google Maps</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/__9PneCDHGgs/SudhsrQ1dNI/AAAAAAAABsg/UVX_VIMy5YE/s1600-h/eclair.png"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 200px;" src="http://1.bp.blogspot.com/__9PneCDHGgs/SudhsrQ1dNI/AAAAAAAABsg/UVX_VIMy5YE/s320/eclair.png" alt="" id="BLOGGER_PHOTO_ID_5397390098582303954" border="0" /&gt;&lt;/a&gt;
Just saw Android 2.0 (Eclairs) and downloaded it. Started the emulator, and compiled my project with 2.0 settings. I was surprised to see red marks all over the place. After looking at the console, I figured out that Android 2.0 doesn't have in-built Maps API. If your application uses the Google Maps API, then you are in for a surprise. Read on.

Now what?

In the emulator too, I didn't find the Google Maps application. Damn. But, just to test if my other functionalities were intact with the new Android 2.0, I added the maps.jar avaialble in the Android SDK as an external jar.

I thought this would solve the problem. All compile errors vanished. But when I tried to install my app, the console said,

"Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY"

To avoid this installation error, you have to remove this line from the manifest file so that Android detects the maps.jar as an external API and not an internal one.

&lt;uses-library name="com.google.android.maps"&gt;uses-library android:name="com.google.android.maps"

Now, your app will be installed without any errors. But, since there is no Google Maps application, you cannot launch or test any Google Maps feature that you application depends on. Needless to say, it will of course be available on our handsets, but this is very disappointing.

&lt;/uses-library&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-5479073188216739228?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/5479073188216739228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2009/10/android-20-where-is-google-maps.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/5479073188216739228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/5479073188216739228'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2009/10/android-20-where-is-google-maps.html' title='Android 2.0 !!! Where is Google Maps'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/__9PneCDHGgs/SudhsrQ1dNI/AAAAAAAABsg/UVX_VIMy5YE/s72-c/eclair.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-4675666573699201164</id><published>2009-10-21T10:29:00.001-07:00</published><updated>2009-10-21T10:29:43.946-07:00</updated><title type='text'>Orientation independent applications</title><content type='html'>&lt;p&gt;The Android phones detect orientation changes when you tilt your&lt;a href="http://lh5.ggpht.com/__9PneCDHGgs/St9FAQ1wIhI/AAAAAAAABsA/KeKrXjPMqJ8/s1600-h/IMG_0570%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="IMG_0570" border="0" alt="IMG_0570" align="right" src="http://lh6.ggpht.com/__9PneCDHGgs/St9FBlJ0AyI/AAAAAAAABsE/ORzFKucyxDs/IMG_0570_thumb%5B1%5D.jpg?imgmax=800" width="244" height="184" /&gt;&lt;/a&gt; phone from landscape to portrait or vice-versa. It’s a cute feature. Well, most of the time you would be using your phone in the portrait mode. But for the phones that have a full QWERTY keyboard, the orientation automatically changes to landscape mode when you slide out your keyboard. If your application is not designed to handle such orientation changes, the usability of your application might decrease to an extent at which it might get completely unusable, or at the least, very inconvenient for the user.&lt;/p&gt;  &lt;p&gt;How to handle it? It is actually very simple. You would have put all your layout xml files in a folder called “&lt;strong&gt;&lt;font size="4"&gt;res/layout&lt;/font&gt;”&lt;/strong&gt;. This is the default location from where the layout files are picked up, i.e , when your phone is in portrait mode. You just need to create one more folder “&lt;strong&gt;&lt;font size="4"&gt;res/layout-land&lt;/font&gt;&lt;/strong&gt;” where you put you xml files, with the same name, but with a different layout, which would be convenient for the user to view when in portrait mode. This is all you have to do. &lt;/p&gt;  &lt;p&gt;Next time, when the orientation is changed, your layout files will be picked up from the layout-land folder, and will be applied to your UI.&lt;/p&gt;  &lt;p&gt;Enjoy….&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-4675666573699201164?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/4675666573699201164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2009/10/orientation-independent-applications.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/4675666573699201164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/4675666573699201164'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2009/10/orientation-independent-applications.html' title='Orientation independent applications'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/__9PneCDHGgs/St9FBlJ0AyI/AAAAAAAABsE/ORzFKucyxDs/s72-c/IMG_0570_thumb%5B1%5D.jpg?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-7976082463445296986</id><published>2009-10-05T09:55:00.000-07:00</published><updated>2010-04-14T13:34:36.273-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gestures'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='UI'/><title type='text'>Gesture Detection on Android</title><content type='html'>&lt;p&gt;I just got my gesture detection code working. It's a fun way and a convenient way as well to enhance the usability of your application. So, here is the code that gets you going. First, for the Activity that you want to detect gestures, the OnGestureListener interface has to be implemented. Then, you need to override the methods and implement them. And finally, you need to implement the onTouchEvent method of the activity that will trigger the gesture listener code. &lt;/p&gt;  &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;   &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;     &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;package&lt;/span&gt; com.beanie.androidco;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum3" style="color: #606060"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;import&lt;/span&gt; android.app.Activity;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum4" style="color: #606060"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;import&lt;/span&gt; android.os.Bundle;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum5" style="color: #606060"&gt;   5:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;import&lt;/span&gt; android.view.GestureDetector;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum6" style="color: #606060"&gt;   6:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;import&lt;/span&gt; android.view.MotionEvent;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum7" style="color: #606060"&gt;   7:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;import&lt;/span&gt; android.view.GestureDetector.OnGestureListener;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum8" style="color: #606060"&gt;   8:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum9" style="color: #606060"&gt;   9:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; GestureDemo &lt;span style="color: #0000ff"&gt;extends&lt;/span&gt; Activity &lt;span style="color: #0000ff"&gt;implements&lt;/span&gt; OnGestureListener {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum10" style="color: #606060"&gt;  10:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; GestureDetector gestureDetector;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum11" style="color: #606060"&gt;  11:&lt;/span&gt;     @Override&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum12" style="color: #606060"&gt;  12:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; onCreate(Bundle savedInstanceState) {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum13" style="color: #606060"&gt;  13:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;super&lt;/span&gt;.onCreate(savedInstanceState);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum14" style="color: #606060"&gt;  14:&lt;/span&gt;         setContentView(R.layout.main);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum15" style="color: #606060"&gt;  15:&lt;/span&gt;         gestureDetector = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; GestureDetector(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum16" style="color: #606060"&gt;  16:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum17" style="color: #606060"&gt;  17:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum18" style="color: #606060"&gt;  18:&lt;/span&gt;     @Override&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum19" style="color: #606060"&gt;  19:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;boolean&lt;/span&gt; onTouchEvent(MotionEvent event) {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum20" style="color: #606060"&gt;  20:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; gestureDetector.onTouchEvent(event);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum21" style="color: #606060"&gt;  21:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum22" style="color: #606060"&gt;  22:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum23" style="color: #606060"&gt;  23:&lt;/span&gt;     @Override&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum24" style="color: #606060"&gt;  24:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;boolean&lt;/span&gt; onDown(MotionEvent e) {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum25" style="color: #606060"&gt;  25:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// Do something&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum26" style="color: #606060"&gt;  26:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; false;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum27" style="color: #606060"&gt;  27:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum28" style="color: #606060"&gt;  28:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum29" style="color: #606060"&gt;  29:&lt;/span&gt;     @Override&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum30" style="color: #606060"&gt;  30:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;boolean&lt;/span&gt; onFling(MotionEvent e1, MotionEvent e2, &lt;span style="color: #0000ff"&gt;float&lt;/span&gt; velocityX,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum31" style="color: #606060"&gt;  31:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;float&lt;/span&gt; velocityY) {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum32" style="color: #606060"&gt;  32:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// Do something&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum33" style="color: #606060"&gt;  33:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; false;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum34" style="color: #606060"&gt;  34:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum35" style="color: #606060"&gt;  35:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum36" style="color: #606060"&gt;  36:&lt;/span&gt;     @Override&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum37" style="color: #606060"&gt;  37:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; onLongPress(MotionEvent e) { &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum38" style="color: #606060"&gt;  38:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// Do something&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum39" style="color: #606060"&gt;  39:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum40" style="color: #606060"&gt;  40:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum41" style="color: #606060"&gt;  41:&lt;/span&gt;     @Override&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum42" style="color: #606060"&gt;  42:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;boolean&lt;/span&gt; onScroll(MotionEvent e1, MotionEvent e2, &lt;span style="color: #0000ff"&gt;float&lt;/span&gt; distanceX,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum43" style="color: #606060"&gt;  43:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;float&lt;/span&gt; distanceY) {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum44" style="color: #606060"&gt;  44:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// Do something&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum45" style="color: #606060"&gt;  45:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; false;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum46" style="color: #606060"&gt;  46:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum47" style="color: #606060"&gt;  47:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum48" style="color: #606060"&gt;  48:&lt;/span&gt;     @Override&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum49" style="color: #606060"&gt;  49:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; onShowPress(MotionEvent e) { &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum50" style="color: #606060"&gt;  50:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// Do something&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum51" style="color: #606060"&gt;  51:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum52" style="color: #606060"&gt;  52:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum53" style="color: #606060"&gt;  53:&lt;/span&gt;     @Override&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum54" style="color: #606060"&gt;  54:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;boolean&lt;/span&gt; onSingleTapUp(MotionEvent e) { &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum55" style="color: #606060"&gt;  55:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// Do something &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum56" style="color: #606060"&gt;  56:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; false;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum57" style="color: #606060"&gt;  57:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum58" style="color: #606060"&gt;  58:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt; The most commonly used method would probably be the onFling method, where you have to check for a threshold velocity and displacement before you would want to trigger an action. For detecting Left Fling, Right Fling, Scroll down/up, you will need to write some extra code in the corresponding methods. Enjoy...&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-7976082463445296986?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/7976082463445296986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2009/10/gesture-detection-on-android.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7976082463445296986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7976082463445296986'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2009/10/gesture-detection-on-android.html' title='Gesture Detection on Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-7082676611044457535</id><published>2009-09-07T11:07:00.000-07:00</published><updated>2010-07-12T22:14:23.911-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Apps'/><category scheme='http://www.blogger.com/atom/ns#' term='SMS'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='SMS Blocking'/><title type='text'>SMS Blocking in Android</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/__9PneCDHGgs/SqVP0a5yPyI/AAAAAAAABoQ/DA5QKKYplFg/s1600-h/sms.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5378793091957407522" src="http://3.bp.blogspot.com/__9PneCDHGgs/SqVP0a5yPyI/AAAAAAAABoQ/DA5QKKYplFg/s200/sms.jpg" style="cursor: pointer; float: right; height: 120px; margin: 0pt 0pt 10px 10px; width: 200px;" /&gt;&lt;/a&gt;                  &lt;span style="font-size: 180%; font-weight: bold;"&gt;R&lt;/span&gt;ecently, I tried to develop an app that would block sms from certain numbers that you can choose. It seems that you cannot completely block the incoming sms.  These were the problems that I faced while working with this app.&lt;br /&gt;
&lt;br /&gt;
1. There are no APIs supplied, that handles the SMS inbox (I mean, no content providersm which can be directly queried to fetch records from the sms table). However, you have a workaround of finding the tables where the sms is stored, and then querying and updating that table. Well, there is actually a content provider, that exposes this table to other applications, but it is not documented anywhere. So, I have to hardcode the column values. This is potentially dangerous, if in the next Donut release, Google changes the column names, my application would fall apart.&lt;br /&gt;
&lt;br /&gt;
2. On receiving of an SMS, I have 2 things to do. Remove the SMS from the sms table, and disable the notification. Deleting the sms from the table was pretty easy, but I couldn't find a way to remove the Notification. Perhaps, there is no way that we can disable this notification. One workaround might be, to temporarily change the Notification settings, the moment you sense an incoming message from a blocked number. And, after you delete the message from the sms table, you just turn on the notification. I haven't worked on this, but this might just work.&lt;br /&gt;
&lt;br /&gt;
3. If the Messaging application is already open, and an sms arrives, weird things start to happen. I can see the blocked sms being deleted, and the list of sms gets updated. But the next message in the list is marked as "Unread". Probably, this is done by the Notification, I don't know.&lt;br /&gt;
&lt;br /&gt;
4. SMS broadcast, is definitely, an un-ordered one. So, the easiest way, that could have worked, would have been just to abort the broadcast. But in this case, you don't have this option. so, once you recieve this broadcast, you have to manually go and delete the message, by matching the incoming number, timestamp etc. Timestamp method isn't foolproof. Because, the timestamp you receive, is the timestamp of the broadcast, and not the time when the sms is written into the DB. So they wont match. You should pick up the incoming number, and check for the timestamp within a range of about 1 seconds. This should give you the sms that you need to delete.&lt;br /&gt;
&lt;br /&gt;
5. There's another problem. When you recieve the broadcast, the system wont write the sms into the table, before it is sure that all the broadcast receivers have done their work. So, it waits for some time, and then writes the sms into the table. Before this, if you try to delete the sms, obviously, you would not find it in the table. So, make your code sleep for about a second, and then go and delete the SMS. That should do it.  But, the most important problem still persists. THE NOTIFICATION. I guess, it can't be removed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-7082676611044457535?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/7082676611044457535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2009/09/sms-blocking-in-android.html#comment-form' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7082676611044457535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/7082676611044457535'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2009/09/sms-blocking-in-android.html' title='SMS Blocking in Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/__9PneCDHGgs/SqVP0a5yPyI/AAAAAAAABoQ/DA5QKKYplFg/s72-c/sms.jpg' height='72' width='72'/><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-8514871230566424586</id><published>2009-08-22T07:55:00.001-07:00</published><updated>2011-05-15T07:06:29.852-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SlidingDrawer'/><category scheme='http://www.blogger.com/atom/ns#' term='Widgets'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='UI'/><category scheme='http://www.blogger.com/atom/ns#' term='Layout'/><title type='text'>Android : Sliding Drawer Example</title><content type='html'>If you have lot’s of stuff to put on your screen for a single activity, you should probably go for the SlidingDrawer widget. It is very simple to use, and looks cute. Here are the steps that you need to do for bringing up the sliding drawer on your activity.&lt;br /&gt;
&lt;br /&gt;
Here is a sample application displaying how to code up a sliding drawer. It's pretty simple, and I don't think it needs more explanation.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-MJef8Xc3PZE/Tc_cJxkVwpI/AAAAAAAAC2s/4FE05HRTOcU/s1600/sliding_drawer_open.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-MJef8Xc3PZE/Tc_cJxkVwpI/AAAAAAAAC2s/4FE05HRTOcU/s320/sliding_drawer_open.png" width="216" /&gt;&lt;/a&gt;&lt;a href="http://2.bp.blogspot.com/-TInliiYCiws/Tc_cTqzvGgI/AAAAAAAAC2w/7K4popCIp3c/s1600/sliding_drawer_closed.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://2.bp.blogspot.com/-TInliiYCiws/Tc_cTqzvGgI/AAAAAAAAC2w/7K4popCIp3c/s320/sliding_drawer_closed.png" width="215" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote style="color: #b45f06;"&gt;&lt;b&gt;&lt;span style="font-size: x-small;"&gt;&lt;i&gt;&amp;lt;SlidingDrawer android:id="@+id/slidingDrawer1"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:layout_width="fill_parent" android:layout_height="fill_parent"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:topOffset="50dip" android:handle="@+id/handle"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; android:content="@+id/content"&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;&lt;br /&gt;
The sample project sets up a Sliding Drawer at the bottom of the screen. You can change it to appear at place of the screen. You just need to change/adjust some properties of the SlidingDrawer.&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;The orientation property can be set to either "horizontal" and "vertical"&lt;/li&gt;
&lt;li&gt;There are properties like "topOffset", "bottonOffset", "rightOffset" and "leftOffset" with which you can position your drawer anywhere.&lt;/li&gt;
&lt;li&gt;With a few more changes, you can attach backgrounds/images to the whole SlidingDrawer. For example, I have added a color background to the content of the Sliding Drawer.&lt;/li&gt;
&lt;/ul&gt;&lt;i&gt;&lt;b&gt;&lt;span style="color: blue;"&gt;Update:&lt;/span&gt;&lt;/b&gt;&lt;/i&gt; &lt;i&gt;Here is the &lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn%2Ftrunk%2FSlidingDrawerExample"&gt;link to the source code&lt;/a&gt; which shows how to cook up a simple sliding drawer. &lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-8514871230566424586?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/8514871230566424586/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2009/08/android-sliding-drawer-example.html#comment-form' title='27 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/8514871230566424586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/8514871230566424586'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2009/08/android-sliding-drawer-example.html' title='Android : Sliding Drawer Example'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-MJef8Xc3PZE/Tc_cJxkVwpI/AAAAAAAAC2s/4FE05HRTOcU/s72-c/sliding_drawer_open.png' height='72' width='72'/><thr:total>27</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-8003912717728330309</id><published>2009-08-13T09:35:00.001-07:00</published><updated>2010-09-18T13:22:39.886-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><category scheme='http://www.blogger.com/atom/ns#' term='FileWriter'/><category scheme='http://www.blogger.com/atom/ns#' term='Files'/><title type='text'>FileWriter in Android</title><content type='html'>This is a pretty handy API that you can use to write a string of information to a file on the device. It doesn’t need a StreamWriter or BufferedWriter or FileOutputStream. It is short and sweet.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileWriter fWriter;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fWriter = new FileWriter(“\sdcard\filename.txt”);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fWriter.write(yourString);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fWriter.flush();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fWriter.close();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }catch(Exception e){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
The flush() and close() calls are important here, and also make sure that the “sdcard” is mounted. Else, you can use a path such as “data\data\com\yourpackage\filename.txt” which would create a file in the data directory of your package.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-8003912717728330309?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/8003912717728330309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2009/08/filewriter-in-android.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/8003912717728330309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/8003912717728330309'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2009/08/filewriter-in-android.html' title='FileWriter in Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-5329735749805978525</id><published>2009-08-13T09:29:00.001-07:00</published><updated>2010-09-18T13:23:14.733-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Orientation change'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Development'/><category scheme='http://www.blogger.com/atom/ns#' term='Layout'/><category scheme='http://www.blogger.com/atom/ns#' term='Scrollview'/><title type='text'>Scrollview in Android</title><content type='html'>I never noticed, or realised how an application’s UI would render when the orientation changed, since most of the time I tested my apps on the emulator. But one fine day, when a friend of mine walked in and asked to change the orientation, I shocked to see that the layouts didn’t fit in the landscape view.&lt;br /&gt;
Well, the solution!!!&lt;br /&gt;
Wrap your layouts in a parent ScrollView, so that, when the orientation changes, you will be able to at-least scroll and view the whole layout. How the UI looks, is however a different concern.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-5329735749805978525?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/5329735749805978525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2009/08/scrollview-in-android.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/5329735749805978525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/5329735749805978525'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2009/08/scrollview-in-android.html' title='Scrollview in Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-6571356383082586993</id><published>2009-08-13T09:24:00.001-07:00</published><updated>2010-09-18T13:23:44.766-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RelativeLayout'/><category scheme='http://www.blogger.com/atom/ns#' term='LinearLayout'/><category scheme='http://www.blogger.com/atom/ns#' term='Android Tricks'/><category scheme='http://www.blogger.com/atom/ns#' term='Layout'/><title type='text'>Relative Layouts vs Linear Layouts</title><content type='html'>From the very first day, I hated Relative Layouts. I struggled with layouts in general during my initial days till I figured out that Linear Layouts can create any kind of complex layout you need. By using only the Linear Layouts, you can create whatever you want. I had always wondered what was the purpose of the other available layouts.&lt;br /&gt;
I was a fan of the Linear Layouts till the day I hit the dead end. With SDK 1.5, pressing for the limit up to which your view hierarchy can be deep, problems started with my existing apps. I was able to remove the errors by removing a layout or two. And then, there was a case, where, I couldn’t remove a level. I was hitting the StackOverflow exception all the time. Frustrated, I posted my query to Google Groups, and guess what, Romain Guy responded, asking me to remove or simplify my view hierarchy. Well, if I were to listen to him, it would mean converting some Linear Layouts to Relative Layouts. And since I didn’t understand Relative Layouts then, I though it was a big big ask. But I tried, and guess what, now my UI is faster, simpler and I don’t get that StackOverflow exception. &lt;br /&gt;
I have now realized that though it is easy to use LinearLayouts, but RelativeLayouts not only make your UI load faster, but also is easier to render (at least for me). I have changed all my Linear Layouts to Relative ones, wherever possible. &lt;br /&gt;
I also watched the Google I/O videos that gave me a lot of information regarding how to code for Android platform. One of them I would like to mention in my next blog would be about the ListView, the most widely used widget, and i guess, the most wrongly used as well.&lt;br /&gt;
Keep droiding….&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-6571356383082586993?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/6571356383082586993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2009/08/relative-layouts-vs-linear-layouts.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/6571356383082586993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/6571356383082586993'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2009/08/relative-layouts-vs-linear-layouts.html' title='Relative Layouts vs Linear Layouts'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1474889468959966316.post-5212245778520076822</id><published>2009-07-12T00:51:00.001-07:00</published><updated>2010-09-18T13:17:26.920-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Custom Adapter'/><category scheme='http://www.blogger.com/atom/ns#' term='List View'/><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><category scheme='http://www.blogger.com/atom/ns#' term='UI'/><category scheme='http://www.blogger.com/atom/ns#' term='Layout'/><title type='text'>A Custom ListView for Android</title><content type='html'>I have been thinking about starting a new blog for Android stuff for quite a long time. And today, I found some time for the same. So here goes my first post. This is about developing your own custom list view. The List View is a very powerful UI element for the android platform. And it provides a lot of customizing features as well. Let’s jump into the details right away.&lt;br /&gt;
For this example, I will be using an example for a phone book entry, with the contacts having basic information like “name”, “phone” and “email”.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Step 1&lt;/u&gt;&lt;/b&gt;: Lets create a POJO class for the phone book.&lt;br /&gt;
Class name : &lt;b&gt;Phonebook.java&lt;/b&gt;&lt;br /&gt;
Not a complex code. Just the three fields, a constructor and the getters and setters. That’s it.&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Step 2&lt;/u&gt;&lt;/b&gt;: Lets create the layout that each row of the List View is going to look like. I prefer to do this layout in xml rather than through coding/programmatically. xml stuff is pretty easy to develop. &lt;br /&gt;
File name : &lt;b&gt;phone_row.xml&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This layout has three Text Views, tvContact, tvMobile and tvMail which we will be using in our code. We don’t need to touch any other elements from this file, if you should have to edit this xml, do it carefully.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Step 3&lt;/u&gt;&lt;/b&gt;: Now, lets create a class which our custom adapter will be calling to render each row of the List View. Here, we need the layout file created in Step 2. This class should extend any layout type, e.g, LinearLayout, TableLayout, etc. In my example, I am using a LinearLayout.&lt;br /&gt;
&lt;br /&gt;
Class name : &lt;b&gt;PhonebookAdapterView.java&lt;/b&gt;&lt;br /&gt;
In this class, create a constructor with two parameters, Context and the Pojo class Phonebook. And, inside the constructor, set the fields to the text views. The “this.setTag(entry)” will enable us to get info on the phonebook entry, when we use the listener for List View.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Update: I have deleted this class from the example, and have used the efficient way recommended for ListView. Checkout out the code. &lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Step 4&lt;/u&gt;&lt;/b&gt;: Now, create the Phonebook adapter class which extends the BaseAdapter. This will be used to set a list of Phonebook items to the list view with our customized layout.&lt;br /&gt;
&lt;br /&gt;
Class name : &lt;b&gt;PhonebookAdapter.java&lt;/b&gt;&lt;br /&gt;
This class has a bit of coding, and changes to be made in the default methods that comes in when you extend the BaseAdapter class, however it is simple enough. A new constructor and two new private members is all that you have to include.&lt;br /&gt;
&lt;a href="http://lh6.ggpht.com/__9PneCDHGgs/SlmV6vTyrII/AAAAAAAABlY/IJfkagzSTf8/s1600-h/Custom%20List%20View%5B3%5D.jpg" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img align="right" alt="Custom List View" border="0" height="221" src="http://lh4.ggpht.com/__9PneCDHGgs/SlmWDFNKYFI/AAAAAAAABlc/oUYx1aajHSU/Custom%20List%20View_thumb%5B1%5D.jpg?imgmax=800" style="border-width: 0px; display: inline; margin-left: 0px; margin-right: 0px;" title="Custom List View" width="244" /&gt;&lt;/a&gt;Override the methods as given in the code. The method getView is the important one. Here, we call our PhonebookAdapterView class.&lt;br /&gt;
&lt;br /&gt;
Now, you are done. Your custom list view has been created. The final step would be testing the custom list view. Just create and activity with a listview. Then create an instance of the PhonebookAdapter class passing the parameters (Context and list of Phonebook objects)&lt;br /&gt;
&lt;br /&gt;
Then, set this adapter to the list view. You are done. Here is the output. &lt;br /&gt;
Here is the link where you can find all the source code as an Android Project (1.5 compatible).&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;a href="http://code.google.com/p/myandroidwidgets/source/browse/#svn/trunk/Phonebook"&gt;Full source code is here.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Update: I have updated the example, to include a button on each line item, which when clicked, removes that item from the List View.&lt;/i&gt;&lt;br /&gt;
&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: xx-small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1474889468959966316-5212245778520076822?l=techdroid.kbeanie.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techdroid.kbeanie.com/feeds/5212245778520076822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://techdroid.kbeanie.com/2009/07/custom-listview-for-android.html#comment-form' title='82 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/5212245778520076822'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1474889468959966316/posts/default/5212245778520076822'/><link rel='alternate' type='text/html' href='http://techdroid.kbeanie.com/2009/07/custom-listview-for-android.html' title='A Custom ListView for Android'/><author><name>Kumar Bibek</name><uri>https://profiles.google.com/112390559537371694099</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-r_bSOXUy8mM/AAAAAAAAAAI/AAAAAAAAC1o/tHzyvCIzCQc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/__9PneCDHGgs/SlmWDFNKYFI/AAAAAAAABlc/oUYx1aajHSU/s72-c/Custom%20List%20View_thumb%5B1%5D.jpg?imgmax=800' height='72' width='72'/><thr:total>82</thr:total></entry></feed>
