<?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-5749561464469791346</id><updated>2012-02-16T09:28:38.714-08:00</updated><category term='Coding'/><category term='Tips'/><category term='Custom Components'/><category term='Updates'/><category term='Basic'/><category term='Sample'/><title type='text'>About Android</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>66</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-2621117723855965702</id><published>2011-11-16T08:18:00.000-08:00</published><updated>2011-11-16T08:22:04.637-08:00</updated><title type='text'>Hide showed Toast Messages</title><content type='html'>I&lt;span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17px; background-color: rgb(255, 255, 255); "&gt;n my App, there is a list, when a user clicks on an button, a toast message is being displayed, 10 items - 10 toast messages, &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17px; background-color: rgb(255, 255, 255); "&gt;so if the user clicks 10 times, then presses the  button... he/she has to wait for some seconds, until he's able to read the menu option text. &lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17px; background-color: rgb(255, 255, 255); "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17px; background-color: rgb(255, 255, 255); "&gt;I have found the below solution to hide the shows toast message. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17px; background-color: rgb(255, 255, 255); "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="background-color: rgb(255, 255, 255); font-size: 14px; line-height: 17px;"&gt;&lt;span class="Apple-style-span" &gt;&lt;div&gt;public class SampleToastActivity extends Activity {&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Toast myToast;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;static int i=0;&lt;/div&gt;&lt;div&gt;    @Override&lt;/div&gt;&lt;div&gt;    public void onCreate(Bundle savedInstanceState) {&lt;/div&gt;&lt;div&gt;        super.onCreate(savedInstanceState);&lt;/div&gt;&lt;div&gt;        setContentView(R.layout.main);&lt;/div&gt;&lt;div&gt;        Button b1 = (Button) findViewById(R.id.button2);&lt;/div&gt;&lt;div&gt;        &lt;/div&gt;&lt;div&gt;        b1.setOnClickListener(new View.OnClickListener() {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;@Override&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;public void onClick(View v) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;i++;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;if(myToast!=null){&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;     &lt;/span&gt;myToast.cancel();&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;     &lt;/span&gt;myToast.setText("Count"+i);&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;}else{&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;     &lt;/span&gt;myToast = Toast.makeText(SampleToastActivity.this, "Sample"+i, 10);&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;}&lt;span class="Apple-tab-span" style="white-space:pre"&gt;        &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;myToast.show();&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;});        &lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/span&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/5749561464469791346-2621117723855965702?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/2621117723855965702/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2011/11/hide-showed-toast-messages.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/2621117723855965702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/2621117723855965702'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2011/11/hide-showed-toast-messages.html' title='Hide showed Toast Messages'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-223088507851335108</id><published>2011-11-07T19:24:00.000-08:00</published><updated>2011-11-07T21:02:14.224-08:00</updated><title type='text'>Sample CheckedTextView in listview , Reading contacts all emails</title><content type='html'>Here, you can find the example of checked textview in the listview and read all email address in the android phone&lt;br /&gt;&lt;br /&gt;1. Design the main Layout &amp;amp; row Layout with Checked TextView&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Main.xml&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-size:85%;" &gt;&amp;lt; ListView android:id="@+id/listView1" android:layout_width="fill_parent"&lt;br /&gt;       android:layout_height="fill_parent" android:background="#ffffff" /&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Row.xml&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;&amp;lt; CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;        android:id="@+id/checkedTextView1" android:paddingLeft="20dip"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;        android:paddingRight="20dip" android:paddingTop="10dip"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;        android:paddingBottom="10dip" android:orientation="vertical"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;        android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;        android:gravity="center_vertical" android:checkMark="@android:drawable/checkbox_off_background"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;        android:textColor="#000000" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;2. Create the CursurAdpater&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;    private class ContactListAdapter extends CursorAdapter {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;        public ContactListAdapter(Context context, Cursor c) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;            super(context, c);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;        @Override&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;        public void bindView(View view, Context context, Cursor cursor) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;            String o = &lt;span style="font-weight: bold;"&gt;cursor&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0); font-weight: bold;"&gt;                    .getString(cursor&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0); font-weight: bold;"&gt;                            .getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;            CheckedTextView tt = (CheckedTextView) view&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;                    .findViewById(R.id.checkedTextView1);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;            tt.setText(o);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;        @Override&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;        public View newView(Context context, Cursor cursor, ViewGroup parent) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;            View v;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;            LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;            v = vi.inflate(R.layout.row, null);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;            return v;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;    }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;3. set the Contact Cursor to the ContactListAdapter&lt;span style="color: rgb(102, 0, 0);font-size:85%;" &gt;&lt;br /&gt;ContentResolver cr = getContentResolver();&lt;br /&gt;   Cursor emails = cr.query(&lt;br /&gt;           ContactsContract.CommonDataKinds.Email.CONTENT_URI, null, null,&lt;br /&gt;           null, null);&lt;br /&gt;   l.setAdapter(new ContactListAdapter(this, emails));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. Change the State while select the Item&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-size:85%;" &gt;l.setOnItemClickListener(new OnItemClickListener() {&lt;br /&gt;&lt;br /&gt;       public void onItemClick(AdapterView arg0, View v, int arg2,&lt;br /&gt;               long arg3) {&lt;br /&gt;&lt;br /&gt;           CheckedTextView tt = (CheckedTextView) v&lt;br /&gt;                   .findViewById(R.id.checkedTextView1);&lt;br /&gt;           if (!tt.isChecked()) {&lt;br /&gt;               tt.setChecked(true);&lt;br /&gt;               tt.setCheckMarkDrawable(android.R.drawable.checkbox_on_background);&lt;br /&gt;           } else {&lt;br /&gt;               tt.setChecked(false);&lt;br /&gt;               tt.setCheckMarkDrawable(android.R.drawable.checkbox_off_background);&lt;br /&gt;           }&lt;br /&gt;&lt;br /&gt;       }&lt;br /&gt;   });&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;5. Add the Contact Read Permission in androidmanifest.xml&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;&amp;lt; uses-permission android:name="android.permission.READ_CONTACTS" /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Sample Program :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-size:85%;" &gt;public class ContactListingActivity extends Activity {&lt;br /&gt;@Override&lt;br /&gt;public void onCreate(Bundle savedInstanceState) {&lt;br /&gt;   super.onCreate(savedInstanceState);&lt;br /&gt;   setContentView(R.layout.main);&lt;br /&gt;   ListView l = (ListView) findViewById(R.id.listView1);&lt;br /&gt;   Cursor emails = getContentResolver().query(&lt;br /&gt;           ContactsContract.CommonDataKinds.Email.CONTENT_URI, null, null,&lt;br /&gt;           null, null);&lt;br /&gt;   l.setAdapter(new ContactListAdapter(this, emails));&lt;br /&gt;   l.setOnItemClickListener(new OnItemClickListener() {&lt;br /&gt;       public void onItemClick(AdapterView arg0, View v, int arg2,&lt;br /&gt;               long arg3) {&lt;br /&gt;           CheckedTextView tt = (CheckedTextView) v&lt;br /&gt;                   .findViewById(R.id.checkedTextView1);&lt;br /&gt;           if (!tt.isChecked()) {&lt;br /&gt;               tt.setChecked(true);&lt;br /&gt;               tt.setCheckMarkDrawable(android.R.drawable.checkbox_on_background);&lt;br /&gt;           } else {&lt;br /&gt;               tt.setChecked(false);&lt;br /&gt;               tt.setCheckMarkDrawable(android.R.drawable.checkbox_off_background);&lt;br /&gt;           }&lt;br /&gt;&lt;br /&gt;       }&lt;br /&gt;   });&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private class ContactListAdapter extends CursorAdapter {&lt;br /&gt;   public ContactListAdapter(Context context, Cursor c) {&lt;br /&gt;       super(context, c);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   @Override&lt;br /&gt;   public void bindView(View view, Context context, Cursor cursor) {&lt;br /&gt;       String o = cursor&lt;br /&gt;               .getString(cursor&lt;br /&gt;                       .getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));&lt;br /&gt;       CheckedTextView tt = (CheckedTextView) view&lt;br /&gt;               .findViewById(R.id.checkedTextView1);&lt;br /&gt;       tt.setText(o);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   @Override&lt;br /&gt;   public View newView(Context context, Cursor cursor, ViewGroup parent) {&lt;br /&gt;       View v;&lt;br /&gt;       LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);&lt;br /&gt;       v = vi.inflate(R.layout.row, null);&lt;br /&gt;       return v;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&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/5749561464469791346-223088507851335108?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/223088507851335108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2011/11/sample-checkedtextview-in-listview.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/223088507851335108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/223088507851335108'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2011/11/sample-checkedtextview-in-listview.html' title='Sample CheckedTextView in listview , Reading contacts all emails'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-8691900377204323921</id><published>2011-08-12T05:29:00.001-07:00</published><updated>2011-08-12T05:29:34.401-07:00</updated><title type='text'>Gesture based action</title><content type='html'>&lt;div&gt;Here we are discussing about how to set that as the gesture listener for the views that I add.&lt;/div&gt;&lt;div&gt;My requirement : I have list of images in a listview with url. When the user wants view the full image then user click the image on the list view&lt;/div&gt;&lt;div&gt;it will take to me the anonther activity and open in a imageview. and as a user wants to tee the next nexe or previous image with come back to listview page&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Solution : I have created the HashMap Contains the list of images and pass the selected images name as bundle string. In a detail view created the async task the fetch image from the internet&lt;/div&gt;&lt;div&gt;implement the gestureListener. In this article we discussing about that&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Related : gesture move action, gesture based action, example geatures&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1. Create a Activity implements OnClickListener&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;public class MySample1Activity extends Activity implements OnClickListener {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;........&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;2. Initialize below required object for gestureListener&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;ViewConfiguration vc;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;static int SWIPE_MAX_OFF_PATH = 250;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;static int SWIPE_MIN_DISTANCE = 100;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;static int SWIPE_THRESHOLD_VELOCITY = 100;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;private GestureDetector gestureDetector;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;View.OnTouchListener gestureListener;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;3. Set Densitybased velocity&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;vc = ViewConfiguration.get(this);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;SWIPE_MIN_DISTANCE = vc.getScaledTouchSlop();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;SWIPE_THRESHOLD_VELOCITY = vc.getScaledMinimumFlingVelocity();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;4. Create a Custom GestureListener class which extends SimpleOnGestureListener&lt;/div&gt;&lt;div&gt;class MyGestureDetector extends SimpleOnGestureListener {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;5. Override the onFling() and implement the geature move action&lt;/div&gt;&lt;div&gt;@Override&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;float velocityY) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;try {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;if (Math.abs(e1.getY() - e2.getY()) &amp;gt; SWIPE_MAX_OFF_PATH)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;					&lt;/span&gt;return false;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;// right to left swipe&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;if (e1.getX() - e2.getX() &amp;gt; SWIPE_MIN_DISTANCE&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;						&lt;/span&gt;&amp;amp;&amp;amp; Math.abs(velocityX) &amp;gt; SWIPE_THRESHOLD_VELOCITY) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;					&lt;/span&gt;Toast.makeText(MySample1Activity.this, "Left Swipe",&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;							&lt;/span&gt;Toast.LENGTH_SHORT).show();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;} else if (e2.getX() - e1.getX() &amp;gt; SWIPE_MIN_DISTANCE&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;						&lt;/span&gt;&amp;amp;&amp;amp; Math.abs(velocityX) &amp;gt; SWIPE_THRESHOLD_VELOCITY) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;					&lt;/span&gt;Toast.makeText(MySample1Activity.this, "Right Swipe",&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;							&lt;/span&gt;Toast.LENGTH_SHORT).show();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;} catch (Exception e) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;// nothing&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;return false;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Full SourceCode&lt;/div&gt;&lt;div&gt;public class MySample1Activity extends Activity implements OnClickListener {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;/** Called when the activity is first created. */&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;TextView tView;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;ViewConfiguration vc;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;static int SWIPE_MAX_OFF_PATH = 250;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;static int SWIPE_MIN_DISTANCE = 100;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;static int SWIPE_THRESHOLD_VELOCITY = 100;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;private GestureDetector gestureDetector;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;View.OnTouchListener gestureListener;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;@Override&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;public void onCreate(Bundle savedInstanceState) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;super.onCreate(savedInstanceState);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;setContentView(R.layout.main);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;tView = (TextView) findViewById(R.id.textview1);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;vc = ViewConfiguration.get(this);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;SWIPE_MIN_DISTANCE = vc.getScaledTouchSlop();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;SWIPE_THRESHOLD_VELOCITY = vc.getScaledMinimumFlingVelocity();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;gestureDetector = new GestureDetector(new MyGestureDetector());&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;gestureListener = new View.OnTouchListener() {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;public boolean onTouch(View v, MotionEvent event) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;if (gestureDetector.onTouchEvent(event)) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;					&lt;/span&gt;return true;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;return false;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;};&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;tView.setOnClickListener(this);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;tView.setOnTouchListener(gestureListener);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;class MyGestureDetector extends SimpleOnGestureListener {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;@Override&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;float velocityY) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;try {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;if (Math.abs(e1.getY() - e2.getY()) &amp;gt; SWIPE_MAX_OFF_PATH)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;					&lt;/span&gt;return false;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;// right to left swipe&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;if (e1.getX() - e2.getX() &amp;gt; SWIPE_MIN_DISTANCE&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;						&lt;/span&gt;&amp;amp;&amp;amp; Math.abs(velocityX) &amp;gt; SWIPE_THRESHOLD_VELOCITY) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;					&lt;/span&gt;Toast.makeText(MySample1Activity.this, "Left Swipe",&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;							&lt;/span&gt;Toast.LENGTH_SHORT).show();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;} else if (e2.getX() - e1.getX() &amp;gt; SWIPE_MIN_DISTANCE&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;						&lt;/span&gt;&amp;amp;&amp;amp; Math.abs(velocityX) &amp;gt; SWIPE_THRESHOLD_VELOCITY) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;					&lt;/span&gt;Toast.makeText(MySample1Activity.this, "Right Swipe",&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;							&lt;/span&gt;Toast.LENGTH_SHORT).show();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;} catch (Exception e) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;// nothing&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;return false;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;@Override&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;public void onClick(View v) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;// TODO Auto-generated method stub&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-8691900377204323921?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/8691900377204323921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2011/08/gesture-based-action.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/8691900377204323921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/8691900377204323921'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2011/08/gesture-based-action.html' title='Gesture based action'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-9038597926663701502</id><published>2011-07-29T00:17:00.001-07:00</published><updated>2011-07-29T00:21:05.871-07:00</updated><title type='text'></title><content type='html'>&lt;div&gt;In this blog we are selecting multiple images.Here I have created the custom view components and activity used to get the selected images.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;1. Custom ViewComponet &lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;&amp;lt; RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;  &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;android:layout_width="fill_parent" android:layout_height="fill_parent"&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;  &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;&amp;lt; ImageView android:id="@+id/thumbImage" android:layout_width="wrap_content"&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;   &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;android:layout_height="wrap_content" android:layout_centerInParent="true" /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;  &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;&amp;lt; CheckBox android:id="@+id/itemCheckBox" android:layout_width="wrap_content"&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;   &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;android:layout_height="wrap_content" android:layout_alignParentRight="true"&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;   &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;android:layout_alignParentTop="true" /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;&amp;lt; /RelativeLayout&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;2. SampleActivity&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; 1. Create a ImageAdapter &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;public class ImageAdapter extends BaseAdapter {&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;  &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;}&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt; 2. Inflate the View &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;&lt;span class="Apple-style-span" &gt;mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;&lt;span class="Apple-style-span" &gt;convertView = mInflater.inflate(R.layout.mygallert, null);&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; 3. find the required View&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;imageview = (ImageView) convertView.findViewById(R.id.thumbImage);&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;checkbox = (CheckBox) convertView.findViewById(R.id.itemCheckBox);&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;4. Control the image selection &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;imageview.setBackgroundResource(R.drawable.icon);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;checkbox.setId(position);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;checkbox.setChecked(false);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;checkbox.setOnClickListener(new OnClickListener() {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;    &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;public void onClick(View v) {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;     &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;CheckBox cb = (CheckBox) v;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;     &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;if (cb.isChecked()) {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;      &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;cb.setChecked(true);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;      &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;selectedImage.add(v.getId());&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;     &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;} else {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;      &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;cb.setChecked(false);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;      &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;selectedImage.remove(v.getId());&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;     &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;    &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;});&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;4. Track the image selection &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;selectedImage.add(v.getId());&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;selectedImage.remove(v.getId());&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;5. displays the selected Image Position&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Toast.makeText(SampleActivity.this,"" + SampleActivity.this.selectedImage, 10).show();&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;u&gt;Sample&lt;/u&gt;&lt;/b&gt; &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;public class SampleActivity extends Activity {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;private ImageAdapter imageAdapter;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;private Set&lt;integer&gt; selectedImage = new HashSet&lt;integer&gt;();&lt;/integer&gt;&lt;/integer&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;/** Called when the activity is first created. */&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;@Override&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;public void onCreate(Bundle savedInstanceState) {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;super.onCreate(savedInstanceState);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;setContentView(R.layout.main);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;GridView imagegrid = (GridView) findViewById(R.id.PhoneImageGrid);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;Button selectedImage = (Button) findViewById(R.id.selectBtn);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;imageAdapter = new ImageAdapter();&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;imagegrid.setAdapter(imageAdapter);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;selectedImage.setOnClickListener(new View.OnClickListener() {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;public void onClick(View v) {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;    &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;Toast.makeText(SampleActivity.this,&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;      &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;"" + SampleActivity.this.selectedImage, 10).show();&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;});&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;public class ImageAdapter extends BaseAdapter {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;private LayoutInflater mInflater;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;public ImageAdapter() {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;public Object getItem(int position) {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;return position;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;public long getItemId(int position) {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;return position;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;public View getView(int position, View convertView, ViewGroup parent) {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;ImageView imageview;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;CheckBox checkbox;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;convertView = mInflater.inflate(R.layout.mygallert, null);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;imageview = (ImageView) convertView.findViewById(R.id.thumbImage);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;checkbox = (CheckBox) convertView.findViewById(R.id.itemCheckBox);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;imageview.setBackgroundResource(R.drawable.icon);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;checkbox.setId(position);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;checkbox.setChecked(false);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;checkbox.setOnClickListener(new OnClickListener() {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;    &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;public void onClick(View v) {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;     &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;CheckBox cb = (CheckBox) v;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;     &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;if (cb.isChecked()) {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;      &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;cb.setChecked(true);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;      &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;selectedImage.add(v.getId());&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;     &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;} else {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;      &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;cb.setChecked(false);&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;      &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;selectedImage.remove(v.getId());&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;     &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;    &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;});&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;return convertView;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;public int getCount() {&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;   &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;return 5;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;  &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;i&gt;}&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;u&gt;Required XML&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;u&gt;main.xml&lt;/u&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt; ?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt; RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;android:layout_width="fill_parent" android:layout_height="fill_parent"&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt; Button android:id="@+id/selectBtn" android:layout_width="wrap_content"&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;android:layout_height="wrap_content" android:text="Select"&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;android:layout_alignParentBottom="true"&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;android:layout_centerHorizontal="true" android:minWidth="200px" /&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt; GridView android:id="@+id/PhoneImageGrid"&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;android:layout_width="fill_parent" android:layout_height="fill_parent"&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;android:numColumns="auto_fit" android:verticalSpacing="10dp"&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;android:horizontalSpacing="10dp" android:columnWidth="90dp"&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;android:stretchMode="columnWidth" android:gravity="center"&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;android:layout_above="@id/selectBtn" /&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt; /RelativeLayout&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;u&gt;mygallery.xml&lt;/u&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;&amp;lt;  ?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;&amp;lt;  RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;android:layout_width="fill_parent" android:layout_height="fill_parent"&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;&amp;lt;  ImageView android:id="@+id/thumbImage" android:layout_width="wrap_content"&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;  &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;android:layout_height="wrap_content" android:layout_centerInParent="true" /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;&amp;lt;  CheckBox android:id="@+id/itemCheckBox" android:layout_width="wrap_content"&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;  &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;android:layout_height="wrap_content" android:layout_alignParentRight="true"&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;  &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;android:layout_alignParentTop="true" /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" &gt;&amp;lt; /RelativeLayout&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&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/5749561464469791346-9038597926663701502?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/9038597926663701502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2011/07/in-this-blog-we-are-selecting-multiple.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/9038597926663701502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/9038597926663701502'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2011/07/in-this-blog-we-are-selecting-multiple.html' title=''/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-4360891805613326724</id><published>2011-05-23T19:42:00.000-07:00</published><updated>2011-05-23T19:43:35.755-07:00</updated><title type='text'>Android Shell Commands</title><content type='html'>&lt;div&gt;Here you can find the available command set in the shell by typing this at the android shell prompt:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;dumpcrash, am, dumpstate, input, itr, monkey, pm, svc, ssltest,&lt;/div&gt;&lt;div&gt;debuggerd, dhcpcd, hostapd_cli, fillup, linker, logwrapper, telnetd, iftop, mkdosfs, mount,&lt;/div&gt;&lt;div&gt;mv, notify, netstat, printenv, reboot, ps, renice, rm, rmdir,rmmod, sendevent, schedtop,&lt;/div&gt;&lt;div&gt;ping, sh, hciattach, sdptool, logcat, servicemanager, dbus-daemon, debug_tool, flash_image, installd,&lt;/div&gt;&lt;div&gt;dvz, hostapd, htclogkernel, mountd, qemud, radiooptions, toolbox, hcid,&lt;/div&gt;&lt;div&gt;route, setprop, sleep, setconsole, smd, stop, top, start, umount,&lt;/div&gt;&lt;div&gt;vmstat, wipe, watchprops, sync, netcfg, Chmod, date, dd, cmp, cat, dmesg, df,&lt;/div&gt;&lt;div&gt;getevent, getprop, hd, id, ifconfig, insmod, ioctl, kill,&lt;/div&gt;&lt;div&gt;ln, log, lsmod, ls, mkdir, dumpsys, service, playmp3, sdutil,&lt;/div&gt;&lt;div&gt;rild, dalvikvm, dexopt, surfaceflinger, app_process, mediaserver, system_server,&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-4360891805613326724?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/4360891805613326724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2011/05/android-shell-commands.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/4360891805613326724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/4360891805613326724'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2011/05/android-shell-commands.html' title='Android Shell Commands'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-3216354330417428134</id><published>2011-05-22T21:56:00.001-07:00</published><updated>2011-05-22T21:56:55.226-07:00</updated><title type='text'>Combine two images in android java</title><content type='html'>&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In this blog we are combine two images and we have two images stored locally on an SD card or drawble folder in android.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Steps:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Read the image from Source&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;InputStream istream = context.getResources().openRawResource(R.drawable.img1);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;try {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;image1 = BitmapFactory.decodeStream(istream);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;istream = context.getResources().openRawResource(R.drawable.img2);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;image2 = BitmapFactory.decodeStream(istream);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;} finally {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;try {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;istream.close();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;} catch (IOException e) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Define the Image property&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;int width = 0, height = 0;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;if (c.getWidth() &amp;gt; s.getWidth()) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;width = c.getWidth();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;height = c.getHeight() + s.getHeight();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;} else {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;width = s.getWidth();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;height = c.getHeight() + s.getHeight();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Create your target Bitmap,&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Bitmap combinedImages = Bitmap.createBitmap(width * 2, height, Bitmap.Config.ARGB_8888);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Create a Canvas for it, &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Canvas comboImage = new Canvas(combinedImages);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;Use Canvas.drawBitmap to blit each source bitmap into your target bitmap&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;comboImage.drawBitmap(image1, 0f, 0f, null);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;comboImage.drawBitmap(image2, 0f, image1.getHeight()+1, null);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Example:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;public Bitmap combineImages(Context context, int img1, int img2) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;// Bitmap[] mBitmap = new Bitmap[6];&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Bitmap image1, image2;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;InputStream istream = context.getResources().openRawResource(img1);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;try {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;image1 = BitmapFactory.decodeStream(istream);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;istream = context.getResources().openRawResource(img2);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;image2 = BitmapFactory.decodeStream(istream);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;} finally {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;try {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;istream.close();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;} catch (IOException e) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;int width = 0, height = 0;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;if (c.getWidth() &amp;gt; s.getWidth()) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;width = c.getWidth();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;height = c.getHeight() + s.getHeight();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;} else {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;width = s.getWidth();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;height = c.getHeight() + s.getHeight();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Bitmap combinedImages = null;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;combinedImages = Bitmap&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;.createBitmap(width * 2, height, Bitmap.Config.ARGB_8888);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Canvas comboImage = new Canvas(combinedImages);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;comboImage.drawBitmap(c, 0f, 0f, null);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;comboImage.drawBitmap(s, 0f, c.getHeight()+1, null);&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;return cs;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&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/5749561464469791346-3216354330417428134?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/3216354330417428134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2011/05/combine-two-images-in-android-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/3216354330417428134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/3216354330417428134'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2011/05/combine-two-images-in-android-java.html' title='Combine two images in android java'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-5538319322893306580</id><published>2011-05-15T11:11:00.001-07:00</published><updated>2011-05-22T02:37:06.824-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Custom Components'/><title type='text'>Scrollable Text View in andriod -2</title><content type='html'>&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This article helps to making Scrollable TextView using TextView with dispatchKeyEvent&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;we can make a scrollable textview while implement the setMovementMethod and dispatchKeyEvent.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1. private TextView mTextView;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2. Set the Required data in the TextView&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-style-span"  &gt;mTextView = (TextView) findViewById(R.id.textView1);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;mTextView.setText("this is for testing \nthis is for testing \nthis is for testing &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;\nthis is for testing \nthis is for testing \nthis is for testing \n");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;3. mTextView.setMovementMethod(new ScrollingMovementMethod(){.....})&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;4. Override the methods in ScrollingMovementMethod&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;new ScrollingMovementMethod() {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;public void onTakeFocus(TextView widget, Spannable text, int dir) {}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;@Override&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;public boolean onKeyDown(TextView widget, Spannable buffer,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;int keyCode, KeyEvent event) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;switch (keyCode) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;case KeyEvent.KEYCODE_DPAD_DOWN:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;for (int i = 0, scrollAmount = getScrollAmount(widget); i &amp;lt; scrollAmount; i++) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;down(widget, buffer);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;return true;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;case KeyEvent.KEYCODE_DPAD_UP:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;for (int i = 0, scrollAmount = getScrollAmount(widget); i &amp;lt; scrollAmount; i++) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;up(widget, buffer);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;return true;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;default:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;return super.onKeyDown(widget, buffer, keyCode, event);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;private int getScrollAmount(TextView widget) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;final int visibleLineCount = (int) ((1f * widget.getHeight()) / widget&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;.getLineHeight());&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;int scrollAmount = visibleLineCount - 1;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;if (scrollAmount &amp;lt; 1) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;scrollAmount = 1;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;return scrollAmount;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;5. Call the dispatch method in your code&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-style-span"  &gt;mTextView.dispatchKeyEvent(event);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;u&gt;SAMPLE&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;public class MainActivity extends Activity {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;/** Called when the activity is first created. */&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;private TextView mTextView;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;@Override&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;public void onCreate(Bundle savedInstanceState) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;super.onCreate(savedInstanceState);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;setContentView(R.layout.main);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;mTextView = (TextView) findViewById(R.id.textView1);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;mTextView&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;.setText("this is for testing \nthis is for testing \nthis is for testing \nthis is for testing \nthis is for testing \nthis is for testing \n");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;mTextView.setMovementMethod(new ScrollingMovementMethod() {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;public void onTakeFocus(TextView widget, Spannable text, int dir) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;@Override&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;public boolean onKeyDown(TextView widget, Spannable buffer,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;     &lt;/span&gt;int keyCode, KeyEvent event) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;switch (keyCode) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;case KeyEvent.KEYCODE_DPAD_DOWN:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;     &lt;/span&gt;for (int i = 0, scrollAmount = getScrollAmount(widget); i &amp;lt; scrollAmount; i++) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;      &lt;/span&gt;down(widget, buffer);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;     &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;     &lt;/span&gt;return true;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;case KeyEvent.KEYCODE_DPAD_UP:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;     &lt;/span&gt;for (int i = 0, scrollAmount = getScrollAmount(widget); i &amp;lt; scrollAmount; i++) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;      &lt;/span&gt;up(widget, buffer);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;     &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;     &lt;/span&gt;return true;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;default:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;     &lt;/span&gt;return super.onKeyDown(widget, buffer, keyCode, event);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;private int getScrollAmount(TextView widget) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;final int visibleLineCount = (int) ((1f * widget.getHeight()) / widget&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;      &lt;/span&gt;.getLineHeight());&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;int scrollAmount = visibleLineCount - 1;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;if (scrollAmount &amp;lt; 1) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;     &lt;/span&gt;scrollAmount = 1;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;return scrollAmount;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;});&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;@Override&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;public boolean onKeyDown(int keyCode, KeyEvent event) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;switch (keyCode) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;case KeyEvent.KEYCODE_DPAD_DOWN:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;return true;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;case KeyEvent.KEYCODE_DPAD_UP:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;mTextView.dispatchKeyEvent(event);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;return true;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;default:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;return super.onKeyDown(keyCode, event);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-5538319322893306580?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/5538319322893306580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2011/05/scrollable-text-view-in-andriod-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5538319322893306580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5538319322893306580'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2011/05/scrollable-text-view-in-andriod-2.html' title='Scrollable Text View in andriod -2'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-5661208147320758314</id><published>2011-05-15T10:29:00.000-07:00</published><updated>2011-05-22T02:37:06.825-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Custom Components'/><title type='text'>Scrollable Text View in andriod</title><content type='html'>&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This article helps to making Scrollable TextView in Android. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We can do it two ways. 1.Create a TextView inside the ScrollView and 2. TextView with dispatch Events. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;u&gt;Create a TextView inside the ScrollView&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&amp;lt; ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content"&lt;/div&gt;&lt;div&gt;                           android:fillViewport="true"&amp;gt;&lt;/div&gt;&lt;div&gt;                           &lt;/div&gt;&lt;div&gt;    &amp;lt; LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent"&amp;gt;&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    &amp;lt; TextView android:text="@+id/TextView01"&lt;/div&gt;&lt;div&gt;        android:id="@+id/mTextView"&lt;/div&gt;&lt;div&gt;        android:layout_width="fill_parent"&lt;/div&gt;&lt;div&gt;        android:layout_height="fill_parent"&amp;gt;&amp;lt; / TextView&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&amp;lt; / LinearLayout&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt; / ScrollView&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;    &lt;!-- LinearLayout--&gt;&lt;/div&gt;&lt;div&gt;&lt;!-- ScrollView--&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;scrollview layout_width="fill_parent" layout_height="wrap_content" div=""&gt;&lt;div&gt;&lt;textview text="@+id/TextView01" div=""&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;u&gt;&lt;b&gt;Activity Implementation&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;&lt;div&gt;mTextView = (TextView) findViewById(R.id.logTextView);&lt;/div&gt;&lt;div&gt;mTextView .setText("");&lt;/div&gt;&lt;div&gt;mTextView .setMovementMethod(ScrollingMovementMethod.getInstance());&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/textview&gt;&lt;/div&gt;&lt;/scrollview&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-5661208147320758314?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/5661208147320758314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2011/05/scrollable-text-view-in-andriod.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5661208147320758314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5661208147320758314'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2011/05/scrollable-text-view-in-andriod.html' title='Scrollable Text View in andriod'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-536825411195076479</id><published>2011-05-12T08:59:00.000-07:00</published><updated>2011-05-22T02:37:45.851-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Coding'/><title type='text'>How to Obfuscated Android Code</title><content type='html'>&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px; font-family: sans-serif; "&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Obfuscated code&lt;/b&gt; is source or machine code that has been made difficult to understand for humans. Programmers may deliberately obfuscate code to conceal its purpose or its logic to prevent tampering, deter reverse engineering, or as a puzzle or recreational challenge for someone reading the source code. &lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px; font-family: sans-serif; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px; font-family: sans-serif; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Programs known as &lt;i&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;obfuscators&lt;/span&gt;&lt;/i&gt; transform readable code into obfuscated code using various techniques. Code obfuscation is different in essence from hardware obfuscation, where description and/or structure of a circuit is modified to hide its functionality.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px; font-family: sans-serif; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px; font-family: sans-serif; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;The following steps to describe the android obfuscation&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; line-height: normal; "&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;1) Setup the obfuscated environment Download the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;follwing&lt;/span&gt; file before you starts&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;ProGuard&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;                &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;ProGuard&lt;/span&gt; is a free Java class file &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;shrinker&lt;/span&gt;, optimizer, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;obfuscator&lt;/span&gt;, and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;preverifier&lt;/span&gt;. It detects and removes unused classes, fields, methods, and attributes. It optimizes &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;bytecode&lt;/span&gt; and removes unused instructions. It renames the remaining classes, fields, and methods using short meaningless names. Finally, it &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;preverifies&lt;/span&gt; the processed code for Java 6 or for Java Micro Edition.&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;                Download From &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;Sourceforge&lt;/span&gt; : &lt;a href="http://sourceforge.net/projects/proguard/files/" target="_blank" style="color: rgb(0, 0, 0); "&gt;http://sourceforge.net/&lt;wbr&gt;projects/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;proguard&lt;/span&gt;/files/&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;               &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;Reference : &lt;a href="http://proguard.sourceforge.net/" target="_blank" style="color: rgb(0, 0, 0); "&gt;http://proguard.sourceforge.&lt;wbr&gt;net/&lt;/a&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;u&gt;&lt;b&gt;Download files from &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;internet&lt;/span&gt; &lt;/b&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;add-&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;proguard&lt;/span&gt;-release.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;xml&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;procfg&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;txt&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;1)  To update an existing Android project, open a command-line and navigate to the tools/ directory of your &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;SDK&lt;/span&gt;. Now run:&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;    android update project --name &lt;project_name&gt; --target &lt;target_id&gt;--path &lt;path_to_your_project&gt;&lt;/path_to_your_project&gt;&lt;/target_id&gt;&lt;/project_name&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;2)  So, now you have a signed build from the command line, but still no obfuscated build.&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;To make things easy, you’re going to want to get two helper files:&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;b&gt;    &lt;span class="Apple-style-span" &gt;            add-&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;proguard&lt;/span&gt;-release.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;xml&lt;/span&gt; and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;procfg&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;txt&lt;/span&gt;            &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;span class="Apple-style-span" &gt;&lt;b&gt;                Copy these files into your root directory (where the build.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21"&gt;xml&lt;/span&gt; file found).&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;                              &lt;wbr&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;3)  To add &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22"&gt;Proguard&lt;/span&gt; to your build, you first need to edit your local properties file to add the location of the directory that &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23"&gt;Proguard&lt;/span&gt; is installed in:&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;proguard.dir=/Directory/&lt;wbr&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24"&gt;Proguard&lt;/span&gt;/Is/Installed/In&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;3) Finally... you need to add our script to your build file and have it override a few targets. To do this, we use the XML “entity” construct. At the top of your build.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25"&gt;xml&lt;/span&gt; file, add an entity that references our script file:&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;!--?xml version="1.0" encoding="UTF-8"?--&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;!--&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26"&gt;DOCTYPE&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;                &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;project [&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;       &lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;&lt;!--ENTITY add-proguard-release SYSTEM "add-proguard-release.xml"--&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;                &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;]&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&amp;gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;4) By default &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_27"&gt;ADT&lt;/span&gt; creates a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_28"&gt;proguard&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_29"&gt;cfg&lt;/span&gt; file with every new project, so if you have an existing project just copy it over from a new dummy project. The next step is to enable &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_30"&gt;ProGuard&lt;/span&gt;, you do this by adding the following to your default.properties file:&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;&lt;b&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;span class="Apple-style-span" &gt;proguard.config=proguard.cfg&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "&gt;(assuming &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_31"&gt;proguard&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_32"&gt;cfg&lt;/span&gt; is the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_33"&gt;ProGuard&lt;/span&gt; configuration file created for you, or copied from a new project, into the project root folder.)&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  &gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&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/5749561464469791346-536825411195076479?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/536825411195076479/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2011/05/how-to-obfuscated-android-code.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/536825411195076479'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/536825411195076479'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2011/05/how-to-obfuscated-android-code.html' title='How to Obfuscated Android Code'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-193456521199615384</id><published>2011-04-28T00:59:00.001-07:00</published><updated>2011-05-22T02:39:39.037-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sample'/><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Read Text From the Raw Content in Resource Folder.</title><content type='html'>&lt;div&gt; You can store the raw content in the raw folder and read using the below method..&lt;/div&gt;&lt;div&gt;1. Create a file in and Raw content &lt;/div&gt;&lt;div&gt;2. Create Method called readTextResource() in the util class&lt;/div&gt;&lt;div&gt;3. Use the below code to read the data &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;StringBuffer strBuffer = new StringBuffer();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;InputStream inputStream = null;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;try {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;inputStream = owner.getResources().openRawResource(resourceId);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;String str = br.readLine();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;while (str != null) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;strBuffer.append(str);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;str = br.readLine();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;} catch (IOException e) {&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;} finally {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;try {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;if (inputStream != null) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;     &lt;/span&gt;inputStream.close();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;} catch (IOException e) {&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;4. Return the StringBuffer value.&lt;/div&gt;&lt;div&gt;5. If you need a html format, you can use the html util class&lt;/div&gt;&lt;div&gt;Html.fromHtml(text); - It returns Spanned instance. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Sample Code&lt;/div&gt;&lt;div&gt;-----------&lt;/div&gt;&lt;div&gt;public class MainActivity extends Activity {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;private Spanned mText = null;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;private TextView mTextView;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;public void onCreate(Bundle savedInstanceState) {&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;super.onCreate(savedInstanceState);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;setContentView(R.layout.main);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;mTextView = (TextView) findViewById(R.id.sampleText);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;if (mText == null) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;String text = readTextResource(R.raw.license, this);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;mText = Html.fromHtml(text);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;mTextView.setText(mText);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;public String readTextResource(int resourceId, Activity owner) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;StringBuffer strBuffer = new StringBuffer();&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;InputStream inputStream = null;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;try {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;inputStream = owner.getResources().openRawResource(resourceId);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;String str = br.readLine();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;while (str != null) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;strBuffer.append(str);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;str = br.readLine();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;} catch (IOException e) {&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;} finally {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;try {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;if (inputStream != null) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;     &lt;/span&gt;inputStream.close();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;} catch (IOException e) {&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;return strBuffer.toString();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;}&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-193456521199615384?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/193456521199615384/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2011/04/read-text-from-raw-content-in-resource.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/193456521199615384'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/193456521199615384'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2011/04/read-text-from-raw-content-in-resource.html' title='Read Text From the Raw Content in Resource Folder.'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-986694757500005749</id><published>2011-04-25T05:17:00.001-07:00</published><updated>2011-05-22T02:40:02.381-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Android Tips - Using Layout Param</title><content type='html'>Layout Param is used to change the layout properties.  You can create a layout instance and assign to required view.&lt;br /&gt;&lt;br /&gt;    LinearLayout.LayoutParams layoutParam = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);&lt;br /&gt;&lt;br /&gt;Sample Code&lt;br /&gt;&lt;br /&gt;    LinearLayout.LayoutParams mLayoutParam = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);&lt;br /&gt;    Button mButton = new Button(this);&lt;br /&gt;    mButton.setLayoutParams(layoutParam);&lt;br /&gt;&lt;br /&gt;The above code works fine but this is not a current solution. It should like the below code&lt;br /&gt;   &lt;br /&gt;    Button mButton = new Button(this);&lt;br /&gt;    ViewGroup.LayoutParam mLayoutParam= mButton.getLayoutParams();&lt;br /&gt;    mLayoutParam.height = ViewGroup.LayoutParams.FILL_PARENT&lt;br /&gt;   &lt;br /&gt;&lt;br /&gt;Thanks to Ashok , I have done the mistake and corrected me&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-986694757500005749?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/986694757500005749/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2011/04/android-tips-using-layout-param.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/986694757500005749'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/986694757500005749'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2011/04/android-tips-using-layout-param.html' title='Android Tips - Using Layout Param'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-1183843423047987159</id><published>2011-04-25T05:02:00.000-07:00</published><updated>2011-05-22T02:40:02.381-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tips'/><title type='text'>Android Window Leak</title><content type='html'>The WindowLeaked exception in the log usually happens when you have some sort of async task that is finishing after the activity that began it is destroyed.&lt;br /&gt;Solution for the above issue, we can dismiss the progress dialog before finish the activity.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Issue :&lt;br /&gt;&lt;br /&gt;Activity com.sample.ViewLeakIssueActivity has leaked window com.android.internal.policy.impl.TvWindow$DecorView@6bc30788 that was originally added here&lt;br /&gt;E/WindowManager( 1687):         at android.view.ViewRoot.&lt;init&gt;(ViewRoot.java:230)&lt;br /&gt;E/WindowManager( 1687):         at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)&lt;br /&gt;-----&lt;br /&gt;&lt;br /&gt;Sample Leak Issue&lt;br /&gt;public class ViewLeakIssueActivity extends Activity {&lt;br /&gt;    volatile  ProgressDialog pd;&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    protected void onCreate(Bundle savedInstanceState) {&lt;br /&gt;        super.onCreate(savedInstanceState);&lt;br /&gt;        setContentView(R.layout.main);&lt;br /&gt;        pd = ProgressDialog.show(ViewLeakIssueActivity.this, "", "test...", true);&lt;br /&gt;       &lt;br /&gt;        new Thread() {&lt;br /&gt;            public void run() {               &lt;br /&gt;                try {                   &lt;br /&gt;                    sleep(5000);&lt;br /&gt;                } catch (InterruptedException e) {&lt;br /&gt;                    // TODO Auto-generated catch block&lt;br /&gt;                    e.printStackTrace();&lt;br /&gt;                }&lt;br /&gt;                    System.out.println("@@@@@@@@@@@"+ViewLeakIssueActivity.this+pd.isShowing());&lt;br /&gt;                   &lt;br /&gt;                        pd.dismiss();&lt;br /&gt;            }&lt;br /&gt;        }.start();&lt;br /&gt;       &lt;br /&gt;        finish();&lt;br /&gt;   &lt;br /&gt;    }&lt;br /&gt;   &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Solution for the above issue, we can dismiss the progress dialog before finish the activity.&lt;br /&gt;&lt;br /&gt;@Override&lt;br /&gt;    public void finish() {&lt;br /&gt;        if(pd.isShowing()){&lt;br /&gt;            pd.dismiss();&lt;br /&gt;        }&lt;br /&gt;        super.finish();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/init&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-1183843423047987159?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/1183843423047987159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2011/04/android-window-leak.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/1183843423047987159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/1183843423047987159'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2011/04/android-window-leak.html' title='Android Window Leak'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-6614801515104400941</id><published>2011-03-31T03:42:00.000-07:00</published><updated>2011-05-22T02:40:27.248-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Updates'/><title type='text'>Android Versions...</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/-HUXwiwYwCP4/TZRarvfhpMI/AAAAAAAAC-k/FUpAhO4hl8s/s1600/untitled.bmp" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 198px; height: 320px;" src="http://2.bp.blogspot.com/-HUXwiwYwCP4/TZRarvfhpMI/AAAAAAAAC-k/FUpAhO4hl8s/s320/untitled.bmp" border="0" alt="" id="BLOGGER_PHOTO_ID_5590192745003197634" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-6614801515104400941?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/6614801515104400941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2011/03/android-versions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/6614801515104400941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/6614801515104400941'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2011/03/android-versions.html' title='Android Versions...'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-HUXwiwYwCP4/TZRarvfhpMI/AAAAAAAAC-k/FUpAhO4hl8s/s72-c/untitled.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-4306640187314448695</id><published>2010-07-11T05:49:00.001-07:00</published><updated>2010-07-11T05:49:19.050-07:00</updated><title type='text'>Lifecycle of an Android Application</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;br/&gt;In most cases, every &lt;b&gt;Android application runs in its own Linux process.&lt;/b&gt; This process is created for the application when some of its code needs to be run, and will remain running until it is no longer needed and the system needs to reclaim its memory for use by other applications.&lt;br/&gt;&lt;br/&gt;An important and unusual feature of Android is that an application process's lifetime is not directly controlled by the application itself. Instead, it is determined by the system through a combination of the parts of the application that the system knows are running, how important these things are to the user, and how much overall memory is available in the system.&lt;br/&gt;&lt;br/&gt;It is important that application developers understand how different application components (in particular Activity, Service, and IntentReceiver) impact the lifetime of the application's process. Not using these components correctly can result in the system killing the application's process while it is doing important work.&lt;br/&gt;&lt;br/&gt;A common example of a process lifecycle bug is an IntentReceiver that starts a thread when it receives an Intent in its onReceiveIntent() method, and then returns from the function. Once it returns, the system considers that IntentReceiver to be no longer active, and thus its hosting process no longer needed (unless other application components are active in it). Thus, it may kill the process at any time to reclaim memory, terminating the spawned thread that is running in it. The solution to this problem is to start a Service from the IntentReceiver, so the system knows that there is still active work being done in the process.&lt;br/&gt;&lt;br/&gt;To determine which processes should be killed when low on memory, Android places them into an "importance hierarchy" based on the components running in them and the state of those components. These are, in order of importance:&lt;br/&gt;&lt;br/&gt;   1. A &lt;b&gt;foreground process&lt;/b&gt; is one holding an Activity at the top of the screen that the user is interacting with (its onResume() method has been called) or an IntentReceiver that is currently running (its onReceiveIntent() method is executing). There will only ever be a few such processes in the system, and these will only be killed as a last resort if memory is so low that not even these processes can continue to run. Generally at this point the device has reached a memory paging state, so this action is required in order to keep the user interface responsive.&lt;br/&gt;&lt;br/&gt;   2. A &lt;b&gt;visible process&lt;/b&gt; is one holding an Activity that is visible to the user on-screen but not in the foreground (its onPause() method has been called). This may occur, for example, if the foreground activity has been displayed with a dialog appearance that allows the previous activity to be seen behind it. Such a process is considered extremely important and will not be killed unless doing so is required to keep all foreground processes running.&lt;br/&gt;&lt;br/&gt;   3. A &lt;b&gt;service process&lt;/b&gt; is one holding a Service that has been started with the startService() method. Though these processes are not directly visible to the user, they are generally doing things that the user cares about (such as background mp3 playback or background network data upload or download), so the system will always keep such processes running unless there is not enough memory to retain all foreground and visible process.&lt;br/&gt;&lt;br/&gt;   4. A&lt;b&gt; background process&lt;/b&gt; is one holding an Activity that is not currently visible to the user (its onStop() method has been called). These processes have no direct impact on the user experience. Provided they implement their activity lifecycle correctly (see Activity for more details), the system can kill such processes at any time to reclaim memory for one of the three previous processes types. Usually there are many of these processes running, so they are kept in an LRU list to ensure the process that was most recently seen by the user is the last to be killed when running low on memory.&lt;br/&gt;&lt;br/&gt;   5.An &lt;b&gt;empty process&lt;/b&gt; is one that doesn't hold any active application components. The only reason to keep such a process around is as a cache to improve startup time the next time a component of its application needs to run. As such, the system will often kill these processes in order to balance overall system resources between these empty cached processes and the underlying kernel caches. &lt;br/&gt;&lt;br/&gt;When deciding how to classify a process, the system picks the most important level of all the components currently active in the process. See the Activity, Service, and IntentReceiver documentation for more detail on how each of these components contribute to the overall lifecycle of a process. The documentation for each of these classes describes in more detail how they impact the overall lifecycle of their application.&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-4306640187314448695?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/4306640187314448695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/07/lifecycle-of-android-application.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/4306640187314448695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/4306640187314448695'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/07/lifecycle-of-android-application.html' title='Lifecycle of an Android Application'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-2611528093208702734</id><published>2010-07-11T05:38:00.000-07:00</published><updated>2010-07-11T05:39:04.178-07:00</updated><title type='text'>Andriod 2D Graphics - Drawing Pad Sample</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;In this aritcle shows how to use onDraw() method and create a simple drawing program. The only significant files are Draw activity and the DrawView. You should see a black screen and be able to draw on it with your finger. &lt;br/&gt;&lt;br/&gt;This activity creates the DrawView and sets it as activity's main content. It also sets the borderless window.&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;MainActivity.java&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#330000'&gt;public class MainActivity extends Activity {&lt;br/&gt;    DrawView drawView;&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);&lt;br/&gt;        requestWindowFeature(Window.FEATURE_NO_TITLE);&lt;br/&gt;        drawView = new DrawView(this);&lt;br/&gt;        setContentView(drawView);&lt;br/&gt;        drawView.requestFocus();&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    // DrawView is a view. It listens to mouse click events and draws a point at the point that it was clicked on.&lt;br/&gt;   public class DrawView extends View implements OnTouchListener {&lt;br/&gt;        List&amp;lt;Point&amp;gt; points = new ArrayList&amp;lt;Point&amp;gt;();&lt;br/&gt;        Paint paint = new Paint();&lt;br/&gt;        public DrawView(Context context) {&lt;br/&gt;        super(context);&lt;br/&gt;        setFocusable(true);&lt;br/&gt;        setFocusableInTouchMode(true);&lt;br/&gt;        this.setOnTouchListener(this);&lt;br/&gt;        paint.setColor(Color.WHITE);&lt;br/&gt;        paint.setAntiAlias(true);&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public void onDraw(Canvas canvas) {&lt;br/&gt;        for (Point point : points) {&lt;br/&gt;            canvas.drawCircle(point.x, point.y, 5, paint);&lt;br/&gt;        }&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public boolean onTouch(View view, MotionEvent event) {&lt;br/&gt;        Point point = new Point();&lt;br/&gt;        point.x = event.getX();&lt;br/&gt;        point.y = event.getY();&lt;br/&gt;        points.add(point);&lt;br/&gt;        invalidate();&lt;br/&gt;        return true;&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;    class Point {&lt;br/&gt;        float x, y;&lt;br/&gt;        @Override&lt;br/&gt;        public String toString() {&lt;br/&gt;        return x + ", " + y;&lt;br/&gt;        }&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-2611528093208702734?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/2611528093208702734/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/07/andriod-2d-graphics-drawing-pad-sample.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/2611528093208702734'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/2611528093208702734'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/07/andriod-2d-graphics-drawing-pad-sample.html' title='Andriod 2D Graphics - Drawing Pad Sample'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-3310964905052127205</id><published>2010-07-11T04:59:00.000-07:00</published><updated>2010-07-11T05:00:01.919-07:00</updated><title type='text'>Custom ContextMenu using PopupWindow Sample</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Here we are creating a  custom contextmenu using PopupWindow in android. A simple PopUpWindow can be created using the following steps.&lt;br/&gt;   1)A layout XML  which describes the View that will be rendered within a PopUpWindow  has to be created.&lt;br/&gt;   2)Invoke the PopUpWindow by inflating the layout XML,  and assign appropriate  “parent view”  to  the pop-up.&lt;br/&gt;&lt;br/&gt;&lt;font color='#003300'&gt;&lt;u&gt;&lt;b&gt;Popup_example.xml:&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color='#330000'&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;android:orientation="vertical" android:padding="10dip" android:layout_width="fill_parent" &lt;br/&gt;android:layout_height="wrap_content" &amp;gt;&lt;br/&gt;    &amp;lt;TextView android:layout_width="fill_parent" &lt;br/&gt;    android:layout_height="wrap_content" android:layout_marginTop="10dip" android:text="Test Pop-Up"/&amp;gt; &lt;br/&gt;&amp;lt;/LinearLayout&amp;gt;&lt;br/&gt;&lt;/i&gt;&lt;/font&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;&lt;font color='#003300'&gt;Java Code:&lt;/font&gt;&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;font color='#330000'&gt;&lt;i&gt;    LayoutInflater inflater = (LayoutInflater) &lt;br/&gt;    this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); &lt;br/&gt;    PopupWindow pw = new PopupWindow( &lt;br/&gt;    inflater.inflate(R.layout.popup_example, null, false),  100,  100,    true); &lt;br/&gt;    // The code below assumes that the root container has an id called 'main' &lt;br/&gt;    pw.showAtLocation(this.findViewById(R.id.main), Gravity.CENTER, 0, 0);  &lt;br/&gt;&lt;/i&gt;&lt;/font&gt;&lt;br/&gt;&lt;font color='#003300'&gt;&lt;u&gt;&lt;b&gt;How to Dismiss the PopUp Window?&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Declare the necessary variables:&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#330000'&gt;         private PopupWindow Popup;&lt;br/&gt;       //how much time your popup window should appear &lt;br/&gt;        private static final int POPUP_DISMISS_DELAY = 4000&lt;br/&gt;&lt;/font&gt;&lt;/i&gt;       &lt;font color='#330000'&gt;&lt;i&gt;private DismissPopup mDismissPopup = new DismissPopup();&lt;/i&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Class for dismissing the PopUp Window&lt;/b&gt;&lt;br/&gt;Create a class which helps in dismissing the window automatically after the specified time:&lt;br/&gt;&lt;i&gt;&lt;font color='#330000'&gt;class DismissPopup implements Runnable {&lt;br/&gt;  public void run() {&lt;br/&gt;      // Protect against null-pointer exceptions&lt;br/&gt;      if (mPopup != null) {&lt;br/&gt;          mPopup.dismiss();&lt;br/&gt;      }&lt;br/&gt;  }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;/i&gt;&lt;font color='#003300'&gt;&lt;u&gt;&lt;b&gt;Code Snippet:&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#330000'&gt;Popup = new PopupWindow(this.getViewInflate()&lt;br/&gt;                  .inflate(R.layout.main1,null,null),0,0);   &lt;br/&gt;Popup.setOutsideTouchable(false);&lt;br/&gt;Popup.setTouchInterceptor(new OnTouchListener() {&lt;br/&gt;&lt;br/&gt;public boolean onTouch(View v, MotionEvent event) {&lt;br/&gt;return false;&lt;br/&gt;}});&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#330000'&gt;Popup.showAtLocation(this.findViewById(R.id.main2),Gravity.BOTTOM, 20, 20);&lt;br/&gt;&lt;br/&gt;youractivity.postDelayed(mDismissPopup, POPUP_DISMISS_DELAY)&lt;/font&gt;&lt;/i&gt;;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-3310964905052127205?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/3310964905052127205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/07/custom-contextmenu-using-popupwindow.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/3310964905052127205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/3310964905052127205'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/07/custom-contextmenu-using-popupwindow.html' title='Custom ContextMenu using PopupWindow Sample'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-7029995382653831006</id><published>2010-07-11T04:05:00.001-07:00</published><updated>2010-07-11T04:07:37.702-07:00</updated><title type='text'>2D graphics with Effects</title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;In this article help us to set the different type of effect in the drawable.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#990000;"&gt;&lt;b&gt;&lt;big&gt;Effects &lt;/big&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color:#003300;"&gt;Shadow Effect &lt;/span&gt;&lt;/b&gt;&lt;br /&gt;    This draws a shadow layer below the main layer, with the specified offset and color, and blur radius.&lt;br /&gt;                                                     &lt;img src="http://lh5.ggpht.com/_Y3dHlWzBWgA/TDmiB8V8rwI/AAAAAAAAB2s/GVkS0ZOotmQ/%5BUNSET%5D.png?imgmax=800" style="max-width: 800px;" height="141" width="210" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color:#003300;"&gt;MaskFilterEffect&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;    MaskFilter is the base class for object that perform transformations on an alpha-channel mask before drawing it. A subclass of MaskFilter may be installed into a Paint. Blur and emboss are implemented as subclasses of MaskFilter.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;Sample Implementation:&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;    &lt;b&gt;&lt;span style="color:#003300;"&gt;Blur Filter&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;        paint.setMaskFilter(new BlurMaskFilter(15, Blur.INNER));&lt;br /&gt;        paint.setMaskFilter(new BlurMaskFilter(15, Blur.OUTER));&lt;br /&gt;        paint.setMaskFilter(new BlurMaskFilter(15, Blur.SOLID));&lt;br /&gt;        paint.setMaskFilter(new BlurMaskFilter(15, Blur.NORMAL));&lt;br /&gt;        &lt;img src="http://lh5.ggpht.com/_Y3dHlWzBWgA/TDmiJyxwt1I/AAAAAAAAB2w/jLCxY8DsxkM/%5BUNSET%5D.png?imgmax=800" style="max-width: 800px;" height="118" width="174" /&gt;  &lt;img src="http://lh6.ggpht.com/_Y3dHlWzBWgA/TDmiXrxecII/AAAAAAAAB20/-dCiaqjuOog/%5BUNSET%5D.png?imgmax=800" style="max-width: 800px;" height="118" width="174" /&gt;  &lt;img src="http://lh6.ggpht.com/_Y3dHlWzBWgA/TDmilkUmpmI/AAAAAAAAB24/t6pH1_eE3TQ/%5BUNSET%5D.png?imgmax=800" style="max-width: 800px;" height="118" width="177" /&gt; &lt;img src="http://lh5.ggpht.com/_Y3dHlWzBWgA/TDmiwkl9QwI/AAAAAAAAB28/Uv1AhHYWqKk/%5BUNSET%5D.png?imgmax=800" style="max-width: 800px;" height="118" width="177" /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color:#003300;"&gt;    Emboss Filter&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;        paint.setMaskFilter(new EmbossMaskFilter(new float[] { 1, 1, 1 },0.4f, 10, 8.2f));&lt;br /&gt;        &lt;img src="http://lh6.ggpht.com/_Y3dHlWzBWgA/TDmjFiHKA8I/AAAAAAAAB3A/dPKU-gGppCE/%5BUNSET%5D.png?imgmax=800" style="max-width: 800px;" height="124" width="185" /&gt;&lt;br /&gt;&lt;span style="color:#003300;"&gt;&lt;b&gt;Shader Effect&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Shader is the based class for objects that return horizontal spans of colors during drawing. A subclass of Shader is installed in a Paint calling paint.setShader(shader). After that any object (other than a bitmap) that is drawn with that paint will get its color(s) from the shader.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;Shader Sample Implementation:&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;    &lt;b&gt;&lt;span style="color:#003300;"&gt;LinearGradient&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;        paint.setShader(new LinearGradient(8f, 80f, 30f, 20f, Color.RED,Color.WHITE, Shader.TileMode.MIRROR));&lt;br /&gt;&lt;br /&gt;    &lt;b&gt;&lt;span style="color:#003300;"&gt;RadialGradient&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;        paint.setShader(new RadialGradient(8f, 80f, 90f, Color.RED,Color.WHITE, Shader.TileMode.MIRROR));&lt;br /&gt;&lt;br /&gt;    &lt;b&gt;&lt;span style="color:#003300;"&gt;SweepGradient&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;        paint.setShader(new SweepGradient(80, 80, Color.RED, Color.WHITE));&lt;br /&gt;&lt;br /&gt;      &lt;img src="http://lh5.ggpht.com/_Y3dHlWzBWgA/TDmjRo_58CI/AAAAAAAAB3E/N0sG1bAZlO0/%5BUNSET%5D.png?imgmax=800" style="max-width: 800px;" height="113" width="169" /&gt;      &lt;img src="http://lh4.ggpht.com/_Y3dHlWzBWgA/TDmjYF9SKeI/AAAAAAAAB3I/7ZuTI40dqcU/%5BUNSET%5D.png?imgmax=800" style="max-width: 800px;" height="112" width="165" /&gt;&lt;img src="http://lh6.ggpht.com/_Y3dHlWzBWgA/TDmkCFqknfI/AAAAAAAAB3Q/GXbT0Ak_e4Y/%5BUNSET%5D.png?imgmax=800" style="max-width: 800px;" height="111" width="164" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;big&gt;&lt;span style="color:#660000;"&gt;&lt;small&gt;&lt;big&gt;&lt;u&gt;&lt;b&gt;Sample Apps&lt;/b&gt;&lt;/u&gt;&lt;/big&gt;&lt;/small&gt;&lt;/span&gt;&lt;/big&gt;&lt;br /&gt;&lt;u&gt;&lt;span style="color:#003300;"&gt;&lt;b&gt;Layout :  main.xml&lt;/b&gt;&lt;/span&gt;&lt;/u&gt;&lt;br /&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;    android:orientation="vertical" android:layout_width="fill_parent"&lt;br /&gt;    android:layout_height="fill_parent"&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;LinearLayout android:id="@+id/ImageView01"  android:layout_height="150dip" android:layout_width="150dip"&lt;br /&gt;        android:layout_gravity="center"&amp;gt;&amp;lt;/LinearLayout&amp;gt;&lt;br /&gt;    &amp;lt;LinearLayout android:id="@+id/LinearLayout01"  android:layout_width="wrap_content" android:layout_height="wrap_content"&lt;br /&gt;        android:layout_gravity="center"&amp;gt;&lt;br /&gt;        &amp;lt;Button android:text="Draw Cicle" android:id="@+id/circle"&lt;br /&gt;            android:layout_height="wrap_content" android:layout_gravity="center"&lt;br /&gt;            android:layout_width="85dip" android:gravity="center"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br /&gt;        &amp;lt;Button android:text="Anti Alias" android:id="@+id/antialias"&lt;br /&gt;            android:layout_height="wrap_content" android:layout_gravity="center"&lt;br /&gt;            android:layout_width="85dip" android:gravity="center"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br /&gt;        &amp;lt;Button android:text="Shadow" android:id="@+id/shadow"&lt;br /&gt;            android:layout_height="wrap_content" android:layout_gravity="center"&lt;br /&gt;            android:layout_width="85dip" android:gravity="center"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br /&gt;    &amp;lt;/LinearLayout&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;LinearLayout android:id="@+id/LinearLayout01"&lt;br /&gt;        android:layout_width="wrap_content" android:layout_height="wrap_content"&lt;br /&gt;        android:layout_gravity="center"&amp;gt;&lt;br /&gt;        &amp;lt;Button android:text="Blur Effect - 1" android:id="@+id/blur1"&lt;br /&gt;            android:layout_height="wrap_content" android:layout_gravity="center"&lt;br /&gt;            android:layout_width="85dip" android:gravity="center"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br /&gt;        &amp;lt;Button android:text="Blur Effect - 2" android:id="@+id/blur2"&lt;br /&gt;            android:layout_height="wrap_content" android:layout_gravity="center"&lt;br /&gt;            android:layout_width="85dip" android:gravity="center"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br /&gt;        &amp;lt;Button android:text="Blur Effect - 3" android:id="@+id/blur3"&lt;br /&gt;            android:layout_height="wrap_content" android:layout_gravity="center"&lt;br /&gt;            android:layout_width="85dip" android:gravity="center"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br /&gt;    &amp;lt;/LinearLayout&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;LinearLayout android:id="@+id/LinearLayout01"&lt;br /&gt;        android:layout_width="wrap_content" android:layout_height="wrap_content"&lt;br /&gt;        android:layout_gravity="center"&amp;gt;&lt;br /&gt;        &amp;lt;Button android:text="Blur Effect - 4" android:id="@+id/blur4"&lt;br /&gt;            android:layout_height="wrap_content" android:layout_gravity="center"&lt;br /&gt;            android:layout_width="85dip" android:gravity="center"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br /&gt;        &amp;lt;Button android:text="Emboss" android:id="@+id/emboss"&lt;br /&gt;            android:layout_height="wrap_content" android:layout_gravity="center"&lt;br /&gt;            android:layout_width="85dip" android:gravity="center"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br /&gt;    &amp;lt;/LinearLayout&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;LinearLayout android:id="@+id/LinearLayout01"&lt;br /&gt;        android:layout_width="wrap_content" android:layout_height="wrap_content"&lt;br /&gt;        android:layout_gravity="center"&amp;gt;&lt;br /&gt;        &amp;lt;Button android:text="Sweep" android:id="@+id/sweep"&lt;br /&gt;            android:layout_height="wrap_content" android:layout_gravity="center"&lt;br /&gt;            android:layout_width="85dip" android:gravity="center"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br /&gt;        &amp;lt;Button android:text="Linear" android:id="@+id/linear"&lt;br /&gt;            android:layout_height="wrap_content" android:layout_gravity="center"&lt;br /&gt;            android:layout_width="85dip" android:gravity="center"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br /&gt;        &amp;lt;Button android:text="Radial" android:id="@+id/radial"&lt;br /&gt;            android:layout_height="wrap_content" android:layout_gravity="center"&lt;br /&gt;            android:layout_width="85dip" android:gravity="center"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br /&gt;    &amp;lt;/LinearLayout&amp;gt;&lt;br /&gt;&amp;lt;/LinearLayout&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color:#003300;"&gt;&lt;u&gt;MainActivity.java&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;i&gt;&lt;span style="color:#660000;"&gt;&lt;br /&gt;public class MainActivity extends Activity implements OnClickListener {&lt;br /&gt;&lt;br /&gt;    LinearLayout imageView;&lt;br /&gt;    Button circle, antialias, shadow, blur1, blur2, blur3, blur4, emboss,&lt;br /&gt;            sweep, radial, linear;&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br /&gt;        super.onCreate(savedInstanceState);&lt;br /&gt;        setContentView(R.layout.main);&lt;br /&gt;        imageView = (LinearLayout) findViewById(R.id.ImageView01);&lt;br /&gt;        circle = (Button) findViewById(R.id.circle);&lt;br /&gt;        antialias = (Button) findViewById(R.id.antialias);&lt;br /&gt;        shadow = (Button) findViewById(R.id.shadow);&lt;br /&gt;        blur1 = (Button) findViewById(R.id.blur1);&lt;br /&gt;        blur2 = (Button) findViewById(R.id.blur2);&lt;br /&gt;        blur3 = (Button) findViewById(R.id.blur3);&lt;br /&gt;        blur4 = (Button) findViewById(R.id.blur4);&lt;br /&gt;&lt;br /&gt;        emboss = (Button) findViewById(R.id.emboss);&lt;br /&gt;        sweep = (Button) findViewById(R.id.sweep);&lt;br /&gt;        linear = (Button) findViewById(R.id.linear);&lt;br /&gt;        radial = (Button) findViewById(R.id.radial);&lt;br /&gt;&lt;br /&gt;        circle.setOnClickListener(this);&lt;br /&gt;        antialias.setOnClickListener(this);&lt;br /&gt;        shadow.setOnClickListener(this);&lt;br /&gt;        blur1.setOnClickListener(this);&lt;br /&gt;        blur2.setOnClickListener(this);&lt;br /&gt;        blur3.setOnClickListener(this);&lt;br /&gt;        blur4.setOnClickListener(this);&lt;br /&gt;        emboss.setOnClickListener(this);&lt;br /&gt;        sweep.setOnClickListener(this);&lt;br /&gt;        linear.setOnClickListener(this);&lt;br /&gt;        radial.setOnClickListener(this);&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public void onClick(View v) {&lt;br /&gt;        imageView.removeAllViews();&lt;br /&gt;        switch (v.getId()) {&lt;br /&gt;        case R.id.circle:&lt;br /&gt;            imageView.addView(new DrawView(MainActivity.this));&lt;br /&gt;            break;&lt;br /&gt;        case R.id.antialias:&lt;br /&gt;            imageView.addView(new DrawView(MainActivity.this).getAntiAlias());&lt;br /&gt;            break;&lt;br /&gt;        case R.id.shadow:&lt;br /&gt;            imageView&lt;br /&gt;                    .addView(new DrawView(MainActivity.this).getShadowEffect());&lt;br /&gt;            break;&lt;br /&gt;        case R.id.blur1:&lt;br /&gt;            imageView.addView(new DrawView(MainActivity.this)&lt;br /&gt;                    .getBlurMaskFitler(1));&lt;br /&gt;            break;&lt;br /&gt;        case R.id.blur2:&lt;br /&gt;            imageView.addView(new DrawView(MainActivity.this)&lt;br /&gt;                    .getBlurMaskFitler(2));&lt;br /&gt;            break;&lt;br /&gt;        case R.id.blur3:&lt;br /&gt;            imageView.addView(new DrawView(MainActivity.this)&lt;br /&gt;                    .getBlurMaskFitler(3));&lt;br /&gt;            break;&lt;br /&gt;&lt;br /&gt;        case R.id.blur4:&lt;br /&gt;            imageView.addView(new DrawView(MainActivity.this)&lt;br /&gt;                    .getBlurMaskFitler(4));&lt;br /&gt;            break;&lt;br /&gt;        case R.id.emboss:&lt;br /&gt;            imageView.addView(new DrawView(MainActivity.this)&lt;br /&gt;                    .getEmbossMaskFilter());&lt;br /&gt;            break;&lt;br /&gt;        case R.id.sweep:&lt;br /&gt;            imageView.addView(new DrawView(MainActivity.this)&lt;br /&gt;                    .getSweepShaderEffect());&lt;br /&gt;            break;&lt;br /&gt;        case R.id.linear:&lt;br /&gt;            imageView.addView(new DrawView(MainActivity.this)&lt;br /&gt;                    .getLinearShaderEffect());&lt;br /&gt;            break;&lt;br /&gt;        case R.id.radial:&lt;br /&gt;            imageView.addView(new DrawView(MainActivity.this)&lt;br /&gt;                    .getRadialShaderEffect());&lt;br /&gt;            break;&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public class DrawView extends View {&lt;br /&gt;        Paint paint = new Paint();&lt;br /&gt;        Context c;&lt;br /&gt;        final float xPos = 80, yPos = 80, radius = 40;&lt;br /&gt;&lt;br /&gt;        public DrawView(Context context) {&lt;br /&gt;            super(context);&lt;br /&gt;            c = context;&lt;br /&gt;            paint.setColor(Color.WHITE);&lt;br /&gt;            invalidate();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        private View getAntiAlias() {&lt;br /&gt;&lt;br /&gt;            paint.setAntiAlias(true);&lt;br /&gt;            return this;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        private View getShadowEffect() {&lt;br /&gt;            paint.setAntiAlias(true);&lt;br /&gt;            paint.setShadowLayer(10, 10, 5, Color.RED);&lt;br /&gt;            return this;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        private View getBlurMaskFitler(int type) {&lt;br /&gt;            invalidate();&lt;br /&gt;            paint.setAntiAlias(true);&lt;br /&gt;            switch (type) {&lt;br /&gt;            case 1:&lt;br /&gt;                paint.setMaskFilter(new BlurMaskFilter(15, Blur.INNER));&lt;br /&gt;                break;&lt;br /&gt;            case 2:&lt;br /&gt;                paint.setMaskFilter(new BlurMaskFilter(15, Blur.OUTER));&lt;br /&gt;                break;&lt;br /&gt;            case 3:&lt;br /&gt;                paint.setMaskFilter(new BlurMaskFilter(15, Blur.SOLID));&lt;br /&gt;                break;&lt;br /&gt;            case 4:&lt;br /&gt;                paint.setMaskFilter(new BlurMaskFilter(15, Blur.NORMAL));&lt;br /&gt;                break;&lt;br /&gt;            }&lt;br /&gt;            return this;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        private View getEmbossMaskFilter() {&lt;br /&gt;            paint.setAntiAlias(true);&lt;br /&gt;            paint.setMaskFilter(new EmbossMaskFilter(new float[] { 1, 1, 1 },&lt;br /&gt;                    0.4f, 10, 8.2f));&lt;br /&gt;            return this;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        private View getSweepShaderEffect() {&lt;br /&gt;            paint.setAntiAlias(true);&lt;br /&gt;            paint.setShader(new SweepGradient(80, 80, Color.RED, Color.WHITE));&lt;br /&gt;            return this;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        private View getRadialShaderEffect() {&lt;br /&gt;            paint.setAntiAlias(true);&lt;br /&gt;            paint.setShader(new RadialGradient(8f, 80f, 90f, Color.RED,&lt;br /&gt;                    Color.WHITE, Shader.TileMode.MIRROR));&lt;br /&gt;            return this;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        private View getLinearShaderEffect() {&lt;br /&gt;            paint.setAntiAlias(true);&lt;br /&gt;            paint.setShader(new LinearGradient(8f, 80f, 30f, 20f, Color.RED,&lt;br /&gt;                    Color.WHITE, Shader.TileMode.MIRROR));&lt;br /&gt;            return this;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        @Override&lt;br /&gt;        public void onDraw(Canvas canvas) {&lt;br /&gt;            canvas.drawCircle(xPos, yPos, radius, paint);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-7029995382653831006?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/7029995382653831006/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/07/2d-graphics-with-effects_11.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/7029995382653831006'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/7029995382653831006'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/07/2d-graphics-with-effects_11.html' title='2D graphics with Effects'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_Y3dHlWzBWgA/TDmiB8V8rwI/AAAAAAAAB2s/GVkS0ZOotmQ/s72-c/%5BUNSET%5D.png?imgmax=800' height='72' width='72'/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-8819732129424635140</id><published>2010-07-07T09:03:00.001-07:00</published><updated>2010-07-09T18:41:27.101-07:00</updated><title type='text'>Android 2D Graphics Example</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;This example shows how to use onDraw() method and create a simple  drawing program. The only significant files are Draw activity and the  DrawView.&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;MainActivity.java&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;public class MainActivity extends Activity {  &lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);       &lt;br/&gt;        DrawView drawView = new DrawView(this);&lt;br/&gt;        setContentView(drawView);&lt;br/&gt;        drawView.requestFocus();&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;public class DrawView extends View {&lt;br/&gt;    Paint paint = new Paint();&lt;br/&gt;    Context c;&lt;br/&gt;    public DrawView(Context context) {&lt;br/&gt;        super(context);&lt;br/&gt;        c= context;     &lt;br/&gt;        paint.setColor(Color.WHITE);&lt;br/&gt;        paint.setAntiAlias(true);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;   public void onDraw(Canvas canvas) {&lt;br/&gt;            canvas.drawCircle(100, 100, 50, paint);&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=d9f1b5d5-758b-8e58-8fa5-d77263611ecd' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-8819732129424635140?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/8819732129424635140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/07/android-2d-graphics-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/8819732129424635140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/8819732129424635140'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/07/android-2d-graphics-example.html' title='Android 2D Graphics Example'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-8690155664221761513</id><published>2010-06-26T23:03:00.001-07:00</published><updated>2010-06-26T23:03:54.313-07:00</updated><title type='text'>Sample Handler Implementation</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Handler is a verry useful and powerful component in Android. Some special features of Handler are,&lt;br/&gt;&lt;br/&gt;&lt;i&gt;     If handler is created without any parameter, then it will be created in the same thread itself.&lt;br/&gt;     We can pass data to handler using message&lt;br/&gt;&lt;/i&gt;&lt;br/&gt;I have created the below sample application, which is using handler efficiently. Increment the count for one second.&lt;br/&gt;&lt;br/&gt;So if we need to create a seperate thread for handler, first we need to create a thread and create the handler inside it. &lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;MainActivity&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;small&gt;&lt;i&gt;&lt;font color='#330000'&gt;public class MainActivity extends Activity {&lt;br/&gt;    TextView tv;&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        setContentView(R.layout.main);&lt;br/&gt;        tv = (TextView) findViewById(R.id.TextView01);&lt;br/&gt;        new Thread() {&lt;br/&gt;            public void run() {&lt;br/&gt;                int i = 0;&lt;br/&gt;                while (i &amp;lt;= 100) {&lt;br/&gt;                    try {&lt;br/&gt;                        sleep(1000);&lt;br/&gt;                    } catch (InterruptedException e) {&lt;br/&gt;                        // TODO Auto-generated catch block&lt;br/&gt;                        e.printStackTrace();&lt;br/&gt;                    }&lt;br/&gt;                    messageHandler.sendMessage(Message&lt;br/&gt;                            .obtain(messageHandler, i));&lt;br/&gt;                    i++;&lt;br/&gt;                }&lt;br/&gt;            }&lt;br/&gt;        }.start();&lt;br/&gt;    }&lt;br/&gt;    private Handler messageHandler = new Handler() {&lt;br/&gt;        public void handleMessage(Message msg) {&lt;br/&gt;            tv.setText(msg.what + "");&lt;br/&gt;        }&lt;br/&gt;    };&lt;br/&gt;}&lt;/font&gt;&lt;/i&gt;&lt;/small&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Main.xml&lt;/b&gt;&lt;/u&gt;&lt;small&gt;&lt;font color='#330000'&gt;&lt;i&gt;&lt;br/&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;    android:orientation="vertical" android:layout_width="fill_parent"&lt;br/&gt;    android:layout_height="fill_parent"&amp;gt;&lt;br/&gt;&amp;lt;TextView android:text="@+id/TextView01" android:id="@+id/TextView01"&lt;br/&gt;    android:layout_width="wrap_content" android:layout_height="wrap_content"&lt;br/&gt;    android:textSize="25dip" android:layout_gravity="center"&lt;br/&gt;    android:layout_marginTop="150dip"&amp;gt;&amp;lt;/TextView&amp;gt;&lt;br/&gt;&amp;lt;/LinearLayout&amp;gt;&lt;/i&gt;&lt;/font&gt;&lt;/small&gt;&lt;u&gt;&lt;b&gt;&lt;br/&gt;&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=4075b3bf-71e3-8ee6-b483-f1dbffef820f' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-8690155664221761513?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/8690155664221761513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/06/sample-handler-implementation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/8690155664221761513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/8690155664221761513'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/06/sample-handler-implementation.html' title='Sample Handler Implementation'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-1866025030855591254</id><published>2010-06-08T08:37:00.001-07:00</published><updated>2010-06-08T08:37:33.419-07:00</updated><title type='text'>Sample Rating Bar Implementation</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;A RatingBar is an extension of SeekBar and ProgressBar that shows a rating in stars. &lt;br/&gt;&lt;br/&gt;The user can touch/drag or use arrow keys to set the rating when using the default size RatingBar. &lt;br/&gt;&lt;br/&gt;The smaller RatingBar style and &lt;br/&gt;the larger indicator-only style do not support user interaction and should only be used as indicators.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;larger indicator-only    -    style="?android:attr/ratingBarStyleIndicator"&lt;br/&gt;smaller RatingBar     -    style="?android:attr/ratingBarStyleSmall"&lt;br/&gt;Default            -    style="?android:attr/ratingBarStyle"&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=b1ea0d70-9f70-8f7a-95e6-d81058424fd2' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-1866025030855591254?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/1866025030855591254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/06/sample-rating-bar-implementation.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/1866025030855591254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/1866025030855591254'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/06/sample-rating-bar-implementation.html' title='Sample Rating Bar Implementation'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-7342764821981227542</id><published>2010-05-20T19:42:00.001-07:00</published><updated>2010-05-20T19:42:23.774-07:00</updated><title type='text'>Create a Circle in Andrind</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;In this Ariticle helps to create a circle in andriod using &lt;br/&gt;&lt;br/&gt;&lt;b&gt;Create a Customized View Class&lt;/b&gt;&lt;br/&gt;public class Ball extends View {}&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Override the onDraw() &lt;/b&gt;&lt;br/&gt;protected void onDraw(Canvas canvas) { }&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Create Paint Object for draw the circle&lt;/b&gt;&lt;br/&gt;mPaints1 = new Paint();&lt;br/&gt;        mPaints2 = new Paint();&lt;br/&gt;        mPaints1.setAntiAlias(true);&lt;br/&gt;        mPaints1.setStyle(Paint.Style.FILL);&lt;br/&gt;&lt;br/&gt;        mPaints2 = new Paint(mPaints1);&lt;br/&gt;        mPaints2.setColor(Color.BLUE);&lt;br/&gt;        mBigOval = new RectF(40, 10, 280, 250);&lt;br/&gt;&lt;br/&gt;Draw Circle using drawArc&lt;br/&gt;&lt;b&gt;canvas.drawArc(oval, mStart, mSweep, useCenter, paint);&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;&lt;u&gt;SourceCode &lt;/u&gt;&lt;/b&gt;&lt;br/&gt;&lt;font color='#330000'&gt;&lt;br/&gt;public class Ball extends View {&lt;br/&gt;&lt;br/&gt;    private Paint mPaints2;&lt;br/&gt;    private Paint mPaints1;&lt;br/&gt;    private RectF mBigOval;&lt;br/&gt;    private float mStart, mSweep;&lt;br/&gt;    private int mBigIndex;&lt;br/&gt;&lt;br/&gt;    public Ball(Context context) {&lt;br/&gt;        super(context);&lt;br/&gt;&lt;br/&gt;        mPaints1 = new Paint();&lt;br/&gt;        mPaints2 = new Paint();&lt;br/&gt;        mPaints1.setAntiAlias(true);&lt;br/&gt;        mPaints1.setStyle(Paint.Style.FILL);&lt;br/&gt;&lt;br/&gt;        mPaints2 = new Paint(mPaints1);&lt;br/&gt;        mPaints2.setColor(Color.BLUE);&lt;br/&gt;        mBigOval = new RectF(40, 10, 280, 250);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    private void drawArcs(Canvas canvas, RectF oval, boolean useCenter,&lt;br/&gt;            Paint paint) {&lt;br/&gt;        canvas.drawArc(oval, mStart, mSweep, useCenter, paint);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    protected void onDraw(Canvas canvas) {&lt;br/&gt;        canvas.drawColor(Color.WHITE);&lt;br/&gt;        drawArcs(canvas, mBigOval, true, mPaints2);&lt;br/&gt;        mSweep += 2;&lt;br/&gt;        if (mSweep &amp;gt; 360) {&lt;br/&gt;            mStart += 10;&lt;br/&gt;            if (mStart &amp;gt;= 360) {&lt;br/&gt;                mStart -= 360;&lt;br/&gt;            }&lt;br/&gt;            mBigIndex = (mBigIndex + 1);&lt;br/&gt;        }&lt;br/&gt;        invalidate();&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=7e345d53-c49c-845e-aee6-b42f9d890501' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-7342764821981227542?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/7342764821981227542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/05/create-circle-in-andrind.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/7342764821981227542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/7342764821981227542'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/05/create-circle-in-andrind.html' title='Create a Circle in Andrind'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-8568576069915191730</id><published>2010-05-10T04:14:00.001-07:00</published><updated>2010-05-10T04:14:24.738-07:00</updated><title type='text'>Steps to create Andriod Widget</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;In this article will help us to create customized Widget. &lt;br/&gt;&lt;br/&gt;1. Create a Layout for Widget&lt;br/&gt;2. Create Widget Class &lt;br/&gt;3. Adding the Widget Provider Info Metadata&lt;br/&gt;4. Register the Widget in Androidmanifest.xml&lt;br/&gt;5. Add the Widget in your homepage&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Create a Layout for Widget&lt;/b&gt;&lt;/u&gt;&lt;br/&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;    android:orientation="vertical" android:layout_width="fill_parent"&lt;br/&gt;    android:layout_height="fill_parent" android:background="@drawable/widget_bg"&amp;gt;&lt;br/&gt;    &amp;lt;Button android:text="Click" android:id="@+id/Button01"&lt;br/&gt;        android:layout_width="wrap_content" android:layout_height="wrap_content"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br/&gt;&lt;br/&gt;    &amp;lt;TextView android:id="@+id/text" android:layout_width="fill_parent"&lt;br/&gt;        android:layout_height="fill_parent" android:text="@string/hello"&lt;br/&gt;        android:gravity="center" android:textColor="@android:color/black" /&amp;gt;&lt;br/&gt;&amp;lt;/LinearLayout&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Create Widget Class &lt;/b&gt;&lt;/u&gt;&lt;br/&gt;public class Widget extends AppWidgetProvider {&lt;br/&gt;    private SimpleDateFormat formatter = new SimpleDateFormat(&lt;br/&gt;            "EEE, d MMM yyyy\nHH:mm:ss.SSS");&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public void onUpdate(Context context, AppWidgetManager appWidgetManager,&lt;br/&gt;            int[] appWidgetIds) {&lt;br/&gt;        &lt;br/&gt;        String now = formatter.format(new Date());&lt;br/&gt;&lt;br/&gt;        Intent intent = new Intent(context, MainActivity.class);&lt;br/&gt;        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,intent, 0);&lt;br/&gt;&lt;br/&gt;        RemoteViews updateViews = new RemoteViews(context.getPackageName(),R.layout.main);&lt;br/&gt;        updateViews.setTextViewText(R.id.text, now);&lt;br/&gt;        appWidgetManager.updateAppWidget(appWidgetIds, updateViews);&lt;br/&gt;&lt;br/&gt;        &lt;br/&gt;        RemoteViews views = new RemoteViews(context.getPackageName(),R.layout.main);&lt;br/&gt;        views.setOnClickPendingIntent(R.id.Button01, pendingIntent);&lt;br/&gt;        appWidgetManager.updateAppWidget(appWidgetIds, views);&lt;br/&gt;&lt;br/&gt;        super.onUpdate(context, appWidgetManager, appWidgetIds);&lt;br/&gt;&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Adding the Widget Provider Info Metadata&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&gt;    &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br/&gt;    &amp;lt;appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"&lt;br/&gt;        android:minWidth="166dip" android:minHeight="72dip" android:updatePeriodMillis="60000" android:initialLayout="@layout/main" /&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Register the Widget in Androidmanifest.xml&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&gt;    &amp;lt;receiver android:label="@string/widget_name" android:name=".Widget"&amp;gt;        &lt;br/&gt;        &amp;lt;intent-filter&amp;gt;&lt;br/&gt;            &amp;lt;action android:name="android.appwidget.action.APPWIDGET_UPDATE" /&amp;gt;&lt;br/&gt;        &amp;lt;/intent-filter&amp;gt;        &lt;br/&gt;        &amp;lt;meta-data android:name="android.appwidget.provider" android:resource="@xml/widget" /&amp;gt;        &lt;br/&gt;    &amp;lt;/receiver&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Add the Widget in your homepage&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;    Click Menu -&amp;gt; Add -&amp;gt; Widget -&amp;gt; YOUR WIDGET&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=c882575e-37da-87a2-9da7-58f909eaed8f' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-8568576069915191730?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/8568576069915191730/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/05/steps-to-create-andriod-widget.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/8568576069915191730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/8568576069915191730'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/05/steps-to-create-andriod-widget.html' title='Steps to create Andriod Widget'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-2011894273158575133</id><published>2010-05-09T09:59:00.000-07:00</published><updated>2010-05-09T10:03:10.780-07:00</updated><title type='text'>Andriond Interview Question -1</title><content type='html'>&lt;span style="font-weight: bold; font-family: courier new;font-size:100%;" &gt;Brief about the Android?&lt;/span&gt;&lt;span style="font-family: courier new;font-size:100%;" &gt;&lt;br /&gt;Andriod is a Operating System for device&lt;br /&gt;It was initially developed by Android Inc., a firm later purchased by Google, and lately by the Open Handset Alliance.&lt;br /&gt;It allows developers to write managed code in the Java language, controlling the device via Google-developed Java libraries.&lt;br /&gt;&lt;br /&gt;Architecture of Android :&lt;br /&gt;1. Linux Kernal [ 2.6 Kernal - security, memory management, process management, network stack, and driver model]&lt;br /&gt;2. Native Libraries [SQLite, WEBKit, OpenGL,..]&lt;br /&gt;3. Runtime + Dalvik VM [.dex format, Lightweight VM, Efficient Dalvik Bytecode]&lt;br /&gt;4. Application Framework [Activity Manager, Content Manager, Location Manager, ]&lt;br /&gt;5. Application [ System Apps and Your Apps]&lt;br /&gt;&lt;br /&gt;Refer : http://about-android.blogspot.com/2009/11/architecture-of-android-1.html&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What are the basic Components in Android?&lt;/span&gt;&lt;br /&gt;Activities   - An activity presents a visual user interface for one focused endeavor the user can undertake.&lt;br /&gt;Services   - A service doesn't have a visual user interface, but rather runs in the background for an indefinite period of time.&lt;br /&gt;Broadcast receivers  - A broadcast receiver is a component that does nothing but receive and react to broadcast announcements.&lt;br /&gt;Content providers  - A content provider makes a specific set of the application's data available to other applications.&lt;br /&gt;&lt;br /&gt;http://about-android.blogspot.com/2009/11/application-fundamentals.html&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;what are the versions are avilable in android?&lt;/span&gt;&lt;br /&gt;Version   : 1.5 - Cupecake&lt;br /&gt;Linux Version   : 2.6.27&lt;br /&gt;Offical release On  : April 30th 2009&lt;br /&gt;Main Feature   :&lt;br /&gt;  * Ability to record and watch videos with the camcorder mode&lt;br /&gt;  * Uploading videos to YouTube and pictures to Picasa directly from the phone&lt;br /&gt;  * A new soft keyboard with an "Autocomplete" feature&lt;br /&gt;  * Bluetooth A2DP support and ability to automatically connect to a Bluetooth headset within a certain distance&lt;br /&gt;  * New widgets and folders that can populate the Home screens&lt;br /&gt;  * Animations between screens&lt;br /&gt;  * Expanded ability of Copy and paste to include web pages&lt;br /&gt;&lt;br /&gt;Version   : 1.6  - Donut&lt;br /&gt;Linux Version   : 2.6.29&lt;br /&gt;Offical release On  : April 30th 2009&lt;br /&gt;Main Features   :&lt;br /&gt;  * An improved Android Market experience.&lt;br /&gt;  * An integrated camera, camcorder, and gallery interface.&lt;br /&gt;  * Gallery now enables users to select multiple photos for deletion.&lt;br /&gt;  * Updated Voice Search, with faster response and deeper integration with native applications, including the ability to dial contacts.&lt;br /&gt;  * Updated search experience to allow searching bookmarks, history, contacts, and the web from the home screen.&lt;br /&gt;  * Updated Technology support for CDMA/EVDO, 802.1x, VPN, Gestures, and a Text-to-speech engine.&lt;br /&gt;  * Support for WVGA resolutions.&lt;br /&gt;  * Speed improvements for searching &amp;amp; the camera.[35]&lt;br /&gt;&lt;br /&gt;Version   : 2.0 &amp;amp; 2.1- Eclair&lt;br /&gt;Linux Version   : 2.6.29&lt;br /&gt;Offical release On  : October 26th 2009&lt;br /&gt;Main Features  :&lt;br /&gt;  * Optimized hardware speed&lt;br /&gt;  * Support for more screen sizes and resolutions&lt;br /&gt;  * Revamped UI&lt;br /&gt;  * New browser UI and HTML5 support&lt;br /&gt;  * New contact lists&lt;br /&gt;  * Better white/black ratio for backgrounds&lt;br /&gt;  * Improved Google Maps 3.1.2&lt;br /&gt;  * Microsoft Exchange support&lt;br /&gt;  * Built in flash support for Camera&lt;br /&gt;  * Digital Zoom&lt;br /&gt;  * MotionEvent class enhanced to track multi-touch events[41]&lt;br /&gt;  * Improved virtual keyboard&lt;br /&gt;  * Bluetooth 2.1&lt;br /&gt;  * Live Wallpapers&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;what is the folder structure of android?&lt;/span&gt;&lt;br /&gt;1. src - It contain the java code&lt;br /&gt;2. Resource - It contain the all resource with different floder&lt;br /&gt;  drawable - Icon&lt;br /&gt;  raw - Sounds&lt;br /&gt;  menu - Menu&lt;br /&gt;  values - Project Properties&lt;br /&gt;  layout - User interface Screens&lt;br /&gt;3. gen - It contains the R.java file. You could not edit R.java manually. This have been generated automatically by understanding resource files etc.&lt;br /&gt;4. AndroidManifest -It contains the Project properties&lt;br /&gt;5. Android lib.&lt;br /&gt;&lt;br /&gt;Refer :&lt;br /&gt;http://about-android.blogspot.com/2009/11/application-fundamentals.html&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;what are the api available in the Android?&lt;/span&gt;&lt;br /&gt;Activity Manager, WindowManager, Location Manager, View System, Notification Manager, Telephonic Manager, Package Manager,&lt;br /&gt;Resource Manager,&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-2011894273158575133?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/2011894273158575133/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/05/andriond-interview-question-1.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/2011894273158575133'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/2011894273158575133'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/05/andriond-interview-question-1.html' title='Andriond Interview Question -1'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-7345509246926877309</id><published>2010-05-07T05:14:00.001-07:00</published><updated>2010-05-07T05:14:35.373-07:00</updated><title type='text'>Create Dynamic View Group</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;In this Aricle help us to create a dynamic view group. &lt;br/&gt;&lt;br/&gt;public class MainActivity extends Activity {&lt;br/&gt;    Button btn, btn1;&lt;br/&gt;    LayoutInflater linflater;&lt;br/&gt;    LinearLayout l;&lt;br/&gt;    static int pos = 0;&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        setContentView(R.layout.main);&lt;br/&gt;        btn = (Button) findViewById(R.id.Button01);&lt;br/&gt;        btn1 = (Button) findViewById(R.id.Button02);&lt;br/&gt;        l = (LinearLayout) findViewById(R.id.LinearLayout01);&lt;br/&gt;        linflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);&lt;br/&gt;        btn.setOnClickListener(new myListener());&lt;br/&gt;        btn1.setOnClickListener(new myListener1());&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    class myListener implements View.OnClickListener {&lt;br/&gt;        @Override&lt;br/&gt;        public void onClick(View v) {&lt;br/&gt;            View myView = linflater.inflate(R.layout.dynamicoption, null);&lt;br/&gt;            myView.setId(pos);&lt;br/&gt;            pos++;&lt;br/&gt;            l.addView(myView);&lt;br/&gt;        }&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    class myListener1 implements View.OnClickListener {&lt;br/&gt;        @Override&lt;br/&gt;        public void onClick(View v) {&lt;br/&gt;            if (pos != 0) {&lt;br/&gt;                pos--;&lt;br/&gt;                View myView = l.findViewById(pos);&lt;br/&gt;                l.removeView(myView);&lt;br/&gt;            }&lt;br/&gt;        }&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;main.xml&lt;/b&gt;&lt;/u&gt;&lt;br/&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;    android:layout_width="fill_parent" android:layout_height="fill_parent"&lt;br/&gt;    android:orientation="horizontal"&amp;gt;&lt;br/&gt;&lt;br/&gt;    &amp;lt;Button android:id="@+id/Button01" android:background="@drawable/plus"&lt;br/&gt;        android:layout_height="45dip" android:layout_width="45dip"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br/&gt;&lt;br/&gt;    &amp;lt;Button android:id="@+id/Button02" android:background="@drawable/minus"&lt;br/&gt;        android:layout_height="45dip" android:layout_width="45dip"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br/&gt;&lt;br/&gt;    &amp;lt;LinearLayout android:id="@+id/LinearLayout01"&lt;br/&gt;        android:layout_width="wrap_content" android:layout_height="wrap_content"&lt;br/&gt;        android:orientation="vertical"&amp;gt;&amp;lt;/LinearLayout&amp;gt;&lt;br/&gt;&amp;lt;/LinearLayout&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;&lt;u&gt;dynamicoption.xml&lt;/u&gt;&lt;/b&gt;&lt;br/&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;    android:layout_width="wrap_content" android:layout_height="wrap_content"&lt;br/&gt;    android:orientation="horizontal"&amp;gt;&lt;br/&gt;    &amp;lt;EditText android:text="@+id/EditText01" android:id="@+id/EditText01"&lt;br/&gt;        android:layout_width="wrap_content" android:layout_height="wrap_content"&amp;gt;&amp;lt;/EditText&amp;gt;&lt;br/&gt;    &amp;lt;Button android:text="@+id/Button01" android:id="@+id/Button01"&lt;br/&gt;        android:layout_width="wrap_content" android:layout_height="wrap_content"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br/&gt;&amp;lt;/LinearLayout&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Icons &lt;/b&gt;&lt;br/&gt;http://jmez.net/el/images/Minus.png&lt;br/&gt;http://www.workingwithrails.com/images/plus.png?1213632569&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=24f92d2d-837c-8996-9822-e41c1106a1ba' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-7345509246926877309?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/7345509246926877309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/05/create-dynamic-view-group.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/7345509246926877309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/7345509246926877309'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/05/create-dynamic-view-group.html' title='Create Dynamic View Group'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-4228689023208766815</id><published>2010-04-19T22:21:00.001-07:00</published><updated>2010-04-19T22:21:41.635-07:00</updated><title type='text'>Create Cutomized Color Picker in android</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Code snippet for customized color picker&lt;br/&gt;&lt;br/&gt;1. Create a Customized Color picker dialog box&lt;br/&gt;2. Call the ColorPicker Dialog &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Create a Customized Color picker dialog box&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&gt;copy the below code and place into your package.&lt;br/&gt;&lt;br/&gt;public class ColorPickerDialog extends Dialog {&lt;br/&gt;&lt;br/&gt;    public interface OnColorChangedListener {&lt;br/&gt;        void colorChanged(int color);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    private final OnColorChangedListener mListener;&lt;br/&gt;    private final int mInitialColor;&lt;br/&gt;&lt;br/&gt;    private static class ColorPickerView extends View {&lt;br/&gt;        private final Paint mPaint;&lt;br/&gt;        private final Paint mCenterPaint;&lt;br/&gt;        private final int[] mColors;&lt;br/&gt;        private final OnColorChangedListener mListener;&lt;br/&gt;&lt;br/&gt;        ColorPickerView(Context c, OnColorChangedListener l, int color) {&lt;br/&gt;            super(c);&lt;br/&gt;            mListener = l;&lt;br/&gt;            mColors = new int[] { 0xFFFF0000, 0xFFFF00FF, 0xFF0000FF,&lt;br/&gt;                    0xFF00FFFF, 0xFF00FF00, 0xFFFFFF00, 0xFFFF0000 };&lt;br/&gt;            Shader s = new SweepGradient(0, 0, mColors, null);&lt;br/&gt;&lt;br/&gt;            mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);&lt;br/&gt;            mPaint.setShader(s);&lt;br/&gt;            mPaint.setStyle(Paint.Style.STROKE);&lt;br/&gt;            mPaint.setStrokeWidth(32);&lt;br/&gt;&lt;br/&gt;            mCenterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);&lt;br/&gt;            mCenterPaint.setColor(color);&lt;br/&gt;            mCenterPaint.setStrokeWidth(5);&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        private boolean mTrackingCenter;&lt;br/&gt;        private boolean mHighlightCenter;&lt;br/&gt;&lt;br/&gt;        @Override&lt;br/&gt;        protected void onDraw(Canvas canvas) {&lt;br/&gt;            float r = CENTER_X - mPaint.getStrokeWidth() * 0.5f;&lt;br/&gt;&lt;br/&gt;            canvas.translate(CENTER_X, CENTER_X);&lt;br/&gt;&lt;br/&gt;            canvas.drawOval(new RectF(-r, -r, r, r), mPaint);&lt;br/&gt;            canvas.drawCircle(0, 0, CENTER_RADIUS, mCenterPaint);&lt;br/&gt;&lt;br/&gt;            if (mTrackingCenter) {&lt;br/&gt;                int c = mCenterPaint.getColor();&lt;br/&gt;                mCenterPaint.setStyle(Paint.Style.STROKE);&lt;br/&gt;&lt;br/&gt;                if (mHighlightCenter) {&lt;br/&gt;                    mCenterPaint.setAlpha(0xFF);&lt;br/&gt;                } else {&lt;br/&gt;                    mCenterPaint.setAlpha(0x80);&lt;br/&gt;                }&lt;br/&gt;                canvas.drawCircle(0, 0, CENTER_RADIUS&lt;br/&gt;                        + mCenterPaint.getStrokeWidth(), mCenterPaint);&lt;br/&gt;&lt;br/&gt;                mCenterPaint.setStyle(Paint.Style.FILL);&lt;br/&gt;                mCenterPaint.setColor(c);&lt;br/&gt;            }&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        @Override&lt;br/&gt;        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {&lt;br/&gt;            setMeasuredDimension(CENTER_X * 2, CENTER_Y * 2);&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        private static final int CENTER_X = 100;&lt;br/&gt;        private static final int CENTER_Y = 100;&lt;br/&gt;        private static final int CENTER_RADIUS = 32;&lt;br/&gt;&lt;br/&gt;        private int floatToByte(float x) {&lt;br/&gt;            int n = java.lang.Math.round(x);&lt;br/&gt;            return n;&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        private int pinToByte(int n) {&lt;br/&gt;            if (n &amp;lt; 0) {&lt;br/&gt;                n = 0;&lt;br/&gt;            } else if (n &amp;gt; 255) {&lt;br/&gt;                n = 255;&lt;br/&gt;            }&lt;br/&gt;            return n;&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        private int ave(int s, int d, float p) {&lt;br/&gt;            return s + java.lang.Math.round(p * (d - s));&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        private int interpColor(int colors[], float unit) {&lt;br/&gt;            if (unit &amp;lt;= 0)&lt;br/&gt;                return colors[0];&lt;br/&gt;            if (unit &amp;gt;= 1)&lt;br/&gt;                return colors[colors.length - 1];&lt;br/&gt;&lt;br/&gt;            float p = unit * (colors.length - 1);&lt;br/&gt;            int i = (int) p;&lt;br/&gt;            p -= i;&lt;br/&gt;&lt;br/&gt;            // now p is just the fractional part [0...1) and i is the index&lt;br/&gt;            int c0 = colors[i];&lt;br/&gt;            int c1 = colors[i + 1];&lt;br/&gt;            int a = ave(Color.alpha(c0), Color.alpha(c1), p);&lt;br/&gt;            int r = ave(Color.red(c0), Color.red(c1), p);&lt;br/&gt;            int g = ave(Color.green(c0), Color.green(c1), p);&lt;br/&gt;            int b = ave(Color.blue(c0), Color.blue(c1), p);&lt;br/&gt;&lt;br/&gt;            return Color.argb(a, r, g, b);&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        private int rotateColor(int color, float rad) {&lt;br/&gt;            float deg = rad * 180 / 3.1415927f;&lt;br/&gt;            int r = Color.red(color);&lt;br/&gt;            int g = Color.green(color);&lt;br/&gt;            int b = Color.blue(color);&lt;br/&gt;&lt;br/&gt;            ColorMatrix cm = new ColorMatrix();&lt;br/&gt;            ColorMatrix tmp = new ColorMatrix();&lt;br/&gt;&lt;br/&gt;            cm.setRGB2YUV();&lt;br/&gt;            tmp.setRotate(0, deg);&lt;br/&gt;            cm.postConcat(tmp);&lt;br/&gt;            tmp.setYUV2RGB();&lt;br/&gt;            cm.postConcat(tmp);&lt;br/&gt;&lt;br/&gt;            final float[] a = cm.getArray();&lt;br/&gt;&lt;br/&gt;            int ir = floatToByte(a[0] * r + a[1] * g + a[2] * b);&lt;br/&gt;            int ig = floatToByte(a[5] * r + a[6] * g + a[7] * b);&lt;br/&gt;            int ib = floatToByte(a[10] * r + a[11] * g + a[12] * b);&lt;br/&gt;&lt;br/&gt;            return Color.argb(Color.alpha(color), pinToByte(ir), pinToByte(ig),&lt;br/&gt;                    pinToByte(ib));&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        private static final float PI = 3.1415926f;&lt;br/&gt;&lt;br/&gt;        @Override&lt;br/&gt;        public boolean onTouchEvent(MotionEvent event) {&lt;br/&gt;            float x = event.getX() - CENTER_X;&lt;br/&gt;            float y = event.getY() - CENTER_Y;&lt;br/&gt;            boolean inCenter = java.lang.Math.sqrt(x * x + y * y) &amp;lt;= CENTER_RADIUS;&lt;br/&gt;&lt;br/&gt;            switch (event.getAction()) {&lt;br/&gt;            case MotionEvent.ACTION_DOWN:&lt;br/&gt;                mTrackingCenter = inCenter;&lt;br/&gt;                if (inCenter) {&lt;br/&gt;                    mHighlightCenter = true;&lt;br/&gt;                    invalidate();&lt;br/&gt;                    break;&lt;br/&gt;                }&lt;br/&gt;            case MotionEvent.ACTION_MOVE:&lt;br/&gt;                if (mTrackingCenter) {&lt;br/&gt;                    if (mHighlightCenter != inCenter) {&lt;br/&gt;                        mHighlightCenter = inCenter;&lt;br/&gt;                        invalidate();&lt;br/&gt;                    }&lt;br/&gt;                } else {&lt;br/&gt;                    float angle = (float) java.lang.Math.atan2(y, x);&lt;br/&gt;                    // need to turn angle [-PI ... PI] into unit [0....1]&lt;br/&gt;                    float unit = angle / (2 * PI);&lt;br/&gt;                    if (unit &amp;lt; 0) {&lt;br/&gt;                        unit += 1;&lt;br/&gt;                    }&lt;br/&gt;                    mCenterPaint.setColor(interpColor(mColors, unit));&lt;br/&gt;                    invalidate();&lt;br/&gt;                }&lt;br/&gt;                break;&lt;br/&gt;            case MotionEvent.ACTION_UP:&lt;br/&gt;                if (mTrackingCenter) {&lt;br/&gt;                    if (inCenter) {&lt;br/&gt;                        mListener.colorChanged(mCenterPaint.getColor());&lt;br/&gt;                    }&lt;br/&gt;                    mTrackingCenter = false; // so we draw w/o halo&lt;br/&gt;                    invalidate();&lt;br/&gt;                }&lt;br/&gt;                break;&lt;br/&gt;            }&lt;br/&gt;            return true;&lt;br/&gt;        }&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public ColorPickerDialog(Context context, OnColorChangedListener listener,&lt;br/&gt;            int initialColor) {&lt;br/&gt;        super(context);&lt;br/&gt;&lt;br/&gt;        mListener = listener;&lt;br/&gt;        mInitialColor = initialColor;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    protected void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        OnColorChangedListener l = new OnColorChangedListener() {&lt;br/&gt;            public void colorChanged(int color) {&lt;br/&gt;                mListener.colorChanged(color);&lt;br/&gt;                dismiss();&lt;br/&gt;            }&lt;br/&gt;        };&lt;br/&gt;&lt;br/&gt;        LinearLayout layout = new LinearLayout(getContext());&lt;br/&gt;        layout.setOrientation(LinearLayout.VERTICAL);&lt;br/&gt;        layout.setGravity(Gravity.CENTER);&lt;br/&gt;        layout.setPadding(10, 10, 10, 10);&lt;br/&gt;        layout.addView(new ColorPickerView(getContext(), l, mInitialColor),&lt;br/&gt;                new LinearLayout.LayoutParams(&lt;br/&gt;                        LinearLayout.LayoutParams.WRAP_CONTENT,&lt;br/&gt;                        LinearLayout.LayoutParams.WRAP_CONTENT));&lt;br/&gt;&lt;br/&gt;        setContentView(layout);&lt;br/&gt;        setTitle("Pick a Color");&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;&lt;br/&gt;Call the ColorPicker Dialog &lt;/b&gt;&lt;/u&gt;&lt;br/&gt;public class MainActivity extends Activity implements&lt;br/&gt;        ColorPickerDialog.OnColorChangedListener {&lt;br/&gt;    /** Called when the activity is first created. */&lt;br/&gt;    private static final String BRIGHTNESS_PREFERENCE_KEY = "brightness";&lt;br/&gt;    private static final String COLOR_PREFERENCE_KEY = "color";&lt;br/&gt;    TextView tv;&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        setContentView(R.layout.main);&lt;br/&gt;        tv = (TextView) findViewById(R.id.TextView01);&lt;br/&gt;&lt;br/&gt;        Button btn = (Button) findViewById(R.id.Button01);&lt;br/&gt;        btn.setOnClickListener(new View.OnClickListener() {&lt;br/&gt;            @Override&lt;br/&gt;            public void onClick(View v) {&lt;br/&gt;                int color = PreferenceManager.getDefaultSharedPreferences(&lt;br/&gt;                        MainActivity.this).getInt(COLOR_PREFERENCE_KEY,&lt;br/&gt;                        Color.WHITE);&lt;br/&gt;                new ColorPickerDialog(MainActivity.this, MainActivity.this,&lt;br/&gt;                        color).show();&lt;br/&gt;            }&lt;br/&gt;        });&lt;br/&gt;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public void colorChanged(int color) {&lt;br/&gt;        PreferenceManager.getDefaultSharedPreferences(this).edit().putInt(&lt;br/&gt;                COLOR_PREFERENCE_KEY, color).commit();&lt;br/&gt;        tv.setTextColor(color);&lt;br/&gt;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;main layout &lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&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;    android:orientation="vertical" android:layout_width="fill_parent"&lt;br/&gt;    android:layout_height="fill_parent" android:id="@+id/mainview"&amp;gt;&lt;br/&gt;    &amp;lt;Button android:text="Select Color" android:id="@+id/Button01"&lt;br/&gt;        android:layout_width="wrap_content" android:layout_height="wrap_content"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br/&gt;    &amp;lt;TextView android:text="@+id/TextView01" android:id="@+id/TextView01"&lt;br/&gt;        android:layout_width="wrap_content" android:layout_height="wrap_content"&amp;gt;&amp;lt;/TextView&amp;gt;&lt;br/&gt;&amp;lt;/LinearLayout&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=f80aa49c-cc2b-8fae-adc9-c333157e4742' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-4228689023208766815?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/4228689023208766815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/04/create-cutomized-color-picker-in.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/4228689023208766815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/4228689023208766815'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/04/create-cutomized-color-picker-in.html' title='Create Cutomized Color Picker in android'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-4424447538206671455</id><published>2010-04-19T21:42:00.001-07:00</published><updated>2010-04-19T21:42:26.168-07:00</updated><title type='text'>Sample Apps to Control Screen Brightness</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;This will help us to create a brightness controller in andriod.&lt;br/&gt;&lt;br/&gt;1. Create a Layout with seekbar&lt;br/&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;    android:orientation="vertical" android:layout_width="fill_parent"&lt;br/&gt;    android:layout_height="fill_parent"&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;    &amp;lt;Button android:text="Show Brightness Panel" android:id="@+id/Button01"&lt;br/&gt;        android:layout_width="wrap_content" android:layout_height="wrap_content"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;    &amp;lt;LinearLayout android:id="@+id/panel" android:orientation="vertical"&lt;br/&gt;        android:layout_width="fill_parent" android:layout_height="wrap_content"&lt;br/&gt;        android:layout_alignParentBottom="true" android:paddingTop="10dip"&lt;br/&gt;        android:paddingBottom="30dip" android:paddingLeft="20dip"&lt;br/&gt;        android:paddingRight="20dip" android:gravity="center_horizontal"&lt;br/&gt;        android:visibility="gone"&amp;gt;&lt;br/&gt;&lt;br/&gt;        &amp;lt;TextView android:text="Brightness Level"&lt;br/&gt;            android:layout_width="fill_parent" android:layout_height="wrap_content"&lt;br/&gt;            android:gravity="center" android:textAppearance="?android:attr/textAppearanceLarge" /&amp;gt;&lt;br/&gt;&lt;br/&gt;        &amp;lt;SeekBar android:id="@+id/seek" android:layout_width="fill_parent"&lt;br/&gt;            android:layout_height="wrap_content" android:max="100"&lt;br/&gt;            android:progress="100" /&amp;gt;&lt;br/&gt;&lt;br/&gt;    &amp;lt;/LinearLayout&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;/LinearLayout&amp;gt;&lt;br/&gt;&lt;br/&gt;2. Create an activity to control the brightness&lt;br/&gt;public class MainActivity extends Activity {&lt;br/&gt;    /** Called when the activity is first created. */&lt;br/&gt;    private static final String BRIGHTNESS_PREFERENCE_KEY = "brightness";&lt;br/&gt;    private View brightnessPanel;&lt;br/&gt;    private SeekBar brightnessControl;&lt;br/&gt;    private int brightness = 50;&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        setContentView(R.layout.main);&lt;br/&gt;        brightnessPanel = findViewById(R.id.panel);&lt;br/&gt;        brightnessControl = (SeekBar) findViewById(R.id.seek);&lt;br/&gt;&lt;br/&gt;        Button btn = (Button) findViewById(R.id.Button01);&lt;br/&gt;        btn.setOnClickListener(new View.OnClickListener() {&lt;br/&gt;            @Override&lt;br/&gt;            public void onClick(View v) {&lt;br/&gt;                showBrightnessPanel();&lt;br/&gt;&lt;br/&gt;            }&lt;br/&gt;        });&lt;br/&gt;&lt;br/&gt;        brightnessControl&lt;br/&gt;                .setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {&lt;br/&gt;                    public void onProgressChanged(SeekBar seekBar,&lt;br/&gt;                            int progress, boolean fromUser) {&lt;br/&gt;                        setBrightness(progress);&lt;br/&gt;                    }&lt;br/&gt;&lt;br/&gt;                    public void onStartTrackingTouch(SeekBar seekBar) {&lt;br/&gt;                    }&lt;br/&gt;&lt;br/&gt;                    public void onStopTrackingTouch(SeekBar seekBar) {&lt;br/&gt;                        hideBrightnessPanel();&lt;br/&gt;                    }&lt;br/&gt;                });&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    private void showBrightnessPanel() {&lt;br/&gt;        Animation animation = AnimationUtils.loadAnimation(this,&lt;br/&gt;                android.R.anim.slide_in_left);&lt;br/&gt;        brightnessControl.setProgress(this.brightness);&lt;br/&gt;        brightnessPanel.setVisibility(View.VISIBLE);&lt;br/&gt;        brightnessPanel.startAnimation(animation);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    private void setBrightness(int value) {&lt;br/&gt;        if (value &amp;lt; 10) {&lt;br/&gt;            value = 10;&lt;br/&gt;        } else if (value &amp;gt; 100) {&lt;br/&gt;            value = 100;&lt;br/&gt;        }&lt;br/&gt;        brightness = value;&lt;br/&gt;        WindowManager.LayoutParams lp = getWindow().getAttributes();&lt;br/&gt;        lp.screenBrightness = (float) value / 100;        &lt;br/&gt;        lp.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;&lt;br/&gt;        getWindow().setAttributes(lp);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    private void hideBrightnessPanel() {&lt;br/&gt;        Animation animation = AnimationUtils.loadAnimation(MainActivity.this,&lt;br/&gt;                android.R.anim.slide_out_right);&lt;br/&gt;        brightnessPanel.startAnimation(animation);&lt;br/&gt;        brightnessPanel.setVisibility(View.GONE);&lt;br/&gt;        PreferenceManager.getDefaultSharedPreferences(this).edit().putInt(&lt;br/&gt;                BRIGHTNESS_PREFERENCE_KEY, brightnessControl.getProgress())&lt;br/&gt;                .commit();&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;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=484c147e-b83f-8661-9d25-6f00cd9ebb07' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-4424447538206671455?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/4424447538206671455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/04/sample-apps-to-control-screen.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/4424447538206671455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/4424447538206671455'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/04/sample-apps-to-control-screen.html' title='Sample Apps to Control Screen Brightness'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-3305966577017294957</id><published>2010-04-19T06:33:00.001-07:00</published><updated>2010-04-19T06:33:34.449-07:00</updated><title type='text'>Create a Apps to Show Digital Time in Android</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;this blog helps to create a simple digital clock in andriod. &lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Create a Layout.xml &lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br/&gt;&amp;lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"&lt;br/&gt;    android:orientation="vertical" android:layout_width="fill_parent"&lt;br/&gt;    android:layout_height="fill_parent"&amp;gt;&lt;br/&gt;&lt;br/&gt;    &amp;lt;TextView android:id="@+id/countdown" android:layout_width="320dip"&lt;br/&gt;        android:layout_height="120dip" android:text="00:00:00" &lt;br/&gt;        android:textSize="15pt" android:textColor="#00C2FF"&lt;br/&gt;        android:layout_centerInParent="true" /&amp;gt;&lt;br/&gt;&amp;lt;/RelativeLayout&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;Create Activty Class for show the Time&lt;br/&gt;&lt;br/&gt;public class MainActivity extends Activity {&lt;br/&gt;    private TextView countdown;&lt;br/&gt;    private Timer timer;&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        setContentView(R.layout.main);&lt;br/&gt;        TextView countdown = (TextView) findViewById(R.id.countdown);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    protected void onStart() {&lt;br/&gt;        super.onStart();&lt;br/&gt;        timer = new Timer("DigitalClock");&lt;br/&gt;        Calendar calendar = Calendar.getInstance();&lt;br/&gt;&lt;br/&gt;        // Get the Current Time&lt;br/&gt;        final Runnable updateTask = new Runnable() {&lt;br/&gt;            public void run() {&lt;br/&gt;                countdown.setText(getCurrentTimeString()); // shows the current time of the day&lt;br/&gt;//                countdown.setText(getReminingTime()); // shows the remaining time of the day&lt;br/&gt;            }&lt;br/&gt;        };&lt;br/&gt;&lt;br/&gt;        // update the UI&lt;br/&gt;        int msec = 999 - calendar.get(Calendar.MILLISECOND);&lt;br/&gt;        timer.scheduleAtFixedRate(new TimerTask() {&lt;br/&gt;            @Override&lt;br/&gt;            public void run() {&lt;br/&gt;                runOnUiThread(updateTask);&lt;br/&gt;            }&lt;br/&gt;        }, msec, 1000);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    protected void onStop() {&lt;br/&gt;        super.onStop();&lt;br/&gt;        timer.cancel();&lt;br/&gt;        timer.purge();&lt;br/&gt;        timer = null;&lt;br/&gt;    }&lt;br/&gt;   private String getReminingTime() {&lt;br/&gt;        Calendar calendar = Calendar.getInstance();&lt;br/&gt;        int hour = 23 - calendar.get(Calendar.HOUR_OF_DAY);&lt;br/&gt;        int minute = 59 - calendar.get(Calendar.MINUTE);&lt;br/&gt;        int second = 59 - calendar.get(Calendar.SECOND);&lt;br/&gt;        return String.format("%02d:%02d:%02d", hour, minute, second);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;    private String getCurrentTimeString() {&lt;br/&gt;        Calendar calendar = Calendar.getInstance();&lt;br/&gt;        int hour = calendar.get(Calendar.HOUR_OF_DAY);&lt;br/&gt;        int minute = calendar.get(Calendar.MINUTE);&lt;br/&gt;        int second = calendar.get(Calendar.SECOND);&lt;br/&gt;        return String.format("%02d:%02d:%02d %02d", hour, minute, second);&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=c48b67f2-f0e5-8fb3-a934-34a2fddeb90f' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-3305966577017294957?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/3305966577017294957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/04/create-apps-to-show-digital-time-in_19.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/3305966577017294957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/3305966577017294957'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/04/create-apps-to-show-digital-time-in_19.html' title='Create a Apps to Show Digital Time in Android'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-5309886776004442658</id><published>2010-04-19T03:13:00.001-07:00</published><updated>2010-04-19T03:13:21.347-07:00</updated><title type='text'>Creating dynamic Customized List view.</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;This article shows to create a dynamic custom view as a list. i have created a custom adapter and explore to create a custom listview. &lt;br/&gt;As a result i have created the below method. In this blog will help you to create a customized list view. &lt;br/&gt;&lt;br/&gt;Create two layout&lt;br/&gt;    1. main layout &lt;br/&gt;    2. custom view layout. &lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;MainLayout - which is used to define the scroll view. &lt;/b&gt;&lt;/u&gt;&lt;br/&gt;    &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br/&gt;    &amp;lt;ScrollView android:id="@+id/ScrollView01"&lt;br/&gt;        xmlns:android="http://schemas.android.com/apk/res/android"&lt;br/&gt;        android:layout_height="fill_parent" android:layout_width="fill_parent"&amp;gt;&lt;br/&gt;        &amp;lt;LinearLayout android:orientation="vertical"&lt;br/&gt;            android:layout_width="fill_parent" android:id="@+id/mylayout1"&lt;br/&gt;            android:layout_height="wrap_content"&amp;gt;&lt;br/&gt;        &amp;lt;/LinearLayout&amp;gt;&lt;br/&gt;    &amp;lt;/ScrollView&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Custom Layout - Which Consists of actual design. &lt;/b&gt;&lt;/u&gt;&lt;br/&gt;    &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br/&gt;    &amp;lt;LinearLayout android:orientation="vertical"&lt;br/&gt;        android:layout_width="fill_parent" android:layout_height="wrap_content"&lt;br/&gt;        xmlns:android="http://schemas.android.com/apk/res/android"&amp;gt;&lt;br/&gt;        &amp;lt;TextView android:text="@+id/TextView01" android:id="@+id/TextView01"&lt;br/&gt;            android:layout_width="wrap_content" android:layout_height="wrap_content"&amp;gt;&amp;lt;/TextView&amp;gt;&lt;br/&gt;        &amp;lt;Button android:text="@+id/Button01" android:id="@+id/Button01"&lt;br/&gt;            android:layout_width="wrap_content" android:layout_height="wrap_content"&amp;gt;&amp;lt;/Button&amp;gt;&lt;br/&gt;    &amp;lt;/LinearLayout&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Create a Activity Class &lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&gt;public class DynamicListActivity extends Activity {&lt;br/&gt;    /**&lt;br/&gt;     * @see android.app.Activity#onCreate(Bundle)&lt;br/&gt;     */&lt;br/&gt;    @Override&lt;br/&gt;    protected void onCreate(Bundle savedInstanceState) {&lt;br/&gt;    super.onCreate(savedInstanceState);&lt;br/&gt;    setContentView(R.layout.listviewmain);&lt;br/&gt;    LinearLayout l = (LinearLayout) findViewById(R.id.mylayout1);&lt;br/&gt;    LayoutInflater linflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);&lt;br/&gt;    for (int i = 0; i &amp;lt; 5; i++) {&lt;br/&gt;        View customView = linflater.inflate(R.layout.customlistviewitem,&lt;br/&gt;            null);&lt;br/&gt;        TextView tv = (TextView) customView.findViewById(R.id.TextView01);&lt;br/&gt;        Button btn = (Button) customView.findViewById(R.id.Button01);&lt;br/&gt;        tv.setId(i);&lt;br/&gt;        btn.setId(i);&lt;br/&gt;        tv.setText("Location:" + i);&lt;br/&gt;        btn.setOnClickListener(new View.OnClickListener() {&lt;br/&gt;        @Override&lt;br/&gt;        public void onClick(View v) {&lt;br/&gt;            Toast.makeText(DynamicListActivity.this, v.getId() + "",&lt;br/&gt;                Toast.LENGTH_LONG).show();&lt;br/&gt;        }&lt;br/&gt;        });&lt;br/&gt;        l.addView(customView);&lt;br/&gt;    }&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=d499672e-7a4e-8ca6-ae61-5fc03a18c10d' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-5309886776004442658?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/5309886776004442658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/04/creating-dynamic-customized-list-view.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5309886776004442658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5309886776004442658'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/04/creating-dynamic-customized-list-view.html' title='Creating dynamic Customized List view.'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-785084302736211449</id><published>2010-04-19T02:00:00.001-07:00</published><updated>2010-04-19T06:22:37.218-07:00</updated><title type='text'>UtilMethod For Android - I</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;I have collected some Utility method from my code. &lt;br/&gt;&lt;br/&gt;&lt;b&gt;/** Return a specific file contents as a String value. */&lt;/b&gt;&lt;br/&gt;public static String getFileString(File file) throws Exception {&lt;br/&gt;    String result = null;&lt;br/&gt;    InputStream is = null;&lt;br/&gt;    ByteArrayOutputStream os = new ByteArrayOutputStream();&lt;br/&gt;    try {&lt;br/&gt;        is = new FileInputStream(file);&lt;br/&gt;        int bytesRead;&lt;br/&gt;        byte[] buffer = new byte[1024];&lt;br/&gt;        while ((bytesRead = is.read(buffer)) != -1) {&lt;br/&gt;            os.write(buffer, 0, bytesRead);&lt;br/&gt;        }&lt;br/&gt;        os.flush();&lt;br/&gt;        result = new String(os.toByteArray());&lt;br/&gt;    } catch(Exception e) {&lt;br/&gt;        throw new Exception("Problem while reading file", e);&lt;br/&gt;    } finally {&lt;br/&gt;        try {&lt;br/&gt;            os.close();&lt;br/&gt;            is.close();&lt;br/&gt;        } catch(Exception e) {&lt;br/&gt;        }&lt;br/&gt;    }&lt;br/&gt;    return result;&lt;br/&gt;}&lt;br/&gt;&lt;b&gt;&lt;br/&gt;/** Return a specific url contents as a String value. */&lt;/b&gt;&lt;br/&gt;public static String getUrlString(String remoteUrl) throws Exception {&lt;br/&gt;    String result = null;&lt;br/&gt;    InputStream is = null;&lt;br/&gt;    ByteArrayOutputStream os = new ByteArrayOutputStream();&lt;br/&gt;    try {&lt;br/&gt;        URL url = new URL(remoteUrl);&lt;br/&gt;        URLConnection connection = url.openConnection();&lt;br/&gt;        connection.setConnectTimeout(5000);&lt;br/&gt;        connection.setReadTimeout(5000);&lt;br/&gt;        connection.connect();&lt;br/&gt;        is = connection.getInputStream();&lt;br/&gt;        int bytesRead;&lt;br/&gt;        byte[] buffer = new byte[1024];&lt;br/&gt;        while ((bytesRead = is.read(buffer)) != -1) {&lt;br/&gt;            os.write(buffer, 0, bytesRead);&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        os.flush();&lt;br/&gt;        result = new String(os.toByteArray());&lt;br/&gt;    } catch(Exception e) {&lt;br/&gt;        throw new Exception("Problem while reading targeted url", e);&lt;br/&gt;    } finally {&lt;br/&gt;        try {&lt;br/&gt;            os.close();&lt;br/&gt;            is.close();&lt;br/&gt;        } catch(Exception e) {&lt;br/&gt;        }&lt;br/&gt;    }&lt;br/&gt;    return result;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;b&gt;/** Create Thumbnail Image &lt;br/&gt;* Param1 : Image, &lt;br/&gt;* Param2 : Required Size */&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;public static Drawable createIconThumbnail(Drawable icon, int size) {&lt;br/&gt;    int sourceWidth = icon.getIntrinsicWidth(),&lt;br/&gt;    sourceHeight = icon.getIntrinsicHeight();&lt;br/&gt;    &lt;br/&gt;    int destWidth = size, destHeight = size;&lt;br/&gt;    &lt;br/&gt;    // only resize if actually needed&lt;br/&gt;    if(sourceWidth != destWidth || sourceHeight != destHeight) {&lt;br/&gt;        float ratio = (float) sourceWidth / sourceHeight;&lt;br/&gt;        if(sourceWidth &amp;gt; sourceHeight) {&lt;br/&gt;            destHeight = (int) (destWidth / ratio);&lt;br/&gt;        } else if (sourceHeight &amp;gt; sourceWidth) {&lt;br/&gt;            destWidth = (int) (destHeight * ratio);&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        final Bitmap thumb = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);&lt;br/&gt;        final Canvas canvas = new Canvas(thumb);&lt;br/&gt;&lt;br/&gt;        icon.setBounds((size - destWidth) / 2, (size - destHeight) / 2, destWidth, destHeight);&lt;br/&gt;        icon.draw(canvas);&lt;br/&gt;        icon = new BitmapDrawable(thumb);&lt;br/&gt;    }&lt;br/&gt;    return icon;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;b&gt;/** Return a current time a String value. */&lt;/b&gt;&lt;br/&gt; private String getCurrentTimeString() {&lt;br/&gt;        Calendar calendar = Calendar.getInstance();&lt;br/&gt;        int hour = calendar.get(Calendar.HOUR_OF_DAY);&lt;br/&gt;        int minute = calendar.get(Calendar.MINUTE);&lt;br/&gt;        int second = calendar.get(Calendar.SECOND);&lt;br/&gt;        return String.format("%02d:%02d:%02d ", hour, minute, second);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=437f501c-a06a-8570-9cfb-6e525a27afa2' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-785084302736211449?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/785084302736211449/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/04/utilmethod-for-android-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/785084302736211449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/785084302736211449'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/04/utilmethod-for-android-i.html' title='UtilMethod For Android - I'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-8481633483041341787</id><published>2010-04-18T18:27:00.000-07:00</published><updated>2010-04-19T06:27:38.115-07:00</updated><title type='text'>Create a Apps to Show Digital Time in Android</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;this blog helps to create a simple digital clock in andriod. &lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Create a Layout.xml &lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br/&gt;&amp;lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"&lt;br/&gt;    android:orientation="vertical" android:layout_width="fill_parent"&lt;br/&gt;    android:layout_height="fill_parent"&amp;gt;&lt;br/&gt;&lt;br/&gt;    &amp;lt;TextView android:id="@+id/countdown" android:layout_width="320dip"&lt;br/&gt;        android:layout_height="120dip" android:text="00:00:00" &lt;br/&gt;        android:textSize="15pt" android:textColor="#00C2FF"&lt;br/&gt;        android:layout_centerInParent="true" /&amp;gt;&lt;br/&gt;&amp;lt;/RelativeLayout&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Create Activty Class for show the Time&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&gt;public class MainActivity extends Activity {&lt;br/&gt;    private TextView countdown;&lt;br/&gt;    private Timer timer;&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        setContentView(R.layout.main);&lt;br/&gt;        TextView countdown = (TextView) findViewById(R.id.countdown);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    protected void onStart() {&lt;br/&gt;        super.onStart();&lt;br/&gt;        timer = new Timer("DigitalClock");&lt;br/&gt;        Calendar calendar = Calendar.getInstance();&lt;br/&gt;&lt;br/&gt;        // Get the Current Time&lt;br/&gt;        final Runnable updateTask = new Runnable() {&lt;br/&gt;            public void run() {&lt;br/&gt;                countdown.setText(getCurrentTimeString());&lt;br/&gt;            }&lt;br/&gt;        };&lt;br/&gt;&lt;br/&gt;        // update the UI&lt;br/&gt;        int msec = 999 - calendar.get(Calendar.MILLISECOND);&lt;br/&gt;        timer.scheduleAtFixedRate(new TimerTask() {&lt;br/&gt;            @Override&lt;br/&gt;            public void run() {&lt;br/&gt;                runOnUiThread(updateTask);&lt;br/&gt;            }&lt;br/&gt;        }, msec, 1000);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    protected void onStop() {&lt;br/&gt;        super.onStop();&lt;br/&gt;        timer.cancel();&lt;br/&gt;        timer.purge();&lt;br/&gt;        timer = null;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    private String getCurrentTimeString() {&lt;br/&gt;        Calendar calendar = Calendar.getInstance();&lt;br/&gt;        int hour = calendar.get(Calendar.HOUR_OF_DAY);&lt;br/&gt;        int minute = calendar.get(Calendar.MINUTE);&lt;br/&gt;        int second = calendar.get(Calendar.SECOND);&lt;br/&gt;        return String.format("%02d:%02d:%02d %02d", hour, minute, second);&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=d4270439-a098-84c9-9bac-180cf0f9fa32' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-8481633483041341787?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/8481633483041341787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/04/create-apps-to-show-digital-time-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/8481633483041341787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/8481633483041341787'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/04/create-apps-to-show-digital-time-in.html' title='Create a Apps to Show Digital Time in Android'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-115880702720811276</id><published>2010-04-16T05:16:00.001-07:00</published><updated>2010-04-16T05:16:37.438-07:00</updated><title type='text'>UI component Snippets</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;In this article having the set of android sinppets used to set the value and listener action. &lt;br/&gt;&lt;br/&gt;&lt;big&gt;&lt;font color='#003300'&gt;&lt;u&gt;&lt;b&gt;Spinner Control&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/big&gt;&lt;br/&gt;&lt;br/&gt;    &lt;font face='Courier New'&gt;&lt;b&gt;&lt;font color='#330000'&gt;  &lt;/font&gt;&lt;/b&gt;&lt;font color='#330000'&gt;String selectedState  ="";&lt;br/&gt;    String[] stateList = new String[] { "Select State", "MA", "NY" }; // Dropdown values&lt;br/&gt;    Spinner sprState = (Spinner) findViewById(R.id.sprstate);&lt;/font&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;i&gt;    &lt;b&gt;// Set the value using the ArrayAdapter&lt;/b&gt;&lt;/i&gt;&lt;br/&gt;   &lt;font face='Courier New' color='#330000'&gt; ArrayAdapter&amp;lt;String&amp;gt; stateListAdapter = new ArrayAdapter&amp;lt;String&amp;gt;(this,android.R.layout.simple_spinner_item,stateList);&lt;br/&gt;    stateListAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);&lt;br/&gt;    stateListAdapter.setAdapter(stateList);&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;   &lt;i&gt;&lt;b&gt; // Listener&lt;/b&gt;&lt;/i&gt;&lt;br/&gt;&lt;i&gt;   &lt;font face='Courier New' color='#330000'&gt; sprState.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {&lt;br/&gt;        @Override&lt;br/&gt;        public void onItemSelected(AdapterView&amp;lt;?&amp;gt; parent,View view, int position, long id) {&lt;br/&gt;        selectedState = String.valueOf(sprState.getSelectedItem());&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        @Override&lt;br/&gt;        public void onNothingSelected(AdapterView&amp;lt;?&amp;gt; parent) {&lt;br/&gt;        }&lt;br/&gt;    });&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;big&gt;&lt;b&gt;&lt;font color='#003300'&gt;ListView Control&lt;/font&gt;&lt;/b&gt;&lt;/big&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&gt;  &lt;font color='#330000'&gt; &lt;font face='Courier New'&gt; ArrayList&amp;lt;String&amp;gt; tempListViewData = new ArrayList&amp;lt;String&amp;gt;();&lt;br/&gt;   tempListViewData.add("One");&lt;br/&gt;   tempListViewData.add("two");&lt;br/&gt;&lt;br/&gt;   ListView l = (ListView) findViewById(R.id.ListView01);&lt;br/&gt;&lt;br/&gt;    ArrayAdapter&amp;lt;String&amp;gt; adapter = new ArrayAdapter&amp;lt;String&amp;gt;(this,android.R.layout.simple_dropdown_item_1line, tempListViewData);&lt;br/&gt;    l.setAdapter(adapter);&lt;br/&gt;&lt;br/&gt;    l.setOnItemClickListener(new OnItemClickListener() {&lt;br/&gt;        @Override&lt;br/&gt;        public void onItemClick(AdapterView&amp;lt;?&amp;gt; arg0, View arg1, int arg2,&lt;br/&gt;            long arg3) {&lt;br/&gt;        Log.d("Position", arg2 + "");        &lt;br/&gt;        }&lt;br/&gt;    });&lt;/font&gt;&lt;br/&gt;&lt;/font&gt;&lt;br/&gt;&lt;u&gt;&lt;big&gt;&lt;b&gt;&lt;font color='#003300'&gt;Button &lt;/font&gt;&lt;/b&gt;&lt;/big&gt;&lt;/u&gt;&lt;br/&gt;&lt;font face='Courier New' color='#330000'&gt;Button btnFindStore = (Button) findViewById(R.id.btnhomego);&lt;br/&gt;    private class FindStoreListener implements&lt;br/&gt;            android.view.View.OnClickListener {&lt;br/&gt;        @Override&lt;br/&gt;        public void onClick(View v) {&lt;br/&gt;       }&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;btnCityStateOption.setOnClickListener(new FindStoreListener());&lt;br/&gt;&lt;/font&gt;&lt;br/&gt;&lt;big&gt;&lt;u&gt;&lt;b&gt;&lt;font color='#003300'&gt;EditText&lt;/font&gt;&lt;/b&gt;&lt;/u&gt;&lt;/big&gt;&lt;br/&gt;&lt;font face='Courier New' color='#330000'&gt;    EditText etUserInput = (EditText) findViewById(R.id.etuserinput);&lt;br/&gt;    String.valueOf(etUserInput.getText()).trim();&lt;/font&gt;&lt;br/&gt;    &lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=d29252f8-32d5-8e26-abc7-235be58a9819' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-115880702720811276?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/115880702720811276/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/04/ui-component-snippets_16.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/115880702720811276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/115880702720811276'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/04/ui-component-snippets_16.html' title='UI component Snippets'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-8234907965970100247</id><published>2010-04-15T06:36:00.000-07:00</published><updated>2010-04-15T06:44:05.132-07:00</updated><title type='text'>Find Current Location in Android - GPS Sample</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;This article will show you how to programmatically access the data returned by your built-in GPS receiver. &lt;br/&gt;&lt;br/&gt;In Android, location-based services are provided by the LocationManager class located in the android.location package. &lt;br/&gt;&lt;br/&gt;Using the LocationManager class, we can obtain periodic updates of the device's geographical locations as well as fire an intent when it enters the proximity of a certain location.&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;&lt;br/&gt;1. Obtain a reference to the LocationManager class using the getSystemService() method.&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;    LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;2. Create a LocationListener Class for notify the location changes. &lt;/b&gt;&lt;/u&gt;&lt;br/&gt;Our MyLocationListener class should implements the LocationListener abstract class. There are four methods that you need to override in this implementation:&lt;br/&gt;    &lt;b&gt;&lt;font color='#660000'&gt;* onLocationChanged(Location location): &lt;/font&gt;&lt;/b&gt;This method is called when the location has changed.&lt;br/&gt;   &lt;font color='#660000'&gt; *&lt;b&gt; onProviderDisabled(String provider):&lt;/b&gt;&lt;/font&gt; This method is called when the provider is disabled by the user.&lt;br/&gt;   &lt;b&gt;&lt;font color='#660000'&gt; * onProviderEnabled(String provider):&lt;/font&gt;&lt;/b&gt; This method is called when the provider is enabled by the user.&lt;br/&gt;    &lt;font color='#660000'&gt;&lt;b&gt;* onStatusChanged(String provider, int status, Bundle extras):&lt;/b&gt;&lt;/font&gt; This method is called when the provider status changes.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;3. To be notified whenever there is a change in location, you need to register for a request for changes in locations so that your program can be notified periodically. This is done via the requestLocationUpdates() method (see Listing 1). &lt;br/&gt;&lt;br/&gt;&lt;b&gt;&lt;u&gt;&lt;font color='#006600'&gt;This method takes in four parameters:&lt;/font&gt;&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;    &lt;b&gt;&lt;font color='#660000'&gt;* provider:&lt;/font&gt;&lt;/b&gt; The name of the provider with which you register&lt;br/&gt;   &lt;b&gt;&lt;font color='#660000'&gt; * minTime:&lt;/font&gt;&lt;/b&gt; The minimum time interval for notifications, in milliseconds.&lt;br/&gt;    &lt;b&gt;&lt;font color='#660000'&gt;* minDistance:&lt;/font&gt;&lt;/b&gt; The minimum distance interval for notifications, in meters.&lt;br/&gt;    &lt;b&gt;&lt;font color='#660000'&gt;* listener:&lt;/font&gt;&lt;/b&gt; An object whose onLocationChanged() method will be called for each location update.&lt;br/&gt;&lt;u&gt;&lt;b&gt;&lt;br/&gt;4. Set the following User-Permission  in androidmanifest.xml&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;   &lt;b&gt;&lt;font color='#006600'&gt; &amp;lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"&amp;gt;&amp;lt;/uses-permission&amp;gt;&lt;/font&gt;&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Sample Code :&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;b&gt;&lt;font color='#000000'&gt;MainActivity.java&lt;/font&gt;&lt;/b&gt;&lt;br/&gt;&lt;big&gt;&lt;i&gt;&lt;small&gt;&lt;font color='#660000'&gt;public class MainActivity extends Activity {&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;    super.onCreate(savedInstanceState);&lt;br/&gt;    setContentView(R.layout.main);&lt;br/&gt;    LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);&lt;br/&gt;    LocationListener ll = new mylocationlistener();&lt;br/&gt;    lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ll);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    private class mylocationlistener implements LocationListener {&lt;br/&gt;    @Override&lt;br/&gt;    public void onLocationChanged(Location location) {&lt;br/&gt;        if (location != null) {&lt;br/&gt;        Log.d("LOCATION CHANGED", location.getLatitude() + "");&lt;br/&gt;        Log.d("LOCATION CHANGED", location.getLongitude() + "");&lt;br/&gt;        Toast.makeText(MainActivity.this,&lt;br/&gt;            location.getLatitude() + "" + location.getLongitude(),&lt;br/&gt;            Toast.LENGTH_LONG).show();&lt;br/&gt;        }&lt;br/&gt;    }&lt;br/&gt;    @Override&lt;br/&gt;    public void onProviderDisabled(String provider) {&lt;br/&gt;    }&lt;br/&gt;    @Override&lt;br/&gt;    public void onProviderEnabled(String provider) {&lt;br/&gt;    }&lt;br/&gt;    @Override&lt;br/&gt;    public void onStatusChanged(String provider, int status, Bundle extras) {&lt;br/&gt;    }&lt;br/&gt;    }&lt;br/&gt;}&lt;/font&gt;&lt;/small&gt;&lt;/i&gt;&lt;/big&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=08cc0fed-c955-83f6-b841-71b6c05023cc' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-8234907965970100247?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/8234907965970100247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/04/find-current-location-in-android-gps.html#comment-form' title='23 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/8234907965970100247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/8234907965970100247'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/04/find-current-location-in-android-gps.html' title='Find Current Location in Android - GPS Sample'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>23</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-1817907706670177208</id><published>2010-04-07T03:08:00.001-07:00</published><updated>2010-04-07T03:08:28.489-07:00</updated><title type='text'>Steps to implement ExpandableListView in android</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;3 Steps to implement the Expandable ListView  in android&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Step 1 : Initilize the ExpandableListView and ExpandableListAdapter in a onCreate()&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&gt;    ExpandableListAdapter mAdapter;&lt;br/&gt;    ExpandableListView epView = (ExpandableListView) findViewById(R.id.ExpandableListView01);&lt;br/&gt;    mAdapter = new MyExpandableListAdapter();&lt;br/&gt;    epView.setAdapter(mAdapter);&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Step 2 : Create a custom BaseApdapter Class&lt;/b&gt;&lt;/u&gt;&lt;br/&gt; /**&lt;br/&gt;     * A simple adapter which maintains an ArrayList of photo resource Ids. Each&lt;br/&gt;     * photo is displayed as an image. This adapter supports clearing the list&lt;br/&gt;     * of photos and adding a new photo.&lt;br/&gt;     * &lt;br/&gt;     */&lt;br/&gt;    public class MyExpandableListAdapter extends BaseExpandableListAdapter {&lt;br/&gt;    // Sample data set. children[i] contains the children (String[]) for&lt;br/&gt;    // groups[i].&lt;br/&gt;    private String[] groups = { "Parent1", "Parent2",&lt;br/&gt;        "Parent3" };&lt;br/&gt;    private String[][] children = { { "Child1" },{ "Child2" }, { "Child3" },{ "Child4" }, { "Child5" } };&lt;br/&gt;&lt;br/&gt;    public Object getChild(int groupPosition, int childPosition) {&lt;br/&gt;        return children[groupPosition][childPosition];&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public long getChildId(int groupPosition, int childPosition) {&lt;br/&gt;        return childPosition;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public int getChildrenCount(int groupPosition) {&lt;br/&gt;        int i = 0;&lt;br/&gt;        try {&lt;br/&gt;        i = children[groupPosition].length;&lt;br/&gt;&lt;br/&gt;        } catch (Exception e) {&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        return i;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public TextView getGenericView() {&lt;br/&gt;        // Layout parameters for the ExpandableListView&lt;br/&gt;        AbsListView.LayoutParams lp = new AbsListView.LayoutParams(&lt;br/&gt;            ViewGroup.LayoutParams.FILL_PARENT, 64);&lt;br/&gt;&lt;br/&gt;        TextView textView = new TextView(MainActivity.this);&lt;br/&gt;        textView.setLayoutParams(lp);&lt;br/&gt;        // Center the text vertically&lt;br/&gt;        textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);&lt;br/&gt;        textView.setTextColor(R.color.marcyred);&lt;br/&gt;        // Set the text starting position&lt;br/&gt;        textView.setPadding(36, 0, 0, 0);&lt;br/&gt;        return textView;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public View getChildView(int groupPosition, int childPosition,&lt;br/&gt;        boolean isLastChild, View convertView, ViewGroup parent) {&lt;br/&gt;        TextView textView = getGenericView();&lt;br/&gt;        textView.setText(getChild(groupPosition, childPosition).toString());&lt;br/&gt;        return textView;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public Object getGroup(int groupPosition) {&lt;br/&gt;        return groups[groupPosition];&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public int getGroupCount() {&lt;br/&gt;        return groups.length;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public long getGroupId(int groupPosition) {&lt;br/&gt;        return groupPosition;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public View getGroupView(int groupPosition, boolean isExpanded,&lt;br/&gt;        View convertView, ViewGroup parent) {&lt;br/&gt;        TextView textView = getGenericView();&lt;br/&gt;        textView.setText(getGroup(groupPosition).toString());&lt;br/&gt;        return textView;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public boolean isChildSelectable(int groupPosition, int childPosition) {&lt;br/&gt;        return true;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public boolean hasStableIds() {&lt;br/&gt;        return true;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    }&lt;br/&gt;    &lt;br/&gt;&lt;u&gt;&lt;b&gt;3. Listeners &lt;/b&gt;&lt;b&gt;&lt;br/&gt;&lt;/b&gt;&lt;/u&gt;    epView.setOnGroupClickListener(new OnGroupClickListener() {&lt;br/&gt;        @Override&lt;br/&gt;        public boolean onGroupClick(ExpandableListView arg0, View arg1,&lt;br/&gt;            int groupPosition, long arg3) {&lt;br/&gt;        if (groupPosition == 5) {                &lt;br/&gt;&lt;br/&gt;        }&lt;br/&gt;        return false;&lt;br/&gt;        }&lt;br/&gt;        });&lt;br/&gt;&lt;br/&gt;    epView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {&lt;br/&gt;    @Override&lt;br/&gt;    public boolean onChildClick(ExpandableListView parent,&lt;br/&gt;            View v, int groupPosition, int childPosition,&lt;br/&gt;            long id) {&lt;br/&gt;        if (groupPosition == 0 &amp;amp;&amp;amp; childPosition == 0) {&lt;br/&gt;            &lt;br/&gt;        } &lt;br/&gt;        return false;&lt;br/&gt;    }&lt;br/&gt;    });&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=8a803052-1602-8b8c-9410-9e32e0c82719' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-1817907706670177208?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/1817907706670177208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/04/steps-to-implement-expandablelistview.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/1817907706670177208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/1817907706670177208'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/04/steps-to-implement-expandablelistview.html' title='Steps to implement ExpandableListView in android'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-4008335369931582970</id><published>2010-04-06T23:54:00.000-07:00</published><updated>2010-04-06T23:58:46.368-07:00</updated><title type='text'>Utility Calss - ImageMangerHelper</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;The Following Code snippets used to fetching the image from targeted image URL&lt;br/&gt;&lt;i&gt;&lt;font color='#660000'&gt;&lt;br/&gt;/**&lt;br/&gt; * ImageManager is used to fetch the image from the targeted url. It is a&lt;br/&gt; * immutable pattern.&lt;br/&gt; * &lt;br/&gt; * @author ganesan_sh&lt;br/&gt; * &lt;br/&gt; */&lt;br/&gt;public final class ImageManager {&lt;br/&gt;&lt;br/&gt;    static ImageManager imageManager = null;&lt;br/&gt;    private static long updatedTime = 0;&lt;br/&gt;    private static long resetPeriod = 4320000;&lt;br/&gt;    private static Bitmap bmImg;&lt;br/&gt;&lt;br/&gt;    private ImageManager() {&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public static ImageManager getImageManagerInstance(String imageURL) {&lt;br/&gt;    long currTime = System.currentTimeMillis();&lt;br/&gt;    if (((currTime - updatedTime) &amp;gt; resetPeriod) || imageManager == null) {&lt;br/&gt;        imageManager = new ImageManager();&lt;br/&gt;        fetchAdvBannerImage(imageURL);&lt;br/&gt;    }&lt;br/&gt;    return imageManager;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    static void fetchAdvBannerImage(String fileUrl) {&lt;br/&gt;    URL myFileUrl = null;&lt;br/&gt;    try {&lt;br/&gt;        myFileUrl = new URL(fileUrl);&lt;br/&gt;    } catch (MalformedURLException e) {&lt;br/&gt;    }&lt;br/&gt;    try {&lt;br/&gt;        HttpURLConnection conn = (HttpURLConnection) myFileUrl&lt;br/&gt;            .openConnection();&lt;br/&gt;        conn.setDoInput(true);&lt;br/&gt;        conn.connect();&lt;br/&gt;        int length = conn.getContentLength();&lt;br/&gt;        InputStream is = conn.getInputStream();&lt;br/&gt;        bmImg = BitmapFactory.decodeStream(is);&lt;br/&gt;&lt;br/&gt;    } catch (IOException e) {&lt;br/&gt;    }&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public Bitmap getBannerImage() {&lt;br/&gt;    return bmImg;&lt;br/&gt;    }&lt;br/&gt;}&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=7cb8f58a-349b-8bc4-b70e-ec68ca228f87' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-4008335369931582970?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/4008335369931582970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/04/utility-calss-imagemangerhelper.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/4008335369931582970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/4008335369931582970'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/04/utility-calss-imagemangerhelper.html' title='Utility Calss - ImageMangerHelper'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-1933845434179109627</id><published>2010-04-05T21:43:00.001-07:00</published><updated>2010-04-05T21:43:04.956-07:00</updated><title type='text'>Retrieve Application Names</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Here the following code snippet used to retrieve the installed package in your device&lt;br/&gt;&lt;br/&gt;  &lt;small&gt;&lt;b&gt;&lt;font color='#330000'&gt;ListView programsList;&lt;br/&gt;   PackageManager mPackageManager;&lt;br/&gt;  &lt;br/&gt;&lt;br/&gt;   programsList = (ListView) findViewById(R.id.ListView01);&lt;br/&gt;    programsList.setTextFilterEnabled(true);&lt;br/&gt;    mPackageManager = getPackageManager();&lt;br/&gt;    List&amp;lt;String&amp;gt; packageName = new ArrayList&amp;lt;String&amp;gt;();  &lt;br/&gt;    List&amp;lt;ResolveInfo&amp;gt; list = mPackageManager.queryIntentActivities(&lt;br/&gt;        new Intent(Intent.ACTION_MAIN), 0);&lt;br/&gt;    for (ResolveInfo r : list) {&lt;br/&gt;        packageName.add(r.loadLabel(mPackageManager).toString());&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    ArrayAdapter&amp;lt;String&amp;gt; adapter = new ArrayAdapter&amp;lt;String&amp;gt;(this, android.R.layout.simple_dropdown_item_1line,   &lt;br/&gt;    packageName);&lt;br/&gt;    programsList.setAdapter(adapter);&lt;/font&gt;&lt;/b&gt;&lt;/small&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=3bc93841-05bc-8c44-832f-af57f5edf2e0' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-1933845434179109627?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/1933845434179109627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/04/retrieve-application-names.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/1933845434179109627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/1933845434179109627'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/04/retrieve-application-names.html' title='Retrieve Application Names'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-549960052938089357</id><published>2010-04-01T03:22:00.001-07:00</published><updated>2010-04-01T03:22:33.995-07:00</updated><title type='text'>Content Provider Example - 3</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;u&gt;&lt;b&gt;Sample Code - MainActivity.java&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;public class MainActivity extends Activity {&lt;br/&gt;    /** Called when the activity is first created. */&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        setContentView(R.layout.main);&lt;br/&gt;        &lt;br/&gt;        Button btn1 = (Button) findViewById(R.id.Button01);&lt;br/&gt;        Button btn2 = (Button) findViewById(R.id.Button02);&lt;br/&gt;        &lt;br/&gt;        btn1.setOnClickListener(new View.OnClickListener() {&lt;br/&gt;            @Override&lt;br/&gt;            public void onClick(View v) {&lt;br/&gt;                ContentValues values = new ContentValues();&lt;br/&gt;                values.put(UserInfo.isactive, "Y");&lt;br/&gt;                Uri uri = getContentResolver().insert(MyContentProvider.CONTENT_URI, values);&lt;br/&gt;                Toast.makeText(MainActivity.this, "Item Added",Toast.LENGTH_LONG).show();&lt;br/&gt;            }&lt;br/&gt;        });&lt;br/&gt;&lt;br/&gt;        btn2.setOnClickListener(new View.OnClickListener() {&lt;br/&gt;            @Override&lt;br/&gt;            public void onClick(View v) {&lt;br/&gt;                String resultStr = "";&lt;br/&gt;                Uri allTitles = Uri.parse("content://"+ MyContentProvider.PROVIDER_NAME + "/"+ UserInfo.DATABASE_TABLE);&lt;br/&gt;                Cursor c = managedQuery(allTitles, null, null, null, "");&lt;br/&gt;                if (c.moveToFirst()) {&lt;br/&gt;                    do {&lt;br/&gt;                        resultStr = c.getString(c.getColumnIndex(UserInfo._ID))+ ", "+ c.getString(c.getColumnIndex(UserInfo.isactive));&lt;br/&gt;                        Toast.makeText(MainActivity.this, resultStr,Toast.LENGTH_LONG).show();&lt;br/&gt;                    } while (c.moveToNext());&lt;br/&gt;                }&lt;br/&gt;            }&lt;br/&gt;        });&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public void readContact() {&lt;br/&gt;&lt;br/&gt;        ArrayList&amp;lt;String&amp;gt; contactList;&lt;br/&gt;        contactList = new ArrayList&amp;lt;String&amp;gt;();&lt;br/&gt;&lt;br/&gt;        String[] columns = new String[] { People.NAME, People.NUMBER };&lt;br/&gt;        Uri mContacts = People.CONTENT_URI;&lt;br/&gt;        Cursor mCur = managedQuery(mContacts, columns, null, null, People.NAME+ " ASC ");&lt;br/&gt;        if (mCur.moveToFirst()) {&lt;br/&gt;            do {&lt;br/&gt;                contactList.add(mCur.getString(mCur.getColumnIndex(People.NAME)));&lt;br/&gt;            } while (mCur.moveToNext());&lt;br/&gt;        }&lt;br/&gt;        Toast.makeText(this, contactList.size() + "", Toast.LENGTH_LONG).show();&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;-------------&lt;br/&gt;&lt;u&gt;&lt;b&gt;MyContentProvider.java&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;public class MyContentProvider extends ContentProvider {&lt;br/&gt;    public static final String PROVIDER_NAME = "com.contentproviderexample.mycontentprovider";&lt;br/&gt;    public static final Uri CONTENT_URI = Uri.parse("content://"+ PROVIDER_NAME + "/demodb");    &lt;br/&gt;    private static final UriMatcher uriMatcher;&lt;br/&gt;    private SQLiteDatabase demoDB;    &lt;br/&gt;&lt;br/&gt;    public static final class UserInfo implements BaseColumns {&lt;br/&gt;        public static final String DATABASE_TABLE = "userinfo";&lt;br/&gt;        public static final int USERINFO = 1;&lt;br/&gt;        public static final int USERINFO_ID = 2;&lt;br/&gt;        public static final Uri CONTENT_URI = Uri.parse("content://"+ PROVIDER_NAME + "/userinfo");&lt;br/&gt;        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.contentproviderexample.userinfo";&lt;br/&gt;        public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.contentproviderexample.userinfo";&lt;br/&gt;        public static final String _ID = "_id";&lt;br/&gt;        public static final String isactive = "isactive";&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    static {&lt;br/&gt;        uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);&lt;br/&gt;        uriMatcher.addURI(PROVIDER_NAME, UserInfo.DATABASE_TABLE,UserInfo.USERINFO);        &lt;br/&gt;        uriMatcher.addURI(PROVIDER_NAME, UserInfo.DATABASE_TABLE + "/#",UserInfo.USERINFO);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public boolean onCreate() {&lt;br/&gt;        Context context = getContext();&lt;br/&gt;        SQLiteConnectionManager dbHelper = new SQLiteConnectionManager(context);&lt;br/&gt;        demoDB = dbHelper.getWritableDatabase();&lt;br/&gt;        return (demoDB == null) ? false : true;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public String getType(Uri uri) {&lt;br/&gt;        switch (uriMatcher.match(uri)) {&lt;br/&gt;        case UserInfo.USERINFO:&lt;br/&gt;            return UserInfo.CONTENT_TYPE;&lt;br/&gt;        case UserInfo.USERINFO_ID:&lt;br/&gt;            return UserInfo.CONTENT_ITEM_TYPE;&lt;br/&gt;        default:&lt;br/&gt;            throw new IllegalArgumentException("Unsupported URI: " + uri);&lt;br/&gt;        }&lt;br/&gt;    }&lt;br/&gt;    @Override&lt;br/&gt;    public Uri insert(Uri uri, ContentValues values) {&lt;br/&gt;&lt;br/&gt;        long rowID = demoDB.insert(UserInfo.DATABASE_TABLE, "", values);&lt;br/&gt;        if (rowID &amp;gt; 0) {&lt;br/&gt;            Uri _uri = ContentUris.withAppendedId(CONTENT_URI, rowID);&lt;br/&gt;            getContext().getContentResolver().notifyChange(_uri, null);&lt;br/&gt;            return _uri;&lt;br/&gt;        }&lt;br/&gt;        throw new SQLException("Failed to insert row into " + uri);&lt;br/&gt;    }&lt;br/&gt;    @Override&lt;br/&gt;    public Cursor query(Uri uri, String[] projection, String selection,String[] selectionArgs, String sortOrder) {&lt;br/&gt;        SQLiteQueryBuilder sqlBuilder = new SQLiteQueryBuilder();&lt;br/&gt;        sqlBuilder.setTables(UserInfo.DATABASE_TABLE);&lt;br/&gt;        if (uriMatcher.match(uri) == UserInfo.USERINFO_ID)&lt;br/&gt;            sqlBuilder.appendWhere(UserInfo._ID + " = "+ uri.getPathSegments().get(1));&lt;br/&gt;        Cursor c = sqlBuilder.query(demoDB, projection, selection,selectionArgs, null, null, sortOrder);&lt;br/&gt;        c.setNotificationUri(getContext().getContentResolver(), uri);&lt;br/&gt;        return c;&lt;br/&gt;    }&lt;br/&gt;    @Override&lt;br/&gt;    public int delete(Uri uri, String selection, String[] selectionArgs) {&lt;br/&gt;        int count = 0;&lt;br/&gt;        switch (uriMatcher.match(uri)) {&lt;br/&gt;        case UserInfo.USERINFO:&lt;br/&gt;            count = demoDB.delete(UserInfo.DATABASE_TABLE, selection,selectionArgs);&lt;br/&gt;            break;&lt;br/&gt;&lt;br/&gt;        case UserInfo.USERINFO_ID:&lt;br/&gt;            String id = uri.getPathSegments().get(1);&lt;br/&gt;            count = demoDB.delete(UserInfo.DATABASE_TABLE, UserInfo._ID+ " = "+ id+ (!TextUtils.isEmpty(selection) ? " AND (" + selection&lt;br/&gt;                            + ')' : ""), selectionArgs);&lt;br/&gt;            break;&lt;br/&gt;            &lt;br/&gt;            default:&lt;br/&gt;                throw new IllegalArgumentException("Unknown URI " + uri);&lt;br/&gt;&lt;br/&gt;        }&lt;br/&gt;        getContext().getContentResolver().notifyChange(uri, null);&lt;br/&gt;        return count;&lt;br/&gt;    }&lt;br/&gt;    @Override&lt;br/&gt;    public int update(Uri uri, ContentValues values, String selection,String[] selectionArgs) {&lt;br/&gt;        int count = 0;&lt;br/&gt;        switch (uriMatcher.match(uri)) {&lt;br/&gt;        case UserInfo.USERINFO:&lt;br/&gt;            count = demoDB.update(UserInfo.DATABASE_TABLE, values, selection,selectionArgs);&lt;br/&gt;            break;&lt;br/&gt;        case UserInfo.USERINFO_ID:&lt;br/&gt;            count = demoDB.update(UserInfo.DATABASE_TABLE, values, UserInfo._ID+ " = "+ uri.getPathSegments().get(1)&lt;br/&gt;                    + (!TextUtils.isEmpty(selection) ? " AND (" + selection+ ')' : ""), selectionArgs);&lt;br/&gt;            break;&lt;br/&gt;        default:&lt;br/&gt;            throw new IllegalArgumentException("Unknown URI " + uri);&lt;br/&gt;        }&lt;br/&gt;        getContext().getContentResolver().notifyChange(uri, null);&lt;br/&gt;        return count;&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;--------&lt;br/&gt;&lt;u&gt;&lt;b&gt;SQLiteConnectionManager .java&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;public class SQLiteConnectionManager extends SQLiteOpenHelper {&lt;br/&gt;&lt;br/&gt;    private static final String DATABASENAME = "DEMODB";&lt;br/&gt;    private static final int DATABASE_VERSION = 1;&lt;br/&gt;    private static final String CREATE_USERINFO = "CREATE TABLE userinfo(_id INTEGER NOT NULL CONSTRAINT USER_PK PRIMARY KEY AUTOINCREMENT,isactive TEXT DEFAULT 'Y')";&lt;br/&gt;    public SQLiteConnectionManager(Context context) {&lt;br/&gt;        super(context, DATABASENAME, null, DATABASE_VERSION);&lt;br/&gt;    }&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(SQLiteDatabase db) {&lt;br/&gt;        db.execSQL(CREATE_USERINFO);&lt;br/&gt;        Log.d("@G SQLConnectionFactory", " CREATE_LEADSOURCE Table ");&lt;br/&gt;    }&lt;br/&gt;    @Override&lt;br/&gt;    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=79cf277c-2262-8db3-b7a7-795db168aee9' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-549960052938089357?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/549960052938089357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/04/content-provider-example-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/549960052938089357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/549960052938089357'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/04/content-provider-example-3.html' title='Content Provider Example - 3'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-260994112861982880</id><published>2010-04-01T01:15:00.000-07:00</published><updated>2010-04-01T01:15:00.853-07:00</updated><title type='text'>Content Provider Example - 2</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;b&gt;&lt;u&gt;Implement the business login in the override methods. &lt;/u&gt;&lt;/b&gt;&lt;br/&gt;    &lt;br/&gt;&lt;i&gt;&lt;u&gt;    Using the onCreate Method we can initilze the Database &lt;/u&gt;&lt;/i&gt;&lt;br/&gt;        @Override&lt;br/&gt;        public boolean onCreate() {&lt;br/&gt;            Context context = getContext();&lt;br/&gt;            SQLiteConnectionManager dbHelper = new SQLiteConnectionManager(context);&lt;br/&gt;            demoDB = dbHelper.getWritableDatabase();&lt;br/&gt;            return (demoDB == null) ? false : true;&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;   &lt;i&gt;&lt;u&gt; getType method is used to validate the input url &lt;/u&gt;&lt;/i&gt;&lt;br/&gt;        @Override&lt;br/&gt;        public String getType(Uri uri) {&lt;br/&gt;            switch (uriMatcher.match(uri)) {&lt;br/&gt;            case UserInfo.USERINFO:&lt;br/&gt;                return UserInfo.CONTENT_TYPE;&lt;br/&gt;            case UserInfo.USERINFO_ID:&lt;br/&gt;                return UserInfo.CONTENT_ITEM_TYPE;&lt;br/&gt;            default:&lt;br/&gt;                throw new IllegalArgumentException("Unsupported URI: " + uri);&lt;br/&gt;            }&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;  &lt;b&gt;&lt;i&gt;&lt;u&gt;  CRUD Operation &lt;/u&gt;&lt;/i&gt;&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;    &lt;i&gt;&lt;u&gt;Create - insert()&lt;/u&gt;&lt;/i&gt;&lt;br/&gt;        long rowID = demoDB.insert(UserInfo.DATABASE_TABLE, "", values);&lt;br/&gt;        if (rowID &amp;gt; 0) {&lt;br/&gt;            Uri _uri = ContentUris.withAppendedId(CONTENT_URI, rowID);&lt;br/&gt;            getContext().getContentResolver().notifyChange(_uri, null);&lt;br/&gt;            return _uri;&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;    &lt;i&gt;&lt;u&gt;Retrive - query()&lt;/u&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;        SQLiteQueryBuilder sqlBuilder = new SQLiteQueryBuilder();&lt;br/&gt;        sqlBuilder.setTables(UserInfo.DATABASE_TABLE);&lt;br/&gt;        if (uriMatcher.match(uri) == UserInfo.USERINFO_ID)&lt;br/&gt;            sqlBuilder.appendWhere(UserInfo._ID + " = "+ uri.getPathSegments().get(1));&lt;br/&gt;        Cursor c = sqlBuilder.query(demoDB, projection, selection,selectionArgs, null, null, sortOrder);&lt;br/&gt;        c.setNotificationUri(getContext().getContentResolver(), uri);&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;    &lt;i&gt;&lt;u&gt;Update - update()&lt;/u&gt;&lt;/i&gt;&lt;br/&gt;        int count = 0;&lt;br/&gt;        switch (uriMatcher.match(uri)) {&lt;br/&gt;        case UserInfo.USERINFO:&lt;br/&gt;            count = demoDB.update(UserInfo.DATABASE_TABLE, values, selection,selectionArgs);&lt;br/&gt;            break;&lt;br/&gt;&lt;br/&gt;        case UserInfo.USERINFO_ID:&lt;br/&gt;            count = demoDB.update(UserInfo.DATABASE_TABLE, values, UserInfo._ID+ " = "+ uri.getPathSegments().get(1)&lt;br/&gt;                    + (!TextUtils.isEmpty(selection) ? " AND (" + selection+ ')' : ""), selectionArgs);&lt;br/&gt;            break;&lt;br/&gt;        default:&lt;br/&gt;            throw new IllegalArgumentException("Unknown URI " + uri);&lt;br/&gt;        }&lt;br/&gt;        getContext().getContentResolver().notifyChange(uri, null);&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;  &lt;/b&gt;&lt;i&gt;&lt;u&gt;Delete - delete()    &lt;/u&gt;&lt;/i&gt;&lt;br/&gt;    int count = 0;&lt;br/&gt;    switch (uriMatcher.match(uri)) {&lt;br/&gt;        case UserInfo.USERINFO:&lt;br/&gt;            count = demoDB.delete(UserInfo.DATABASE_TABLE, selection,selectionArgs);&lt;br/&gt;            break;&lt;br/&gt;        case UserInfo.USERINFO_ID:&lt;br/&gt;            String id = uri.getPathSegments().get(1);&lt;br/&gt;            count = demoDB.delete(UserInfo.DATABASE_TABLE, UserInfo._ID+ " = "+ id+ (!TextUtils.isEmpty(selection) ? " AND (" + selection+ ')' : ""), selectionArgs);&lt;br/&gt;            break;&lt;br/&gt;        default:&lt;br/&gt;            throw new IllegalArgumentException("Unknown URI " + uri);&lt;br/&gt;        }&lt;br/&gt;        getContext().getContentResolver().notifyChange(uri, null);&lt;br/&gt;&lt;br/&gt;&lt;i&gt;&lt;u&gt;&lt;b&gt;Create a Database Helper to Create database Schema&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;br/&gt;Refer : http://about-android.blogspot.com/2009/12/android-hello-world-activity-sample.html&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Accessing Our Content Provider&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;    Create or Insert &lt;br/&gt;        ContentValues values = new ContentValues();&lt;br/&gt;        values.put(UserInfo.isactive, "Y");&lt;br/&gt;        Uri uri = getContentResolver().insert(MyContentProvider.CONTENT_URI, values);&lt;br/&gt;&lt;br/&gt;    Retrieve &lt;br/&gt;        String resultStr = "";&lt;br/&gt;        Uri allTitles = Uri.parse("content://"+ MyContentProvider.PROVIDER_NAME + "/"+ UserInfo.DATABASE_TABLE);&lt;br/&gt;&lt;br/&gt;        Cursor c = managedQuery(allTitles, null, null, null, "");&lt;br/&gt;        if (c.moveToFirst()) {&lt;br/&gt;            do {&lt;br/&gt;                resultStr = c.getString(c.getColumnIndex(UserInfo._ID))+ ", "+ c.getString(c.getColumnIndex(UserInfo.isactive));&lt;br/&gt;                Toast.makeText(MainActivity.this, resultStr,Toast.LENGTH_LONG).show();&lt;br/&gt;            } while (c.moveToNext());&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=ff3f344c-adbc-8f23-93f3-7be4d40ba38c' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-260994112861982880?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/260994112861982880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/04/content-provider-example-2.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/260994112861982880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/260994112861982880'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/04/content-provider-example-2.html' title='Content Provider Example - 2'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-5433011815863079383</id><published>2010-04-01T00:27:00.001-07:00</published><updated>2010-04-01T00:27:16.205-07:00</updated><title type='text'>Content Provider Example - 1</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;In Android, a content provider is a specialized type of data store that exposes standardized ways to retrieve and manipulate the stored data. &lt;br/&gt;&lt;br/&gt;You wish to share data between applications, you need to use the content provider model as recommended in Android. This article presents the basics of content providers and how you can implement one.&lt;br/&gt;&lt;br/&gt;We are going to discuss following item here&lt;br/&gt;  1. Using a Content Provider&lt;br/&gt;  2. Create a Custom Content Provider &lt;br/&gt;&lt;br/&gt;&lt;b&gt;&lt;u&gt;Using a Content Provider&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;Here are some of Android's most useful built-in content providers&lt;br/&gt;&lt;i&gt;&lt;u&gt;Content Provider     Intended Data&lt;/u&gt;&lt;/i&gt;&lt;br/&gt;Contacts                Contact details&lt;br/&gt;Browser                 Browser bookmarks, browser history, etc.&lt;br/&gt;CallLog                   Missed calls, call details, etc.&lt;br/&gt;MediaStore             Media files such as audio, video and images&lt;br/&gt;Settings                 Device settings and preferences&lt;br/&gt;&lt;br/&gt;Here are the sample method for accessing the Contacts Content Provider.&lt;br/&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#660000'&gt;public void readContact() {    &lt;br/&gt;        ArrayList&amp;lt;String&amp;gt; contactList;&lt;br/&gt;        contactList = new ArrayList&amp;lt;String&amp;gt;();&lt;br/&gt;&lt;br/&gt;        String[] columns = new String[] { People.NAME, People.NUMBER };&lt;br/&gt;        Uri mContacts = People.CONTENT_URI;&lt;br/&gt;        Cursor mCur = managedQuery(mContacts, columns, null, null, People.NAME+ " ASC ");&lt;br/&gt;        if (mCur.moveToFirst()) {&lt;br/&gt;            do {&lt;br/&gt;                contactList.add(mCur.getString(mCur.getColumnIndex(People.NAME)));&lt;br/&gt;            } while (mCur.moveToNext());&lt;br/&gt;        }&lt;br/&gt;        Toast.makeText(this, contactList.size() + "", Toast.LENGTH_LONG).show();&lt;br/&gt;    }&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;&lt;u&gt;Create a Custom Content Provider &lt;/u&gt;&lt;/b&gt;&lt;br/&gt;1. Create a Content Provier Class&lt;br/&gt;2. Override the Following Methods&lt;br/&gt;3. Declare the Constant Content Provider Values.&lt;br/&gt;4. Implement the business login in the override methods. &lt;br/&gt;5. Create a Database Helper to Create database Schema&lt;br/&gt;6. Accessing Our Content Provider&lt;br/&gt;&lt;br/&gt;&lt;i&gt;&lt;u&gt;&lt;b&gt;Create a Content Provier Class&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;br/&gt;    Create a customized class which extend the ContentProvider Class. ContentProvider is an abstract Class, so we need to override the method in the content provider class. &lt;br/&gt;        public class MyContentProvider extends ContentProvider{}&lt;br/&gt;&lt;br/&gt;&lt;i&gt;&lt;u&gt;&lt;b&gt;Override the Following Methods&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;    * onCreate(): Called when the provider is being started.&lt;br/&gt;    * getType(): Returns the MIME type of the data at the given URI.        &lt;br/&gt;&lt;br/&gt;    &lt;i&gt;&lt;u&gt;CRUD Operation &lt;/u&gt;&lt;/i&gt;&lt;br/&gt;    * insert(): Inserts a new record into the content provider.&lt;br/&gt;    * query(): Receives a request from a client. The result is returned as a Cursor object.&lt;br/&gt;    * update(): Updates an existing record from the content provider.&lt;br/&gt;    * delete(): Deletes an existing record from the content provider.           &lt;br/&gt;&lt;br/&gt;    &lt;br/&gt;    &lt;br/&gt;&lt;b&gt;&lt;u&gt;Declare the Constant Content Provider Values.&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;&lt;i&gt;&lt;u&gt;1. Provider Name - Which is used to access the content provider. &lt;/u&gt;&lt;/i&gt;&lt;/b&gt;&lt;br/&gt;        1. Standard prefix indicating that the data is controlled by a content provider. IT'S NEVER MODIFIED.&lt;br/&gt;        2.The authority part of the URI; it identifies the content provider. For third-party applications, this should be a fully-qualified class name (reduced to lowercase) to ensure uniqueness. The authority is declared in the &amp;lt;provider&amp;gt; element's authorities attribute:&lt;br/&gt;            &amp;lt;provider name=".TransportationProvider" authorities="com.example.transportationprovider"  . .  &amp;gt;&lt;br/&gt;        3. The path that the content provider uses to determine what kind of data is being requested. This can be zero or more segments long. If the content provider exposes only one type of data (only trains, for example), it can be absent. If the provider exposes several types, including subtypes, it can be several segments long for example, "land/bus", "land/train", "sea/ship", and "sea/submarine" to give four possibilities.&lt;br/&gt;        4. The ID of the specific record being requested, if any. This is the _ID value of the requested record. If the request is not limited to a single record, this segment and the trailing slash are omitted:&lt;br/&gt;&lt;br/&gt;&lt;i&gt;&lt;u&gt;Example&lt;/u&gt;&lt;/i&gt;&lt;br/&gt;         public static final String PROVIDER_NAME = "com.contentproviderexample.mycontentprovider"; // Same as Androidmanifest.xml entry&lt;br/&gt;         public static final Uri CONTENT_URI = Uri.parse("content://"+ PROVIDER_NAME + "/demodb"); // URI for access the Content Provider &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;i&gt;&lt;u&gt;&lt;b&gt; 2. Create a VO for Table with some content Provider Value&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;br/&gt;        For example i have create a table userinfo which contains the two column [id and isalive]. i have created the following VO class &lt;br/&gt;&lt;br/&gt; &lt;i&gt;&lt;font color='#660000'&gt;public static final class UserInfo implements BaseColumns {&lt;br/&gt;            public static final String DATABASE_TABLE = "userinfo";&lt;br/&gt;            public static final int USERINFO = 1;&lt;br/&gt;            public static final int USERINFO_ID = 2;&lt;br/&gt;&lt;br/&gt;            public static final Uri CONTENT_URI = Uri.parse("content://"&lt;br/&gt;                    + PROVIDER_NAME + "/userinfo");&lt;br/&gt;            public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.contentproviderexample.userinfo";&lt;br/&gt;            public static fin&lt;/font&gt;&lt;/i&gt;&lt;i&gt;&lt;font color='#660000'&gt;al String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.contentproviderexample.userinfo";&lt;/font&gt;&lt;/i&gt;&lt;u&gt;&lt;i&gt;&lt;font color='#660000'&gt;&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;/i&gt;&lt;/u&gt;&lt;i&gt;&lt;font color='#660000'&gt;            public static final String _ID = "_id";&lt;br/&gt;            public static final String isactive = "isactive";&lt;br/&gt;        }&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;i&gt;&lt;u&gt;&lt;b&gt;&lt;br/&gt; 3.Create  a object for UriMatcher. and add the our URL with UriMatcher&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#660000'&gt;        static {&lt;br/&gt;        uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);&lt;br/&gt;        uriMatcher.addURI(PROVIDER_NAME, UserInfo.DATABASE_TABLE,UserInfo.USERINFO);&lt;br/&gt;        uriMatcher.addURI(PROVIDER_NAME, UserInfo.DATABASE_TABLE + "/#",UserInfo.USERINFO);&lt;br/&gt;        }&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=2bb39c8d-9b14-8012-8289-93ee237e3555' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-5433011815863079383?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/5433011815863079383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/04/content-provider-example-1.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5433011815863079383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5433011815863079383'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/04/content-provider-example-1.html' title='Content Provider Example - 1'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-5075400484565306727</id><published>2010-03-31T21:48:00.000-07:00</published><updated>2010-03-31T21:54:08.953-07:00</updated><title type='text'>Android Utility class - Activity navigation.</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;u&gt;&lt;b&gt;ActivityHelper &lt;/b&gt;&lt;/u&gt;&lt;br/&gt;In this article helps to create and use the utility class for activity navigation. &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;&lt;u&gt;1. Create a normal class &lt;/u&gt;&lt;/b&gt;&lt;br/&gt;    &lt;i&gt;public class ActivityHelper { }&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;&lt;u&gt;2. Define the utility method using the static factory method&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;    1. public static Intent createActivityIntent(Activity activity,Class preconditionActivityClazz) { } -used to create a intent        &lt;br/&gt;    2. public static void startOriginalActivityAndFinish(Activity preconditionActivity) { } - Return to the old activity&lt;br/&gt;    3. public static void startNewActivityAndFinish(Activity activity,Intent intent) { } - Finish the current Activty and start a new activity.     &lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;3. Implementation&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;    Intent intent = ActivityHelper.createActivityIntent(MainActivity.this,TargetActivity.class);    &lt;br/&gt;    Using this intent we can navigate the screen&lt;br/&gt;    startNewActivityAndFinish(intent); -&amp;gt; now the Activity moves to the TargetActivity and close the current activty. &lt;br/&gt;    startOriginalActivityAndFinish(TargetActivity.this); - Return back to orginal activity. &lt;br/&gt;    &lt;br/&gt;    &lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Sample Code &lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#330000'&gt;public class ActivityHelper {&lt;br/&gt;    static private final String EXTRA_WRAPPED_INTENT = "ActivityHelper_wrappedIntent";&lt;br/&gt;    /**&lt;br/&gt;     * Create a precondition activity intent.&lt;br/&gt;     * @param activity the original activity&lt;br/&gt;     * @param preconditionActivityClazz the precondition activity's class&lt;br/&gt;     * @return an intent which will launch the precondition activity.&lt;br/&gt;     */&lt;br/&gt;    public static Intent createActivityIntent(Activity activity,&lt;br/&gt;            Class preconditionActivityClazz) {&lt;br/&gt;        Intent newIntent = new Intent();&lt;br/&gt;        newIntent.setClass(activity, preconditionActivityClazz);&lt;br/&gt;        newIntent.putExtra(EXTRA_WRAPPED_INTENT, activity.getIntent());&lt;br/&gt;        return newIntent;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    /**&lt;br/&gt;     * Start the original activity, and finish the precondition activity.      &lt;br/&gt;     * @param preconditionActivity&lt;br/&gt;     */&lt;br/&gt;    public static void startOriginalActivityAndFinish(&lt;br/&gt;            Activity preconditionActivity) {&lt;br/&gt;        preconditionActivity.startActivity((Intent) preconditionActivity.getIntent().getParcelableExtra(EXTRA_WRAPPED_INTENT));&lt;br/&gt;        preconditionActivity.finish();&lt;br/&gt;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    /**&lt;br/&gt;     * Start the precondition activity using a given intent, which should have&lt;br/&gt;     * been created by calling createPreconditionIntent.&lt;br/&gt;     * @param activity&lt;br/&gt;     * @param intent&lt;br/&gt;     */&lt;br/&gt;    public static void startNewActivityAndFinish(Activity activity,&lt;br/&gt;            Intent intent) {&lt;br/&gt;        activity.startActivity(intent);&lt;br/&gt;        activity.finish();&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;}&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=31fd765c-a308-8665-b38d-1e9d4864f898' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-5075400484565306727?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/5075400484565306727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/03/android-utility-class-activity_31.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5075400484565306727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5075400484565306727'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/03/android-utility-class-activity_31.html' title='Android Utility class - Activity navigation.'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-4393403083878341959</id><published>2010-03-24T22:09:00.001-07:00</published><updated>2010-03-24T22:09:41.713-07:00</updated><title type='text'>Android Hudson Setup</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Not yet completed....&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=09bf550a-f147-8f87-b6ce-40de920ef012' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-4393403083878341959?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/4393403083878341959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/03/android-hudson-setup.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/4393403083878341959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/4393403083878341959'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/03/android-hudson-setup.html' title='Android Hudson Setup'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-6606444908643754253</id><published>2010-03-24T22:08:00.003-07:00</published><updated>2010-03-25T09:47:53.429-07:00</updated><title type='text'>JUnit Setup For Android</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Here we are discuss about the JUnit implementation in android application&lt;br/&gt;1. Overview of JUnit in Android&lt;br/&gt;2. Create a Junit Enables Android Application &lt;br/&gt;3. Create a Sample Testcase. &lt;br/&gt;&lt;br/&gt;Oveview &lt;br/&gt;The popular JUnit test framework is integrated into Android.&lt;br/&gt;JUnit, if used properly, brings two major benefits to the test implementation.&lt;br/&gt;    * JUnit enforces the hierarchical organization of the test cases&lt;br/&gt;    * The pattern JUnit is based on guarantees the independence of the test cases and minimizes their interference.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;Android test cases classes should inherit from android.test.AndroidTestCase  instead of junit.framework.TestCase.&lt;br/&gt;The main difference between the two is that AndroidTestCase knows about the Context object and provides method to obtain the current Context.&lt;br/&gt;As many Android API methods need the Context object,  this makes coding of Android test cases much easier.             &lt;br/&gt;Make a seperate folder for Junit test Class. Because it should be remove while move to production. &lt;br/&gt;&lt;br/&gt;&lt;b&gt;Steps to Implement the JUnit.&lt;/b&gt;&lt;br/&gt;1. Create a project &lt;br/&gt;2. Add uses-library and instrumentation in  AndroidManifeast.xml&lt;br/&gt;3. Create a StartupTestSuite&lt;br/&gt;4. Create a Testcase class&lt;br/&gt;5. Run the Apps&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Create a Project&lt;/b&gt;&lt;br/&gt;Create an android project using your IDE and create a basic component for the application. In this blog i have created a MainActivity which get the text based input from the user. &lt;br/&gt;&lt;b&gt;Requirement  :&lt;/b&gt; User enter the His/Her name and password and submit the form. &lt;br/&gt;I have created the following Layout. &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=d544a2cc-f3cd-887d-ada9-4196bdf3eee8' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-6606444908643754253?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/6606444908643754253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/03/junit-setup-for-android.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/6606444908643754253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/6606444908643754253'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/03/junit-setup-for-android.html' title='JUnit Setup For Android'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-6126847354270193551</id><published>2010-03-24T22:08:00.001-07:00</published><updated>2010-05-18T06:56:03.292-07:00</updated><title type='text'>Android CodeReview Tool Setup - PMD</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;In this article help us to setup the Code Review tool for android. &lt;br/&gt;  	 	 	 	&lt;style type='text/css'&gt; 	 &lt;/style&gt;Installing PMD &lt;br/&gt;First, we need to install the PMD Eclipse plugin by following the instructions on the plugin page. Goto Help&amp;gt; Install New Software &amp;gt; Click Add &lt;br/&gt;&lt;img style='max-width: 800px;' src='http://lh5.ggpht.com/_Y3dHlWzBWgA/S_KX9AwKgBI/AAAAAAAAB0U/PhqkeF3igQw/%5BUNSET%5D.jpg?imgmax=800'/&gt;&lt;br/&gt;Add the link : http://pmd.sf.net/eclipse &lt;br/&gt;&lt;img style='max-width: 800px;' src='http://lh6.ggpht.com/_Y3dHlWzBWgA/S_KYJHOvnPI/AAAAAAAAB0Y/67WXbH-Xhuc/%5BUNSET%5D.jpg?imgmax=800'/&gt;&lt;br/&gt;&lt;br/&gt;Install the PMD for Eclipse 3&lt;br/&gt;&lt;img style='max-width: 800px;' src='http://lh3.ggpht.com/_Y3dHlWzBWgA/S_KYVAO8cfI/AAAAAAAAB0c/LAgCSTcuDH0/%5BUNSET%5D.jpg?imgmax=800'/&gt;&lt;br/&gt;&lt;br/&gt;Configure PMD your project &lt;br/&gt;1.  In the project properties, select the PMD page. Enable PMD needs to be checked to run PMD automatically. Otherwise, you will need to manually start PMD each time you want to check your code using the PMD submenu  and older violations will not be removed automatically once you fix your code,  you will need to use the clear violations in the PMD submenu. &lt;br/&gt;&lt;img src='http://lh5.ggpht.com/_Y3dHlWzBWgA/S_KY31GrutI/AAAAAAAAB0g/wmB-5x3iyCg/%5BUNSET%5D.jpg?imgmax=800' style='max-width: 800px;'/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;2. The “Handle high priority violations as errors” property needs to be unchecked. This is a new property in the 3.2.6 version of the PMD eclipse plugin. When that option is checked, the Android plugin will refuse to deploy your application if the project contains high level violations. So unless you have a development rule stating that there should be no high level violations in your project at any time, this option should be disabled. &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;3. With that setup, PMD will be enabled but it will be using the default ruleset shared by all projects in the workspace and that is not really adequate for Android development. To define a specific set of rules for your project, check the last box on the PMD page to create a file named “.ruleset” at the top level of your project. The configuration is now complete, press “OK” and then select “Yes” on the next popup.&lt;br/&gt;&lt;br/&gt;4. Ensure the .ruleset and .pmd files has been created successfully. &lt;br/&gt;&lt;img src='http://lh3.ggpht.com/_Y3dHlWzBWgA/S_KZFUOHg9I/AAAAAAAAB0k/fSWTmhlCScI/%5BUNSET%5D.jpg?imgmax=800' style='max-width: 800px;'/&gt;&lt;br/&gt;5. Check the Code using the PMD &lt;br/&gt;Select the Project and rightclick and select PMD &amp;gt; Check Code With PMD &lt;br/&gt;&lt;img src='http://lh4.ggpht.com/_Y3dHlWzBWgA/S_KZPGFd1jI/AAAAAAAAB0o/OdjJNDhHu_w/%5BUNSET%5D.jpg?imgmax=800' style='max-width: 800px;'/&gt;&lt;br/&gt;6. check the Result in the Violations Overview.&lt;br/&gt;&lt;img src='http://lh3.ggpht.com/_Y3dHlWzBWgA/S_KcaBpUbZI/AAAAAAAAB0s/VdOMWjPm5WY/%5BUNSET%5D.jpg?imgmax=800' style='max-width: 800px;'/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=044b992d-d604-88de-aa19-ad4e5ca036d7' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-6126847354270193551?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/6126847354270193551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/03/android-codereview-tool-setup-pmd.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/6126847354270193551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/6126847354270193551'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/03/android-codereview-tool-setup-pmd.html' title='Android CodeReview Tool Setup - PMD'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_Y3dHlWzBWgA/S_KX9AwKgBI/AAAAAAAAB0U/PhqkeF3igQw/s72-c/%5BUNSET%5D.jpg?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-5875443564055693836</id><published>2010-03-24T22:06:00.001-07:00</published><updated>2010-03-24T22:06:49.052-07:00</updated><title type='text'>SCM - SVN Setup for android</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=8a0a6505-4107-8b61-8455-149060444a5a' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-5875443564055693836?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/5875443564055693836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/03/scm-svn-setup-for-android.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5875443564055693836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5875443564055693836'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/03/scm-svn-setup-for-android.html' title='SCM - SVN Setup for android'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-4107629688322497767</id><published>2010-03-24T09:04:00.000-07:00</published><updated>2010-03-24T22:05:12.826-07:00</updated><title type='text'>My Setup for Google Android Development Environment</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;Here we discussed my android environment. I have setup my android environment for various proces.&lt;br/&gt;I belive the following items are esstential for project development and make easy our development.&lt;span class='Apple-converted-space'&gt; &lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;ol&gt;&lt;li&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;Source Code Management Setup&lt;span class='Apple-converted-space'&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;Project Management Tool - Not Yet Done [As of now i am tracking milestone in a excel sheet]&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;Android Setup&lt;span class='Apple-converted-space'&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;Integrated development environment&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;Code Review With PMD&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;Testing - JUnit configuration.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;Build Tool.&lt;span class='Apple-converted-space'&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Source Code Management Setup&lt;span class='Apple-converted-space'&gt; &lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&gt;A managment process to record the data.&lt;span class='Apple-converted-space'&gt; &lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;i&gt;&lt;u&gt;What benefits do Source Code Management tools provide?&lt;/u&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;SCM tools help development teams in many ways:&lt;br/&gt;    * Collaboration: SCM tools prevent one user from accidentally overwriting the changes of another, allowing many developers to work on the same code without stepping one each other's toes.&lt;br/&gt;    * History: SCM tools track the complete development history of the software, including the exact changes which have occurred between releases and who made those changes.&lt;br/&gt;    * Release notes generation: Given the tracking of each change, the SCM can be used to generate notes for their software releases which accurately capture all of the changes included in the new release.&lt;br/&gt;    * Documentation and test management: SCM tools can be used to manage not just software source code, but also test suites and documentation for their software.&lt;br/&gt;    * Change notifications: To keep interested members of the team informed when changes occur to the source code.&lt;span class='Apple-converted-space'&gt; &lt;/span&gt;&lt;br/&gt;&lt;u&gt;&lt;i&gt;&lt;br/&gt;Who uses SCM tools?&lt;/i&gt;&lt;/u&gt;&lt;br/&gt;SCM tools are used by:&lt;br/&gt;    * Project developers who are writing source code.&lt;br/&gt;    * Project testers who need to download the very latest changes.&lt;br/&gt;    * Advanced users who want to try out code that is not yet stable, mature or released.&lt;span class='Apple-converted-space'&gt; &lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;i&gt;What SCM tools does SourceForge.net support?&lt;/i&gt;&lt;/u&gt;&lt;br/&gt;    * Subversion&lt;br/&gt;    * Git&lt;br/&gt;    * Mercurial&lt;br/&gt;    * Bazaar&lt;br/&gt;    * CVS&lt;span class='Apple-converted-space'&gt; &lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;i&gt;Subversion&lt;/i&gt;&lt;/u&gt;&lt;br/&gt;A tool for software developers which supports collaborative development of software within a team, and the tracking of changes to software source code over time. Subversion is used by developers, and advanced users who need the very latest changes to the software (before releases occur).&lt;br/&gt;&lt;br/&gt;Developers should familiarize themselves with Subversion by reading Version Control with Subversion.&lt;span class='Apple-converted-space'&gt; &lt;/span&gt;&lt;br/&gt;&lt;br/&gt;Reference :&lt;br/&gt;&lt;a href='http://sourceforge.net/apps/trac/sourceforge/wiki/What%20is%20Source%20Code%20Management'&gt;http://sourceforge.net/apps/trac/sourceforge/wiki/What%20is%20Source%20Code%20Management&lt;/a&gt;&lt;br/&gt;&lt;a href='http://sourceforge.net/apps/trac/sourceforge/wiki/Subversion'&gt;http://sourceforge.net/apps/trac/sourceforge/wiki/Subversion&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Click here[Setup SVN Environment] you can get more information.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;&lt;u&gt;Project Management Tool - Not Yet Done [As of now i am tracking milestone in a excel sheet]&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;div align='justify'&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;Project management is the discipline of planning, organizing, and managing resources to bring about the successful completion of specific project goals and objectives. It is sometimes conflated with program management, however technically a program is actually a higher level construct: a group of related and somehow interdependent projects.&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'/&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Android Setup &lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;Check the Following blog to setup the android setup &lt;/span&gt;&lt;/span&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;&lt;span class='Apple-converted-space'&gt;&lt;br/&gt;&lt;b&gt;Reference : &lt;br/&gt;&lt;/b&gt;&lt;a href='http://about-android.blogspot.com/2009/11/about-android-first-of-all-android_09.html'&gt;http://about-android.blogspot.com/2009/11/about-android-first-of-all-android_09.html&lt;/a&gt;&lt;b&gt;&lt;br/&gt;&lt;/b&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'/&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'/&gt;&lt;/span&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;&lt;u&gt;&lt;b&gt;Integrated Development Environment&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'/&gt;&lt;/span&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;&lt;span class='Apple-converted-space'&gt;MOTODEV Studio is Motorola's robust IDE for developing exceptional mobile device applications for a wide range of Motorola products&lt;br/&gt;&lt;br/&gt;You can download from :&lt;a href='http://developer.motorola.com/docstools/motodevstudio/'&gt; http://developer.motorola.com/docstools/motodevstudio/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;&lt;u&gt;&lt;b&gt;Code Review With PMD&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;Code review is systematic examination (often as peer review) of computer source code intended to find and fix mistakes  overlooked in the initial development phase, improving both the overall quality of software and the developers' skills.&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;&lt;span class='Apple-converted-space'&gt;&lt;b&gt;&lt;br/&gt;Reference : &lt;br/&gt;&lt;/b&gt;&lt;a href='http://about-android.blogspot.com/2009/11/about-android-first-of-all-android_09.html'&gt;http://about-android.blogspot.com/2009/11/about-android-first-of-all-android_09.html&lt;/a&gt;&lt;b&gt;&lt;br/&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;&lt;u&gt;&lt;b&gt;Testing - JUnit configuration.&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;In computer programming, unit testing  is a software verification and validation method in which a programmer tests if individual units of source code are fit for use. A unit is the smallest testable part of an application. In procedural programming a unit may be an individual function or procedure.&lt;br/&gt;Here we are using the Instrumentation Framework to write test cases. &lt;br/&gt;&lt;br/&gt;&lt;b&gt;Reference : &lt;/b&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;&lt;span class='Apple-converted-space'&gt;&lt;a href='http://about-android.blogspot.com/2009/11/about-android-first-of-all-android_09.html'&gt;http://about-android.blogspot.com/2009/11/about-android-first-of-all-android_09.html&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;&lt;u&gt;&lt;b&gt;Build Tool.&lt;span class='Apple-converted-space'&gt; &lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;In software engineering, continuous integration (CI) implements continuous processes of applying quality control - small pieces of effort, applied frequently. Continuous integration aims to improve the quality of software, and to reduce the time taken to deliver it, by replacing the traditional practice of applying quality control after completing all development.&lt;br/&gt;&lt;br/&gt;Here we are discussing Hudson for &lt;/span&gt;&lt;/span&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;continuous integration build&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;&lt;b&gt;Reference : &lt;/b&gt;&lt;br/&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-family: &amp;apos;Times New Roman&amp;apos;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'&gt;&lt;span class='Apple-style-span' style='font-family: arial,sans-serif; font-size: 13px;'&gt;&lt;span class='Apple-converted-space'&gt;&lt;a href='http://about-android.blogspot.com/2009/11/about-android-first-of-all-android_09.html'&gt;http://about-android.blogspot.com/2009/11/about-android-first-of-all-android_09.html&lt;/a&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=5aed657c-19bb-8ed1-975b-a390de92a85d' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-4107629688322497767?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/4107629688322497767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/03/my-setup-for-google-android-development.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/4107629688322497767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/4107629688322497767'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/03/my-setup-for-google-android-development.html' title='My Setup for Google Android Development Environment'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-1926128106224448936</id><published>2010-03-22T04:16:00.001-07:00</published><updated>2010-03-22T04:16:32.167-07:00</updated><title type='text'>Sample Google Map Driving Direction.</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;1. Create a Customized Overlay Components. &lt;br/&gt;2. Create a Map View Layout. &lt;br/&gt;3. Get the Direction Data using the google Service. &lt;br/&gt;4. Parse the Data and Generate geopoints&lt;br/&gt;5. Draw the path using the customized Overlay Components&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Create a Customized Overlay Components. &lt;/b&gt;&lt;br/&gt;This components are used to draw the rount, which extends the overlay class. &lt;br/&gt;Reference : http://about-android.blogspot.com/2010/03/steps-to-place-marker-in-map-overlay.html&lt;br/&gt;&lt;b&gt;&lt;br/&gt;Create a Map View Layou&lt;/b&gt;t&lt;br/&gt;Create a Map View and add create a mainactivity. &lt;br/&gt;Reference :http://about-android.blogspot.com/2010/02/map-implementation.html&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Get the Direction Data using the google Service&lt;/b&gt;&lt;br/&gt;Google provides the varity of service to access the google map. In this blog we are using the following service to get the direction data. &lt;br/&gt;http://maps.google.com/maps?f=d&amp;amp;hl=en&amp;amp;saddr=XXXXXXX&amp;amp;daddr=XXXXXXX&amp;amp;ie=UTF8&amp;amp;0&amp;amp;om=0&amp;amp;output=kml&lt;br/&gt;Reference : http://mapki.com/wiki/Google_Map_Parameters&lt;br/&gt;&lt;br/&gt;String urlString = "http://maps.google.com/maps?f=d&amp;amp;hl=en&amp;amp;saddr="+srcPlace+"&amp;amp;daddr="+destPlace+"&amp;amp;ie=UTF8&amp;amp;0&amp;amp;om=0&amp;amp;output=kml";        &lt;br/&gt;    HttpURLConnection urlConnection = null;&lt;br/&gt;    URL url = null;&lt;br/&gt;    String pathConent = "";&lt;br/&gt;    try {&lt;br/&gt;        url = new URL(urlString.toString());&lt;br/&gt;        urlConnection = (HttpURLConnection) url.openConnection();&lt;br/&gt;        urlConnection.setRequestMethod("GET");&lt;br/&gt;        urlConnection.setDoOutput(true);&lt;br/&gt;        urlConnection.setDoInput(true);&lt;br/&gt;        urlConnection.connect();&lt;br/&gt;        InoutStream is =  urlConnection.getInputStream();&lt;br/&gt;    } catch (Exception e) {&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Parse the Data and Generate geopoints&lt;/b&gt;&lt;br/&gt;Here i am using the DOM Parser for parse the Content. You can use SAX parser. &lt;br/&gt;&lt;br/&gt;Reference : http://about-android.blogspot.com/2010/02/sample-saxparser-in-android.html&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Sample DOM Parser: &lt;/b&gt;&lt;br/&gt;  &lt;font color='#330000'&gt;&lt;i&gt;  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();&lt;br/&gt;    DocumentBuilder db = dbf.newDocumentBuilder();&lt;br/&gt;    doc = db.parse(urlConnection.getInputStream());&lt;br/&gt;    NodeList nl = doc.getElementsByTagName("LineString");&lt;br/&gt;    for (int s = 0; s &amp;lt; nl.getLength(); s++) {&lt;br/&gt;        Node rootNode = nl.item(s);&lt;br/&gt;        NodeList configItems = rootNode.getChildNodes();&lt;br/&gt;        for (int x = 0; x &amp;lt; configItems.getLength(); x++) {&lt;br/&gt;            Node lineStringNode = configItems.item(x);&lt;br/&gt;            NodeList path = lineStringNode.getChildNodes();&lt;br/&gt;            pathConent = path.item(0).getNodeValue();&lt;br/&gt;        }&lt;br/&gt;    }&lt;/i&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;&lt;br/&gt;The following method is used to access the Url and parse content&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&gt;private String[] getDirectionData(String srcPlace, String destPlace) {&lt;br/&gt;&lt;br/&gt;    String urlString = "http://maps.google.com/maps?f=d&amp;amp;hl=en&amp;amp;saddr="&lt;br/&gt;            + srcPlace + "&amp;amp;daddr=" + destPlace&lt;br/&gt;            + "&amp;amp;ie=UTF8&amp;amp;0&amp;amp;om=0&amp;amp;output=kml";&lt;br/&gt;    Log.d("URL", urlString);&lt;br/&gt;    Document doc = null;&lt;br/&gt;    HttpURLConnection urlConnection = null;&lt;br/&gt;    URL url = null;&lt;br/&gt;    String pathConent = "";&lt;br/&gt;    try {&lt;br/&gt;&lt;br/&gt;        url = new URL(urlString.toString());&lt;br/&gt;        urlConnection = (HttpURLConnection) url.openConnection();&lt;br/&gt;        urlConnection.setRequestMethod("GET");&lt;br/&gt;        urlConnection.setDoOutput(true);&lt;br/&gt;        urlConnection.setDoInput(true);&lt;br/&gt;        urlConnection.connect();&lt;br/&gt;        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();&lt;br/&gt;        DocumentBuilder db = dbf.newDocumentBuilder();&lt;br/&gt;        doc = db.parse(urlConnection.getInputStream());&lt;br/&gt;&lt;br/&gt;    } catch (Exception e) {&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    NodeList nl = doc.getElementsByTagName("LineString");&lt;br/&gt;    for (int s = 0; s &amp;lt; nl.getLength(); s++) {&lt;br/&gt;        Node rootNode = nl.item(s);&lt;br/&gt;        NodeList configItems = rootNode.getChildNodes();&lt;br/&gt;        for (int x = 0; x &amp;lt; configItems.getLength(); x++) {&lt;br/&gt;            Node lineStringNode = configItems.item(x);&lt;br/&gt;            NodeList path = lineStringNode.getChildNodes();&lt;br/&gt;            pathConent = path.item(0).getNodeValue();&lt;br/&gt;        }&lt;br/&gt;    }&lt;br/&gt;    String[] tempContent = pathConent.split(" ");&lt;br/&gt;    return tempContent;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Draw the path using the customized Overlay Components&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;Using the Custom Overlay Component we can draw the line.&lt;br/&gt;&lt;br/&gt;    // STARTING POINT&lt;br/&gt;    GeoPoint startGP = new GeoPoint(&lt;br/&gt;            (int) (Double.parseDouble(lngLat[1]) * 1E6), (int) (Double&lt;br/&gt;                    .parseDouble(lngLat[0]) * 1E6));&lt;br/&gt;&lt;br/&gt;    myMC = myMapView.getController();&lt;br/&gt;    geoPoint = startGP;&lt;br/&gt;    myMC.setCenter(geoPoint);&lt;br/&gt;    myMC.setZoom(15);&lt;br/&gt;    myMapView.getOverlays().add(new DirectionPathOverlay(startGP, startGP));&lt;br/&gt;&lt;br/&gt;    // NAVIGATE THE PATH&lt;br/&gt;    GeoPoint gp1;&lt;br/&gt;    GeoPoint gp2 = startGP;&lt;br/&gt;&lt;br/&gt;    for (int i = 1; i &amp;lt; pairs.length; i++) {&lt;br/&gt;        lngLat = pairs[i].split(",");&lt;br/&gt;        gp1 = gp2;&lt;br/&gt;        // watch out! For GeoPoint, first:latitude, second:longitude&lt;br/&gt;        gp2 = new GeoPoint((int) (Double.parseDouble(lngLat[1]) * 1E6),&lt;br/&gt;                (int) (Double.parseDouble(lngLat[0]) * 1E6));&lt;br/&gt;        myMapView.getOverlays().add(new DirectionPathOverlay(gp1, gp2));&lt;br/&gt;        Log.d("xxx", "pair:" + pairs[i]);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    // END POINT&lt;br/&gt;    myMapView.getOverlays().add(new DirectionPathOverlay(gp2, gp2));&lt;br/&gt;&lt;u&gt;&lt;b&gt;&lt;br/&gt;&lt;br/&gt;Sample Source&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&gt;Custom Overlay Component : [DirectionPathOverlay.java]&lt;br/&gt;&lt;br/&gt;public class DirectionPathOverlay extends Overlay {&lt;br/&gt;    private GeoPoint gp1;&lt;br/&gt;    private GeoPoint gp2;&lt;br/&gt;    public DirectionPathOverlay(GeoPoint gp1, GeoPoint gp2) {&lt;br/&gt;        this.gp1 = gp1;&lt;br/&gt;        this.gp2 = gp2;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public boolean draw(Canvas canvas, MapView mapView, boolean shadow,&lt;br/&gt;            long when) {&lt;br/&gt;        // TODO Auto-generated method stub&lt;br/&gt;        Projection projection = mapView.getProjection();&lt;br/&gt;        if (shadow == false) {&lt;br/&gt;            Paint paint = new Paint();&lt;br/&gt;            paint.setAntiAlias(true);&lt;br/&gt;            Point point = new Point();&lt;br/&gt;            projection.toPixels(gp1, point);&lt;br/&gt;            paint.setColor(Color.BLUE);&lt;br/&gt;            Point point2 = new Point();&lt;br/&gt;            projection.toPixels(gp2, point2);&lt;br/&gt;            paint.setStrokeWidth(2);&lt;br/&gt;            canvas.drawLine((float) point.x, (float) point.y, (float) point2.x,&lt;br/&gt;                    (float) point2.y, paint);&lt;br/&gt;        }&lt;br/&gt;        return super.draw(canvas, mapView, shadow, when);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public void draw(Canvas canvas, MapView mapView, boolean shadow) {&lt;br/&gt;        // TODO Auto-generated method stub&lt;br/&gt;&lt;br/&gt;        super.draw(canvas, mapView, shadow);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;MainAcvity.java&lt;br/&gt;&lt;br/&gt;public class MainActivity extends MapActivity {&lt;br/&gt;    MapView myMapView = null;&lt;br/&gt;    MapController myMC = null;&lt;br/&gt;    GeoPoint geoPoint = null;&lt;br/&gt;&lt;br/&gt;    /** Called when the activity is first created. */&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        setContentView(R.layout.main);&lt;br/&gt;        myMapView = (MapView) findViewById(R.id.mapid);&lt;br/&gt;        geoPoint = null;&lt;br/&gt;        myMapView.setSatellite(false);&lt;br/&gt;&lt;br/&gt;        String pairs[] = getDirectionData("trichy", "thanjavur");&lt;br/&gt;        String[] lngLat = pairs[0].split(",");&lt;br/&gt;&lt;br/&gt;        // STARTING POINT&lt;br/&gt;        GeoPoint startGP = new GeoPoint(&lt;br/&gt;                (int) (Double.parseDouble(lngLat[1]) * 1E6), (int) (Double&lt;br/&gt;                        .parseDouble(lngLat[0]) * 1E6));&lt;br/&gt;&lt;br/&gt;        myMC = myMapView.getController();&lt;br/&gt;        geoPoint = startGP;&lt;br/&gt;        myMC.setCenter(geoPoint);&lt;br/&gt;        myMC.setZoom(15);&lt;br/&gt;        myMapView.getOverlays().add(new DirectionPathOverlay(startGP, startGP));&lt;br/&gt;&lt;br/&gt;        // NAVIGATE THE PATH&lt;br/&gt;        GeoPoint gp1;&lt;br/&gt;        GeoPoint gp2 = startGP;&lt;br/&gt;&lt;br/&gt;        for (int i = 1; i &amp;lt; pairs.length; i++) {&lt;br/&gt;            lngLat = pairs[i].split(",");&lt;br/&gt;            gp1 = gp2;&lt;br/&gt;            // watch out! For GeoPoint, first:latitude, second:longitude&lt;br/&gt;            gp2 = new GeoPoint((int) (Double.parseDouble(lngLat[1]) * 1E6),&lt;br/&gt;                    (int) (Double.parseDouble(lngLat[0]) * 1E6));&lt;br/&gt;            myMapView.getOverlays().add(new DirectionPathOverlay(gp1, gp2));&lt;br/&gt;            Log.d("xxx", "pair:" + pairs[i]);&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        // END POINT&lt;br/&gt;        myMapView.getOverlays().add(new DirectionPathOverlay(gp2, gp2));&lt;br/&gt;&lt;br/&gt;        myMapView.getController().animateTo(startGP);&lt;br/&gt;        myMapView.setBuiltInZoomControls(true);&lt;br/&gt;        myMapView.displayZoomControls(true);&lt;br/&gt;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    protected boolean isRouteDisplayed() {&lt;br/&gt;        // TODO Auto-generated method stub&lt;br/&gt;        return false;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    private String[] getDirectionData(String srcPlace, String destPlace) {&lt;br/&gt;&lt;br/&gt;        String urlString = "http://maps.google.com/maps?f=d&amp;amp;hl=en&amp;amp;saddr="&lt;br/&gt;                + srcPlace + "&amp;amp;daddr=" + destPlace&lt;br/&gt;                + "&amp;amp;ie=UTF8&amp;amp;0&amp;amp;om=0&amp;amp;output=kml";&lt;br/&gt;        Log.d("URL", urlString);&lt;br/&gt;        Document doc = null;&lt;br/&gt;        HttpURLConnection urlConnection = null;&lt;br/&gt;        URL url = null;&lt;br/&gt;        String pathConent = "";&lt;br/&gt;        try {&lt;br/&gt;&lt;br/&gt;            url = new URL(urlString.toString());&lt;br/&gt;            urlConnection = (HttpURLConnection) url.openConnection();&lt;br/&gt;            urlConnection.setRequestMethod("GET");&lt;br/&gt;            urlConnection.setDoOutput(true);&lt;br/&gt;            urlConnection.setDoInput(true);&lt;br/&gt;            urlConnection.connect();&lt;br/&gt;            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();&lt;br/&gt;            DocumentBuilder db = dbf.newDocumentBuilder();&lt;br/&gt;            doc = db.parse(urlConnection.getInputStream());&lt;br/&gt;&lt;br/&gt;        } catch (Exception e) {&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        NodeList nl = doc.getElementsByTagName("LineString");&lt;br/&gt;        for (int s = 0; s &amp;lt; nl.getLength(); s++) {&lt;br/&gt;            Node rootNode = nl.item(s);&lt;br/&gt;            NodeList configItems = rootNode.getChildNodes();&lt;br/&gt;            for (int x = 0; x &amp;lt; configItems.getLength(); x++) {&lt;br/&gt;                Node lineStringNode = configItems.item(x);&lt;br/&gt;                NodeList path = lineStringNode.getChildNodes();&lt;br/&gt;                pathConent = path.item(0).getNodeValue();&lt;br/&gt;            }&lt;br/&gt;        }&lt;br/&gt;        String[] tempContent = pathConent.split(" ");&lt;br/&gt;        return tempContent;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=5984cbb0-850c-8c75-bea2-a7d1803447a2' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-1926128106224448936?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/1926128106224448936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/03/sample-google-map-driving-direction.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/1926128106224448936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/1926128106224448936'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/03/sample-google-map-driving-direction.html' title='Sample Google Map Driving Direction.'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-2960270982111287260</id><published>2010-03-17T22:15:00.001-07:00</published><updated>2010-03-17T22:15:16.848-07:00</updated><title type='text'>Create a Custom ListView</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;style type='text/css'&gt; 	 	&lt;/style&gt;  &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal;'&gt; &lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#008080'&gt;	This blog helps to create a custom list view. &lt;/font&gt;&lt;/font&gt;&lt;/font&gt; &lt;/p&gt;  &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;u&gt;&lt;b&gt;&lt;font color='#008080'&gt;Steps to create a Custom List View&lt;/font&gt;&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal;'&gt; &lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#008080'&gt;1. Create Layout for your listview&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal;'&gt; &lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#008080'&gt;2. Create a class which extend the ArrayAdapter &lt;/font&gt;&lt;/font&gt;&lt;/font&gt; &lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal;'&gt; &lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#008080'&gt;3. Assign the Values to View. &lt;/font&gt;&lt;/font&gt;&lt;/font&gt; &lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal;'&gt; &lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#008080'&gt;4. Implement the Custom Adapter in the mainactivity&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal;'&gt; &lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;u&gt;&lt;b&gt;&lt;font color='#008080'&gt;Create Layout for your listview&lt;/font&gt;&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='JUSTIFY' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;	This layout are used to show the listview as a each view. You can add the multiple view in that. In this example i have added only one textview and change the property.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='JUSTIFY' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal;'&gt; &lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal;'&gt; &lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;i&gt;&lt;u&gt;&lt;font color='#008080'&gt;Sample layout [customlistview.xml]&lt;/font&gt;&lt;/u&gt;&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#008080'&gt;&amp;lt;?&lt;/font&gt;&lt;font color='#3f7f7f'&gt;xml&lt;/font&gt; &lt;font color='#7f007f'&gt;version&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"1.0"&lt;/i&gt;&lt;/font&gt; &lt;font color='#7f007f'&gt;encoding&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"utf-8"&lt;/i&gt;&lt;/font&gt;&lt;font color='#008080'&gt;?&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#008080'&gt;&amp;lt;&lt;/font&gt;&lt;font color='#3f7f7f'&gt;LinearLayout&lt;/font&gt; &lt;font color='#7f007f'&gt;xmlns:android&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"http://schemas.android.com/apk/res/android"&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;	&lt;font color='#7f007f'&gt;android:background&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"#FF04FF"&lt;/i&gt;&lt;/font&gt; &lt;font color='#7f007f'&gt;android:layout_width&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"fill_parent"&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;	&lt;font color='#7f007f'&gt;android:layout_height&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"wrap_content"&lt;/i&gt;&lt;/font&gt;&lt;font color='#008080'&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#008080'&gt;&amp;lt;&lt;/font&gt;&lt;font color='#3f7f7f'&gt;TextView&lt;/font&gt; &lt;font color='#7f007f'&gt;android:text&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"@+id/TextView01"&lt;/i&gt;&lt;/font&gt; &lt;font color='#7f007f'&gt;android:id&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"@+id/TextView01"&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;		&lt;font color='#7f007f'&gt;android:textColor&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"#FFFFFF"&lt;/i&gt;&lt;/font&gt; &lt;font color='#7f007f'&gt;android:textSize&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"25px"&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;		&lt;font color='#7f007f'&gt;android:layout_height&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"fill_parent"&lt;/i&gt;&lt;/font&gt; &lt;font color='#7f007f'&gt;android:layout_width&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"fill_parent"&lt;/i&gt;&lt;/font&gt;&lt;font color='#008080'&gt;&amp;gt;&amp;lt;/&lt;/font&gt;&lt;font color='#3f7f7f'&gt;TextView&lt;/font&gt;&lt;font color='#008080'&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font color='#008080'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#3f7f7f'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;LinearLayout&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#008080'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;u&gt;&lt;b&gt;&lt;font color='#008080'&gt;Create a class which extend the ArrayAdapter &amp;amp; Assign the Values to View.&lt;/font&gt;&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent;'&gt; 	&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;span style='text-decoration: none;'&gt;&lt;span style='font-weight: normal;'&gt;This 	class should extend the ArrayAdapter.&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; 	&lt;/li&gt;&lt;li&gt;&lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal; text-decoration: none;'&gt; 	&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#000000'&gt;Create 	a parametrized constructor which pass the Context Object, 	CustomLayout ID as a integer value and Items as a arraylist. &lt;/font&gt;&lt;/font&gt;&lt;/font&gt; 	&lt;/p&gt; 	&lt;/li&gt;&lt;li&gt;&lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal; text-decoration: none;'&gt; 	&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#000000'&gt;Override 	getView() and assign the values in that.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal; text-decoration: none;'&gt; &lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal;'&gt; &lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;i&gt;&lt;u&gt;&lt;font color='#008080'&gt;Sample Custom Array Adapter Class [as a class member of mainactivity]&lt;/font&gt;&lt;/u&gt;&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;private&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;class&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; OrderAdapter &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;extends&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; ArrayAdapter&amp;lt;Order&amp;gt; {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;&lt;b&gt;	&lt;/b&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;private&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; ArrayList&amp;lt;Order&amp;gt; &lt;/font&gt;&lt;font color='#0000c0'&gt;items&lt;/font&gt;&lt;font color='#000000'&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; OrderAdapter(Context context, &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;int&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; resource, ArrayList&amp;lt;Order&amp;gt; items) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;super&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;(context, resource, items);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;this&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;.&lt;/font&gt;&lt;font color='#0000c0'&gt;items&lt;/font&gt;&lt;font color='#000000'&gt; = items;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;		}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#646464'&gt;@Override&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; View getView(&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;int&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; position, View convertView, ViewGroup parent) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		View v = convertView;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;if&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; (v == &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			LayoutInflater vi = (LayoutInflater) 				getSystemService(Context.&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;i&gt;LAYOUT_INFLATER_SERVICE&lt;/i&gt;&lt;/font&gt;&lt;font color='#000000'&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			v = vi.inflate(R.layout.&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;i&gt;customlistview&lt;/i&gt;&lt;/font&gt;&lt;font color='#000000'&gt;, &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;		}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		Order o = &lt;/font&gt;&lt;font color='#0000c0'&gt;items&lt;/font&gt;&lt;font color='#000000'&gt;.get(position);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;if&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; (o != &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			TextView tt = (TextView) v.findViewById(R.id.&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;i&gt;TextView01&lt;/i&gt;&lt;/font&gt;&lt;font color='#000000'&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;if&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; (tt != &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;				tt.setText(&lt;/font&gt;&lt;font color='#2a00ff'&gt;"Name: "&lt;/font&gt;&lt;font color='#000000'&gt; + o.getTitleName());&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;		}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;	}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;return&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; v;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% rgb(230, 230, 255);'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; page-break-before: always;'&gt; &lt;font color='#008080'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;u&gt;&lt;b&gt;Implement the Custom Adapter in the mainactivity&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal; text-decoration: none;'&gt; 	&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;Create 	a Instance for the custom Adapater class and ArrayList&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; 	&lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal; text-decoration: none;'&gt; 	&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;	OrderAdapter 	&lt;font color='#0000c0'&gt;customAdapter&lt;/font&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			ArrayList&amp;lt;Order&amp;gt; &lt;/font&gt;&lt;font color='#0000c0'&gt;orderList&lt;/font&gt;&lt;font color='#000000'&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent; font-weight: normal; text-decoration: none;'&gt; 	&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;get 	the List of Items&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#000000'&gt;&lt;span style='text-decoration: none;'&gt;&lt;span style='font-weight: normal;'&gt;			&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;orderList&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt; = &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;b&gt;new&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt; ArrayList&amp;lt;Order&amp;gt;();&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			&lt;/font&gt;&lt;font color='#0000c0'&gt;orderList&lt;/font&gt;&lt;font color='#000000'&gt;.add(&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;new&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; Order(&lt;/font&gt;&lt;font color='#2a00ff'&gt;"first"&lt;/font&gt;&lt;font color='#000000'&gt;));&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			&lt;/font&gt;&lt;font color='#0000c0'&gt;orderList&lt;/font&gt;&lt;font color='#000000'&gt;.add(&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;new&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; Order(&lt;/font&gt;&lt;font color='#2a00ff'&gt;"second"&lt;/font&gt;&lt;font color='#000000'&gt;));&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			&lt;/font&gt;&lt;font color='#0000c0'&gt;orderList&lt;/font&gt;&lt;font color='#000000'&gt;.add(&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;new&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; Order(&lt;/font&gt;&lt;font color='#2a00ff'&gt;"third"&lt;/font&gt;&lt;font color='#000000'&gt;));&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			&lt;/font&gt;&lt;font color='#0000c0'&gt;customAdapter&lt;/font&gt;&lt;font color='#000000'&gt; = &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;new&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; OrderAdapter(&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;this&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;, R.layout.&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;i&gt;customlistview&lt;/i&gt;&lt;/font&gt;&lt;font color='#000000'&gt;,&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;				&lt;/font&gt;&lt;font color='#0000c0'&gt;orderList&lt;/font&gt;&lt;font color='#000000'&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			ListView l = (ListView) findViewById(R.id.&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;i&gt;ListView01&lt;/i&gt;&lt;/font&gt;&lt;font color='#000000'&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			l.setAdapter(&lt;/font&gt;&lt;font color='#0000c0'&gt;customAdapter&lt;/font&gt;&lt;font color='#000000'&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#008080'&gt;&lt;u&gt;&lt;b&gt;Sample Source&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in; background: none repeat scroll 0% 0% transparent;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;&lt;u&gt;&lt;b&gt;MainActivity.java&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;class&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; MainActivity &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;extends&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; Activity {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#3f5fbf'&gt;/** Called when the activity is first created. */&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;	OrderAdapter &lt;/font&gt;&lt;font color='#0000c0'&gt;customAdapter&lt;/font&gt;&lt;font color='#000000'&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;	ArrayList&amp;lt;Order&amp;gt; &lt;/font&gt;&lt;font color='#0000c0'&gt;orderList&lt;/font&gt;&lt;font color='#000000'&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#646464'&gt;@Override&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;void&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; onCreate(Bundle savedInstanceState) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;super&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;.onCreate(savedInstanceState);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		setContentView(R.layout.&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;i&gt;main&lt;/i&gt;&lt;/font&gt;&lt;font color='#000000'&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		&lt;/font&gt;&lt;font color='#0000c0'&gt;orderList&lt;/font&gt;&lt;font color='#000000'&gt; = &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;new&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; ArrayList&amp;lt;Order&amp;gt;();&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		&lt;/font&gt;&lt;font color='#0000c0'&gt;orderList&lt;/font&gt;&lt;font color='#000000'&gt;.add(&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;new&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; Order(&lt;/font&gt;&lt;font color='#2a00ff'&gt;"first"&lt;/font&gt;&lt;font color='#000000'&gt;));&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		&lt;/font&gt;&lt;font color='#0000c0'&gt;orderList&lt;/font&gt;&lt;font color='#000000'&gt;.add(&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;new&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; Order(&lt;/font&gt;&lt;font color='#2a00ff'&gt;"second"&lt;/font&gt;&lt;font color='#000000'&gt;));&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		&lt;/font&gt;&lt;font color='#0000c0'&gt;orderList&lt;/font&gt;&lt;font color='#000000'&gt;.add(&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;new&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; Order(&lt;/font&gt;&lt;font color='#2a00ff'&gt;"third"&lt;/font&gt;&lt;font color='#000000'&gt;));&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		&lt;/font&gt;&lt;font color='#0000c0'&gt;customAdapter&lt;/font&gt;&lt;font color='#000000'&gt; = &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;new&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; OrderAdapter(&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;this&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;, R.layout.&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;i&gt;customlistview&lt;/i&gt;&lt;/font&gt;&lt;font color='#000000'&gt;,&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;				&lt;/font&gt;&lt;font color='#0000c0'&gt;orderList&lt;/font&gt;&lt;font color='#000000'&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		ListView l = (ListView) findViewById(R.id.&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;i&gt;ListView01&lt;/i&gt;&lt;/font&gt;&lt;font color='#000000'&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		l.setAdapter(&lt;/font&gt;&lt;font color='#0000c0'&gt;customAdapter&lt;/font&gt;&lt;font color='#000000'&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;	}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;private&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;class&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; OrderAdapter &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;extends&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; ArrayAdapter&amp;lt;Order&amp;gt; {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;private&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; ArrayList&amp;lt;Order&amp;gt; &lt;/font&gt;&lt;font color='#0000c0'&gt;items&lt;/font&gt;&lt;font color='#000000'&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; OrderAdapter(Context context, &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;int&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; resource,&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;				ArrayList&amp;lt;Order&amp;gt; items) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;super&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;(context, resource, items);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;this&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;.&lt;/font&gt;&lt;font color='#0000c0'&gt;items&lt;/font&gt;&lt;font color='#000000'&gt; = items;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;		}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		&lt;/font&gt;&lt;font color='#646464'&gt;@Override&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; View getView(&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;int&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; position, View convertView, ViewGroup parent) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;			View v = convertView;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;if&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; (v == &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;				LayoutInflater vi = (LayoutInflater) getSystemService(Context.&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;i&gt;LAYOUT_INFLATER_SERVICE&lt;/i&gt;&lt;/font&gt;&lt;font color='#000000'&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;				v = vi.inflate(R.layout.&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;i&gt;customlistview&lt;/i&gt;&lt;/font&gt;&lt;font color='#000000'&gt;, &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;			}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			Order o = &lt;/font&gt;&lt;font color='#0000c0'&gt;items&lt;/font&gt;&lt;font color='#000000'&gt;.get(position);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;if&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; (o != &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;				TextView tt = (TextView) v.findViewById(R.id.&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;i&gt;TextView01&lt;/i&gt;&lt;/font&gt;&lt;font color='#000000'&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;				&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;if&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; (tt != &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;					tt.setText(&lt;/font&gt;&lt;font color='#2a00ff'&gt;"Name: "&lt;/font&gt;&lt;font color='#000000'&gt; + o.getTitleName());&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;				}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;			}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;			&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;return&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; v;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;		}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;	}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;u&gt;&lt;b&gt;&lt;font color='#000000'&gt;Order.java&lt;/font&gt;&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;class&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; Order {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; Order(String titleName) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;this&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;.&lt;/font&gt;&lt;font color='#0000c0'&gt;titleName&lt;/font&gt;&lt;font color='#000000'&gt; = titleName;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;	}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;private&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; String &lt;/font&gt;&lt;font color='#0000c0'&gt;titleName&lt;/font&gt;&lt;font color='#000000'&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; String getTitleName() {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;return&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; &lt;/font&gt;&lt;font color='#0000c0'&gt;titleName&lt;/font&gt;&lt;font color='#000000'&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;	}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; &lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;void&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt; setTitleName(String titleName) {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;font color='#000000'&gt;		&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;b&gt;this&lt;/b&gt;&lt;/font&gt;&lt;font color='#000000'&gt;.&lt;/font&gt;&lt;font color='#0000c0'&gt;titleName&lt;/font&gt;&lt;font color='#000000'&gt; = titleName;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;	}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;i&gt;&lt;u&gt;&lt;b&gt;main.xml&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#008080'&gt;&amp;lt;?&lt;/font&gt;&lt;font color='#3f7f7f'&gt;xml&lt;/font&gt; &lt;font color='#7f007f'&gt;version&lt;/font&gt;=&lt;font color='#2a00ff'&gt;&lt;i&gt;"1.0"&lt;/i&gt;&lt;/font&gt; &lt;font color='#7f007f'&gt;encoding&lt;/font&gt;=&lt;font color='#2a00ff'&gt;&lt;i&gt;"utf-8"&lt;/i&gt;&lt;/font&gt;&lt;font color='#008080'&gt;?&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#008080'&gt;&amp;lt;&lt;/font&gt;&lt;font color='#3f7f7f'&gt;LinearLayout&lt;/font&gt; &lt;font color='#7f007f'&gt;xmlns:android&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"http://schemas.android.com/apk/res/android"&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;	&lt;font color='#7f007f'&gt;android:orientation&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"vertical"&lt;/i&gt;&lt;/font&gt; &lt;font color='#7f007f'&gt;android:layout_width&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"fill_parent"&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;	&lt;font color='#7f007f'&gt;android:layout_height&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"fill_parent"&lt;/i&gt;&lt;/font&gt;&lt;font color='#008080'&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#008080'&gt;&amp;lt;&lt;/font&gt;&lt;font color='#3f7f7f'&gt;TextView&lt;/font&gt; &lt;font color='#7f007f'&gt;android:layout_width&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"fill_parent"&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;		&lt;font color='#7f007f'&gt;android:layout_height&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"wrap_content"&lt;/i&gt;&lt;/font&gt; &lt;font color='#7f007f'&gt;android:text&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"@string/hello"&lt;/i&gt;&lt;/font&gt; &lt;font color='#008080'&gt;/&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#008080'&gt;&amp;lt;&lt;/font&gt;&lt;font color='#3f7f7f'&gt;ListView&lt;/font&gt; &lt;font color='#7f007f'&gt;android:id&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"@+id/ListView01"&lt;/i&gt;&lt;/font&gt; &lt;font color='#7f007f'&gt;android:layout_height&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"fill_parent"&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;		&lt;font color='#7f007f'&gt;android:layout_width&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"fill_parent"&lt;/i&gt;&lt;/font&gt;&lt;font color='#008080'&gt;&amp;gt;&amp;lt;/&lt;/font&gt;&lt;font color='#3f7f7f'&gt;ListView&lt;/font&gt;&lt;font color='#008080'&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#008080'&gt;&amp;lt;/&lt;/font&gt;&lt;font color='#3f7f7f'&gt;LinearLayout&lt;/font&gt;&lt;font color='#008080'&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Verdana, sans-serif'&gt;&lt;font size='2' style='font-size: 9pt;'&gt;&lt;i&gt;&lt;u&gt;&lt;b&gt;customlistview.xml&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#008080'&gt;&amp;lt;?&lt;/font&gt;&lt;font color='#3f7f7f'&gt;xml&lt;/font&gt; &lt;font color='#7f007f'&gt;version&lt;/font&gt;=&lt;font color='#2a00ff'&gt;&lt;i&gt;"1.0"&lt;/i&gt;&lt;/font&gt; &lt;font color='#7f007f'&gt;encoding&lt;/font&gt;=&lt;font color='#2a00ff'&gt;&lt;i&gt;"utf-8"&lt;/i&gt;&lt;/font&gt;&lt;font color='#008080'&gt;?&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#008080'&gt;&amp;lt;&lt;/font&gt;&lt;font color='#3f7f7f'&gt;LinearLayout&lt;/font&gt; &lt;font color='#7f007f'&gt;xmlns:android&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"http://schemas.android.com/apk/res/android"&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;	&lt;font color='#7f007f'&gt;android:background&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"#FF04FF"&lt;/i&gt;&lt;/font&gt; &lt;font color='#7f007f'&gt;android:layout_width&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"fill_parent"&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;	&lt;font color='#7f007f'&gt;android:layout_height&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"wrap_content"&lt;/i&gt;&lt;/font&gt;&lt;font color='#008080'&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#000000'&gt;	&lt;/font&gt;&lt;font color='#008080'&gt;&amp;lt;&lt;/font&gt;&lt;font color='#3f7f7f'&gt;TextView&lt;/font&gt; &lt;font color='#7f007f'&gt;android:text&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"@+id/TextView01"&lt;/i&gt;&lt;/font&gt; &lt;font color='#7f007f'&gt;android:id&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"@+id/TextView01"&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;		&lt;font color='#7f007f'&gt;android:textColor&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"#FFFFFF"&lt;/i&gt;&lt;/font&gt; &lt;font color='#7f007f'&gt;android:textSize&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"25px"&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;		&lt;font color='#7f007f'&gt;android:layout_height&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"fill_parent"&lt;/i&gt;&lt;/font&gt; &lt;font color='#7f007f'&gt;android:layout_width&lt;/font&gt;&lt;font color='#000000'&gt;=&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;i&gt;"fill_parent"&lt;/i&gt;&lt;/font&gt;&lt;font color='#008080'&gt;&amp;gt;&amp;lt;/&lt;/font&gt;&lt;font color='#3f7f7f'&gt;TextView&lt;/font&gt;&lt;font color='#008080'&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;font face='Courier New, monospace'&gt;&lt;font size='2'&gt;&lt;font color='#008080'&gt;&amp;lt;/&lt;/font&gt;&lt;font color='#3f7f7f'&gt;LinearLayout&lt;/font&gt;&lt;font color='#008080'&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;p align='LEFT' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=7b683bca-ed78-8205-bee9-006c39245c3d' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-2960270982111287260?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/2960270982111287260/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/03/create-custom-listview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/2960270982111287260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/2960270982111287260'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/03/create-custom-listview.html' title='Create a Custom ListView'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-8859158981658307671</id><published>2010-03-16T04:18:00.000-07:00</published><updated>2010-03-16T04:19:31.468-07:00</updated><title type='text'>Steps to place the Marker in the Map [Overlay Example]</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;In this ariticle used to place the marker in the map view.&lt;br/&gt;&lt;u&gt;&lt;b&gt;1. Create a Customize Marker Class&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;Class Should Extend the ItemizedOverlay&lt;br/&gt;Create a parameterized Constructor. i am trying with two constructor. &lt;br/&gt;    The constructor must define the default marker for each of the OverlayItems. In order for the Drawable to actually get drawn, it must have its bounds defined.&lt;br/&gt;&lt;br/&gt;    Most commonly, you want the center-point at the bottom of the image to be the point at which it's attached to the map coordinates. This is handled for you with the boundCenterBottom() method. Wrap this around our defaultMarker, so the super constructor call looks like this:&lt;br/&gt;&lt;br/&gt;    public HelloItemizedOverlay(Drawable defaultMarker) {&lt;br/&gt;      super(boundCenterBottom(defaultMarker));&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;    public HelloItemizedOverlay(Drawable defaultMarker, Context context) {&lt;br/&gt;      super(defaultMarker);&lt;br/&gt;      mContext = context;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;2. Create the following class members &lt;/b&gt;&lt;/u&gt;&lt;br/&gt;    1.  private ArrayList&amp;lt;OverlayItem&amp;gt; mOverlays = new ArrayList&amp;lt;OverlayItem&amp;gt;();&lt;br/&gt;        Used to put each of the OverlayItem objects we want on the map.&lt;br/&gt;    2. private Context mContext ;&lt;br/&gt;&lt;br/&gt;    3. In order to add new OverlayItems to the ArrayList, you need a new method:&lt;br/&gt;&lt;br/&gt;        public void addOverlay(OverlayItem overlay) {&lt;br/&gt;            mOverlays.add(overlay);&lt;br/&gt;            populate();&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        Now define the HelloItemizedOverlay constructors. The constructor must define the default marker for each of the OverlayItems. In order for the Drawable to actually get drawn, it must have its bounds defined. &lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;3. Override the following methods&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&gt;@Override&lt;br/&gt;protected OverlayItem createItem(int i) {&lt;br/&gt;  return mOverlays.get(i);&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;@Override&lt;br/&gt;public int size() {&lt;br/&gt;  return mOverlays.size();&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;@Override&lt;br/&gt;protected boolean onTap(int index) {&lt;br/&gt;    OverlayItem item = mOverlays.get(index);&lt;br/&gt;    AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);&lt;br/&gt;    dialog.setTitle(item.getTitle());&lt;br/&gt;    dialog.setMessage(item.getSnippet());&lt;br/&gt;    dialog.setPositiveButton("Yes", new OnClickListener() {&lt;br/&gt;        &lt;br/&gt;        @Override&lt;br/&gt;        public void onClick(DialogInterface dialog, int which) {&lt;br/&gt;            dialog.dismiss();&lt;br/&gt;        }&lt;br/&gt;    });&lt;br/&gt;    dialog.show();&lt;br/&gt;    return true;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;4. Implement the Marker in the map activity&lt;br/&gt;    1. Get the Overlay as a list from mapview &lt;br/&gt;        &lt;i&gt;&lt;font color='#330000'&gt;List&amp;lt;Overlay&amp;gt; mapOverlays = myMapView.getOverlays()&lt;br/&gt;&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;    2. Instantiate the following class &lt;br/&gt;        Drawable with marker icon &lt;br/&gt;           &lt;font color='#330000'&gt;&lt;i&gt; Drawable drawable = this.getResources().getDrawable(R.drawable.pinicon);&lt;/i&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;        Marker with Drawable object&lt;br/&gt;            &lt;i&gt;&lt;font color='#330000'&gt;MyMapMarker itemizedoverlay = new MyMapMarker(drawable,this);&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;        OverlayItem with geopoint &lt;br/&gt;            &lt;i&gt;&lt;font color='#330000'&gt;OverlayItem overlayitem = new OverlayItem(geoPoint, "Info",&lt;br/&gt;                    "Selected City is" + city);&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;    &lt;br/&gt;    3. All that's left is to add this OverlayItem to your collection, then add the MainActivity to the MapView:&lt;br/&gt;        &lt;i&gt;&lt;font color='#330000'&gt;itemizedoverlay.addOverlay(overlayitem);&lt;br/&gt;        mapOverlays.add(itemizedoverlay);&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Sample Source &lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#330000'&gt;public class MyMapMarker extends ItemizedOverlay {&lt;br/&gt;&lt;br/&gt;    private ArrayList&amp;lt;OverlayItem&amp;gt; mOverlays = new ArrayList&amp;lt;OverlayItem&amp;gt;();&lt;br/&gt;    private Context mContext;&lt;br/&gt;&lt;br/&gt;    &lt;br/&gt;    public MyMapMarker(Drawable defaultMarker) {&lt;br/&gt;        super(boundCenterBottom(defaultMarker));&lt;br/&gt;        // TODO Auto-generated constructor stub&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public MyMapMarker(Drawable defaultMarker, Context context) {&lt;br/&gt;        this(defaultMarker);&lt;br/&gt;        mContext = context;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public void addOverlay(OverlayItem item) {&lt;br/&gt;        mOverlays.add(item);&lt;br/&gt;        populate();&lt;br/&gt;&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    protected OverlayItem createItem(int i) {&lt;br/&gt;        return mOverlays.get(i);&lt;br/&gt;    }&lt;br/&gt;    @Override&lt;br/&gt;    public int size() {&lt;br/&gt;        return mOverlays.size();&lt;br/&gt;    }&lt;br/&gt;    @Override&lt;br/&gt;    protected boolean onTap(int index) {&lt;br/&gt;        OverlayItem item = mOverlays.get(index);&lt;br/&gt;        AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);&lt;br/&gt;        dialog.setTitle(item.getTitle());&lt;br/&gt;        dialog.setMessage(item.getSnippet());&lt;br/&gt;        dialog.setPositiveButton("Yes", new OnClickListener() {    &lt;br/&gt;            @Override&lt;br/&gt;            public void onClick(DialogInterface dialog, int which) {&lt;br/&gt;                dialog.dismiss();&lt;br/&gt;            }&lt;br/&gt;        });&lt;br/&gt;        dialog.show();&lt;br/&gt;        return true;&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=01ec13fc-59e2-8612-a4b6-729cb075411e' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-8859158981658307671?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/8859158981658307671/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/03/steps-to-place-marker-in-map-overlay.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/8859158981658307671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/8859158981658307671'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/03/steps-to-place-marker-in-map-overlay.html' title='Steps to place the Marker in the Map [Overlay Example]'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-7979579882971111524</id><published>2010-03-12T10:47:00.000-08:00</published><updated>2010-03-12T10:52:21.373-08:00</updated><title type='text'>Androind JSON Parser</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;In this blog explain the steps to parse JSON object in android. We are discuss the following items&lt;br/&gt;Overview of JSON&lt;br/&gt;Syntax of JSON&lt;br/&gt;Android JSON Support&lt;br/&gt;Steps to Parse JSON data&lt;br/&gt;Sample Application&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Overview of JSON [JavaScript Object Notation]&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;    Lightweight data-interchagable format &lt;br/&gt;    Text format that is completely language independent&lt;br/&gt;    &lt;br/&gt;&lt;br/&gt;&lt;b&gt;&lt;u&gt;JSON is built on two structures:&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;    * A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.&lt;br/&gt;&lt;br/&gt;    * An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.&lt;br/&gt;&lt;br/&gt;&lt;b&gt;&lt;u&gt;Syntax of JSON&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;Object {name1 : Value1 , name2 : Value2 , name3 : Value3 } -Normal Object Collection&lt;br/&gt;&lt;br/&gt;Object [{name1_1 : Value , name1_2 : Value1 , name1_3 : Value2 }&lt;br/&gt;    {name2_1 : Value , name2_2 : Value1 , name2_3 : Value2 } ] - Array Based&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;i&gt;&lt;u&gt;Example : &lt;/u&gt;&lt;/i&gt;&lt;br/&gt; {"menu": {&lt;br/&gt;      "id": "file",&lt;br/&gt;      "value": "File",&lt;br/&gt;      "popup": {&lt;br/&gt;        "menuitem": [&lt;br/&gt;          {"value": "New", "onclick": "CreateNewDoc()"},&lt;br/&gt;          {"value": "Open", "onclick": "OpenDoc()"},&lt;br/&gt;          {"value": "Close", "onclick": "CloseDoc()"}&lt;br/&gt;        ]&lt;br/&gt;      }&lt;br/&gt;}}&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Android JSON Support&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;    Android already contains the required JSON libraries. The Following class are used to parse the JSON Object.&lt;br/&gt;&lt;br/&gt;    &lt;font color='#330000'&gt;&lt;b&gt;JSONArray&lt;/b&gt;&lt;/font&gt;          &lt;font color='#003300'&gt;A JSONArray is an ordered sequence of values. &lt;/font&gt;&lt;br/&gt;    &lt;font color='#330000'&gt;&lt;b&gt;JSONObject&lt;/b&gt;&lt;/font&gt;        &lt;font color='#003300'&gt;A JSONObject is an unordered collection of name/value pairs. &lt;/font&gt;&lt;br/&gt;    &lt;font color='#330000'&gt;&lt;b&gt;JSONStringer&lt;/b&gt;&lt;/font&gt;     &lt;font color='#003300'&gt;JSONStringer provides a quick and convenient way of producing JSON text. &lt;/font&gt;&lt;br/&gt;    &lt;font color='#330000'&gt;&lt;b&gt;JSONTokener&lt;/b&gt;&lt;/font&gt;     &lt;font color='#003300'&gt;A JSONTokener takes a source string and extracts characters and tokens from it. &lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Steps to Parse JSON data&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;1. Create a JSON Object and Convert JSONString to JSON Object&lt;br/&gt;    &lt;font color='#330000'&gt;&lt;i&gt;JSONObject jObject = new JSONObject(jsonString);&lt;/i&gt;&lt;/font&gt;&lt;br/&gt;    &lt;br/&gt;2. Create a Key based JSONObject.&lt;br/&gt;    &lt;font color='#330000'&gt;&lt;i&gt;JSONObject menuObject = jObject.getJSONObject("menu");&lt;/i&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;3. Get the Value&lt;br/&gt;    &lt;font color='#330000'&gt;&lt;i&gt;L&lt;/i&gt;&lt;i&gt;og.d("ID", menuObject.getString("id"));&lt;br/&gt;    Log.d("Value ", menuObject.getString("value"));&lt;/i&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;font color='#003300'&gt;&lt;b&gt;Sample Application&lt;/b&gt;&lt;/font&gt;&lt;/u&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#330000'&gt;&lt;br/&gt;public class MainActivity extends Activity {&lt;br/&gt;    /** Called when the activity is first created. */&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        setContentView(R.layout.main);&lt;br/&gt;        String myJsonContent = "{\"menu\": {\"id\": \"file\",\"value\": \"File\",\"popup\": {\"menuitem\": [{\"value\": \"New\", \"onclick\": \"CreateNewDoc()\"},{\"value\": \"Open\",\"onclick\": \"OpenDoc()\"},{\"value\": \"Close\", \"onclick\": \"CloseDoc()\"}]}}}";&lt;br/&gt;        sampleJsonParser(myJsonContent);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    public void sampleJsonParser(String jsonString) {&lt;br/&gt;        try {&lt;br/&gt;            JSONObject jObject = new JSONObject(jsonString);&lt;br/&gt;            JSONObject menuObject = jObject.getJSONObject("menu");&lt;br/&gt;            Log.d("ID", menuObject.getString("id"));&lt;br/&gt;            Log.d("Value ", menuObject.getString("value"));&lt;br/&gt;            JSONObject popupObject = menuObject.getJSONObject("popup");&lt;br/&gt;            JSONArray menuitemArray = popupObject.getJSONArray("menuitem");&lt;br/&gt;            for (int i = 0; i &amp;lt; 3; i++) {&lt;br/&gt;                Log.d("Name", menuitemArray.getJSONObject(i).getString("value")&lt;br/&gt;                        .toString());&lt;br/&gt;                Log.d("Value", menuitemArray.getJSONObject(i).getString(&lt;br/&gt;                        "onclick").toString());&lt;br/&gt;            }&lt;br/&gt;       } catch (JSONException e) {&lt;br/&gt;            e.printStackTrace();&lt;br/&gt;        }&lt;br/&gt;    }&lt;br/&gt;}&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=80047329-af54-824e-b553-29be2b1c90e7' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-7979579882971111524?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/7979579882971111524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/03/androind-json-parser.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/7979579882971111524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/7979579882971111524'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/03/androind-json-parser.html' title='Androind JSON Parser'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-2468595216306405071</id><published>2010-03-12T10:12:00.000-08:00</published><updated>2010-04-06T00:39:08.948-07:00</updated><title type='text'>Some Activity Style</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;In this article discuss some activity sytle &lt;br/&gt;1. Create Title-less Activity &lt;br/&gt;2. Create a Full Screen Activity &lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Create Title-less Activity &lt;/b&gt;&lt;/u&gt;&lt;br/&gt;We can remove the title bar for every activity. The Following method used to remove the title. this method must be call before the setContentView().&lt;br/&gt;requestWindowFeature(Window.FEATURE_NO_TITLE);&lt;br/&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#003300'&gt;&lt;b&gt;Sample SourceCode&lt;/b&gt;&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;font color='#330000'&gt;&lt;i&gt;public class MainActivity extends Activity {&lt;br/&gt;    /** Called when the activity is first created. */&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        requestWindowFeature(Window.FEATURE_NO_TITLE);&lt;br/&gt;        setContentView(R.layout.main);&lt;br/&gt;    }&lt;br/&gt;}&lt;/i&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Create a Full Screen Activity &lt;/b&gt;&lt;/u&gt;&lt;br/&gt;We can hide the title bar and windows bar. The following lines are used to hide the title and window bar&lt;br/&gt;&lt;i&gt;&lt;font color='#003300'&gt;&lt;b&gt;&lt;br/&gt;Sample SourceCode&lt;/b&gt;&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#330000'&gt;public class MainActivity extends Activity {&lt;br/&gt;    /** Called when the activity is first created. */&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        requestWindowFeature(Window.FEATURE_NO_TITLE);&lt;br/&gt;        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,&lt;br/&gt;                WindowManager.LayoutParams.FLAG_FULLSCREEN);&lt;br/&gt;        setContentView(R.layout.main);&lt;br/&gt;        Toast.makeText(this, "Welcome to Application", Toast.LENGTH_LONG)&lt;br/&gt;                .show();&lt;br/&gt;    }&lt;br/&gt;}&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Android - disable landscape mode - Disable screen O&lt;/b&gt;&lt;b&gt;rientation&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;the following code shows how to disable the screen orientation in android&lt;br/&gt;&lt;br/&gt;Add android:screenOrientation="portrait" to the activity in the AndroidManifest.xml. For example:&lt;br/&gt;        &amp;lt;activity android:name=".MainActivity"&lt;br/&gt;              android:label="@string/app_name"&lt;br/&gt;              android:screenOrientation="portrait"&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=8456f054-8342-895a-8fc4-a900728e1f60' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-2468595216306405071?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/2468595216306405071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/03/some-activity-style.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/2468595216306405071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/2468595216306405071'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/03/some-activity-style.html' title='Some Activity Style'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-5075269576456100272</id><published>2010-03-12T09:44:00.000-08:00</published><updated>2010-03-12T09:50:11.696-08:00</updated><title type='text'>Lanuch Application as Startup Application</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;In this article helps to lanuch your activity after the start your Phone. &lt;br/&gt;1. Create a BroadcastReceiver Class and start your Main Activity&lt;br/&gt;2. Set the User Permission for launch your application&lt;br/&gt;3. Configure the Action and catgory in the intent-filter&lt;br/&gt;4. Create a MainActivity&lt;br/&gt;&lt;br/&gt;&lt;i&gt;&lt;u&gt;&lt;b&gt;Create a BroadcastReceiver Class and start your Main Activity&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;br/&gt;    This BroadcastReceiver is used to receive the action and start the your main activity    &lt;br/&gt;&lt;br/&gt;&lt;font color='#003300'&gt;&lt;b&gt;public class StartupActivity extends BroadcastReceiver {&lt;br/&gt;    @Override&lt;br/&gt;    public void onReceive(Context context, Intent intent) {&lt;br/&gt;   }&lt;br/&gt;}&lt;/b&gt;&lt;br/&gt;&lt;/font&gt;&lt;br/&gt;&lt;u&gt;&lt;i&gt;&lt;b&gt;Set the User Permission for launch your application&lt;/b&gt;&lt;/i&gt;&lt;/u&gt;&lt;br/&gt;Config the  " &lt;font color='#003300'&gt;&lt;b&gt;android.permission.RECEIVE_BOOT_COMPLETED "&lt;/b&gt;&lt;/font&gt; User Permission in the androidmanifest.xml&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Configure the Action and catgory in the intent-filter&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;Set the following values for android and category&lt;br/&gt;&lt;br/&gt;Action         :   &lt;font color='#003300'&gt;&lt;b&gt; android.intent.action.BOOT_COMPLETED&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;Category     :    &lt;font color='#003300'&gt;&lt;b&gt;android.intent.category.DEFAULT &lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Create a MainActivity&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;Create a MainActivity and write your logic there&lt;br/&gt;public class MainActivity extends Activity {&lt;br/&gt;    /** Called when the activity is first created. */&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;          }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;font color='#000066'&gt;&lt;u&gt;&lt;b&gt;Sample Code &lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;b&gt;&lt;br/&gt;&lt;u&gt;MainActivity.java&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;&lt;font color='#330000'&gt;&lt;i&gt;public class MainActivity extends Activity {&lt;br/&gt;    /** Called when the activity is first created. */&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        setContentView(R.layout.main);&lt;br/&gt;        Toast.makeText(this, "Welcome to Application", Toast.LENGTH_LONG)&lt;br/&gt;                .show();&lt;br/&gt;        finish();&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;/i&gt;&lt;/font&gt;&lt;b&gt;&lt;u&gt;BroadcastReceiver.java&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;&lt;font color='#330000'&gt;&lt;i&gt;public class StartupActivity extends BroadcastReceiver {&lt;br/&gt;    /**&lt;br/&gt;     * @see android.content.BroadcastReceiver#onReceive(Context,Intent)&lt;br/&gt;     */&lt;br/&gt;    @Override&lt;br/&gt;    public void onReceive(Context context, Intent intent) {&lt;br/&gt;        Intent i = new Intent(context, MainActivity.class);&lt;br/&gt;        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);&lt;br/&gt;        context.startActivity(i);&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;/i&gt;&lt;/font&gt;&lt;font color='#330000'&gt;&lt;i&gt;&lt;br/&gt;&lt;/i&gt;&lt;/font&gt;&lt;b&gt;&lt;u&gt;Androidmanifest.xml&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#330000'&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br/&gt;&amp;lt;manifest android:versionCode="1" android:versionName="1.0"&lt;br/&gt;    package="com.lanuchactivity" xmlns:android="http://schemas.android.com/apk/res/android"&amp;gt;&lt;br/&gt;    &amp;lt;application android:icon="@drawable/icon" android:label="@string/app_name"&amp;gt;&lt;br/&gt;        &amp;lt;activity android:label="@string/app_name" android:name=".MainActivity"&amp;gt;&lt;br/&gt;            &amp;lt;intent-filter&amp;gt;&lt;br/&gt;                &amp;lt;action android:name="android.intent.action.MAIN" /&amp;gt;&lt;br/&gt;                &amp;lt;category android:name="android.intent.category.LAUNCHER" /&amp;gt;&lt;br/&gt;            &amp;lt;/intent-filter&amp;gt;&lt;br/&gt;        &amp;lt;/activity&amp;gt;&lt;br/&gt;        &amp;lt;receiver android:name=".StartupActivity"&amp;gt;&lt;br/&gt;            &amp;lt;intent-filter&amp;gt;&lt;br/&gt;                &amp;lt;action android:name="android.intent.action.BOOT_COMPLETED"&amp;gt;&amp;lt;/action&amp;gt;&lt;br/&gt;                &amp;lt;category android:name="android.intent.category.DEFAULT"&amp;gt;&amp;lt;/category&amp;gt;&lt;br/&gt;            &amp;lt;/intent-filter&amp;gt;&lt;br/&gt;        &amp;lt;/receiver&amp;gt;&lt;br/&gt;    &amp;lt;/application&amp;gt;&lt;br/&gt;    &amp;lt;uses-sdk android:minSdkVersion="7" /&amp;gt;&lt;br/&gt;    &amp;lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"&amp;gt;&amp;lt;/uses-permission&amp;gt;&lt;br/&gt;&amp;lt;/manifest&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=65ce17af-f2bf-8bf7-9756-0ee760f78f9a' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-5075269576456100272?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/5075269576456100272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/03/lanuch-application-as-startup.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5075269576456100272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5075269576456100272'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/03/lanuch-application-as-startup.html' title='Lanuch Application as Startup Application'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-5859087645241050113</id><published>2010-02-26T02:36:00.000-08:00</published><updated>2010-02-26T02:38:34.793-08:00</updated><title type='text'>Http client API  Post method implementation:</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Android client side&lt;br/&gt;&lt;b&gt;1.create simple activity with edit text.&lt;/b&gt;&lt;br/&gt;&lt;font color='#cc0000'&gt;public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        setContentView(R.layout.main);        &lt;br/&gt;        httpHelper = new HttpHelper();&lt;br/&gt;        etContents =(EditText) findViewById(R.id.etContents);&lt;br/&gt;    }&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;2.Create Name Value Pair add parameters user name and  password.  &lt;/b&gt;&lt;br/&gt;&lt;font color='#cc0000'&gt;&lt;br/&gt;List&amp;lt;NameValuePair&amp;gt; nameValuePairs = new ArrayList&amp;lt;NameValuePair&amp;gt;();&lt;br/&gt;            nameValuePairs.add(new BasicNameValuePair("userName", "nava")); &lt;br/&gt;            nameValuePairs.add(new BasicNameValuePair("password", "nav"));&lt;br/&gt;            HttpResponse response = httpHelper.doPost("URLHERE", nameValuePairs);&lt;br/&gt;            &lt;/font&gt;&lt;br/&gt;            &lt;br/&gt;&lt;b&gt;3.Create http post method and set header and entity. Create Default Http Client,Http Context and execute the  http request.&lt;/b&gt;&lt;br/&gt;&lt;font color='#cc0000'&gt;&lt;br/&gt;DefaultHttpClient httpClient;&lt;br/&gt;HttpContext localContext;&lt;br/&gt;HttpPost request = new HttpPost(url);&lt;br/&gt;        HttpResponse response = null;    &lt;br/&gt;        Log.d("Service Call ",url);&lt;br/&gt;        try {&lt;br/&gt;            // Set parameters&lt;br/&gt;            if (parameters != null) {&lt;br/&gt;                request.setHeader("Content-Type", "application/x-www-form-urlencoded");&lt;br/&gt;                request.setEntity(new UrlEncodedFormEntity(parameters)); &lt;br/&gt;            }            &lt;br/&gt;            response = httpClient.execute(request, localContext);&lt;br/&gt;            &lt;br/&gt;            &lt;br/&gt;        } catch (ClientProtocolException e) {&lt;br/&gt;            // put your code here&lt;br/&gt;        } catch (IOException e) {&lt;br/&gt;            // put your code here&lt;br/&gt;        }&lt;/font&gt;&lt;br/&gt;&lt;b&gt;4.Get the response from the server and display the content to edit text&lt;/b&gt;&lt;br/&gt;&lt;font color='#cc0000'&gt;&lt;br/&gt;try {                &lt;br/&gt;                InputStream instream = response.getEntity().getContent();&lt;br/&gt;                content = httpHelper.inconvertibility(instream);&lt;br/&gt;                etContents.setText(content);&lt;br/&gt;            } catch (IllegalStateException e1) {                &lt;br/&gt;                e1.printStackTrace();&lt;br/&gt;            } catch (IOException e1) {                &lt;br/&gt;                e1.printStackTrace();&lt;br/&gt;            }&lt;br/&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Server side implementation:&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;1.create simple web application and that application receive the request parameter.&lt;/b&gt;&lt;br/&gt;&lt;font color='#cc0000'&gt;&lt;br/&gt; public void crmLogin(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {&lt;br/&gt;        String userName = "";&lt;br/&gt;        String password = "";&lt;br/&gt;&lt;br/&gt;        String result = "";&lt;br/&gt;&lt;br/&gt;       &lt;br/&gt;        if (request.getParameter("userName") != null) {&lt;br/&gt;            userName = request.getParameter("userName");&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        if (request.getParameter("password") != null) {&lt;br/&gt;            password = request.getParameter("password");&lt;br/&gt;        }&lt;/font&gt;&lt;br/&gt;&lt;b&gt;2.get the user name and password from the request and set the user name and password to response.&lt;/b&gt;&lt;br/&gt;&lt;font color='#cc0000'&gt;&lt;br/&gt;result="userNamee="+userName+""+"password="+password;&lt;br/&gt;&lt;br/&gt;        response.setContentType("text/plain");&lt;br/&gt;        response.setHeader("Cache-Control", "no-cache");&lt;br/&gt;        try {&lt;br/&gt;            response.getWriter().write(result);&lt;br/&gt;        } catch (Exception e) {&lt;br/&gt;        }&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=ca6b6f1b-f0c9-8c48-88ee-3fc006d7b2ed' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-5859087645241050113?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/5859087645241050113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/02/http-client-api-post-method.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5859087645241050113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/5859087645241050113'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/02/http-client-api-post-method.html' title='Http client API  Post method implementation:'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-383347596437100291</id><published>2010-02-26T02:13:00.000-08:00</published><updated>2010-02-26T02:15:10.172-08:00</updated><title type='text'>Sample SAXParser in Android</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;font face='verdana'&gt;In this aritcle discuss about  “How to properly parse XML  using a SAXParser”.  &lt;br/&gt;&lt;br/&gt;1.Create  a Customized Handler based on the XML&lt;br/&gt;2.Create a ParserHelper Class&lt;br/&gt;3.Implement the parser and get the Data. &lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Create  a Customized Handler based on the XML&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;You can create customized handler using the DefaultHandler class for your xml. &lt;br/&gt;&lt;br/&gt;&lt;i&gt;Step : 1 [Create a Handler which extends DefaultHandler]&lt;/i&gt;&lt;br/&gt; &lt;font color='#990000'&gt;   &lt;/font&gt;&lt;font color='#330000'&gt;&lt;font color='#990000'&gt;class MyDefaultHandler extends DefaultHandler {&lt;br/&gt;    }&lt;/font&gt;    &lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;i&gt;Step : 2 [ Override the Methods and implement the Code]   &lt;/i&gt;     &lt;br/&gt;    &lt;br/&gt;   &lt;font color='#990000'&gt; @Override&lt;br/&gt;    public void startElement(String uri, String localName, String qName,&lt;br/&gt;            Attributes attributes) throws SAXException {&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public void characters(char[] ch, int start, int length)&lt;br/&gt;            throws SAXException {&lt;br/&gt;        _tmpValue = new String(ch, start, length);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public void endElement(String uri, String localName, String qName)&lt;br/&gt;            throws SAXException {&lt;br/&gt;        if (localName.equalsIgnoreCase("uname")) {&lt;br/&gt;            _tmpKey = _tmpValue;&lt;br/&gt;        } else if (localName.equalsIgnoreCase("pwd")) {&lt;br/&gt;            userList.put(_tmpKey.trim(), _tmpValue);&lt;br/&gt;        }&lt;br/&gt;    }&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Create a ParserHelper Class&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;i&gt;Create an instance for customized handler class&lt;/i&gt;&lt;br/&gt;    &lt;font color='#990000'&gt;MyDefaultHandler df = new MyDefaultHandler();    &lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;i&gt;Create an instance for SAXParserFactory,SAXParser and XMLReader&lt;/i&gt;&lt;br/&gt;    &lt;font color='#990000'&gt;SAXParserFactory spf = SAXParserFactory.newInstance();&lt;br/&gt;    SAXParser sp = spf.newSAXParser();&lt;br/&gt;    XMLReader xr = sp.getXMLReader();&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;i&gt;Set the content Handler&lt;/i&gt;&lt;br/&gt;    &lt;font color='#990000'&gt;xr.setContentHandler(df);&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;i&gt;Set the XML Content    &lt;/i&gt;&lt;br/&gt;&lt;b&gt;&lt;u&gt;Type 1:&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;    &lt;font color='#990000'&gt;InputSource is = new InputSource();&lt;br/&gt;    is.setCharacterStream(new StringReader(parseContent));&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;Type 2:&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;  &lt;font color='#990000'&gt;  URL url = new     URL("http://www.DOMAON.com/File.xmll");&lt;/font&gt;&lt;br/&gt;    &lt;br/&gt;    &lt;br/&gt;&lt;i&gt;Parser the XML &lt;/i&gt;&lt;br/&gt;   &lt;font color='#990000'&gt; xr.parse(is);&lt;/font&gt;&lt;b&gt; [For type1] &lt;/b&gt;&lt;br/&gt;   &lt;font color='#990000'&gt; xr.parse(new InputSource(url.openStream()));&lt;/font&gt; &lt;b&gt;[For type2]&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;&lt;u&gt;Implement the parser and get the Data&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;&lt;i&gt;Create an instance for helper class and call the parserContent method&lt;/i&gt;&lt;br/&gt;   &lt;br/&gt;&lt;font color='#990000'&gt;    SAXHelper sh = new SAXHelper();&lt;br/&gt;    sh.parseContent(content);&lt;/font&gt;             &lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;&lt;font color='#660000'&gt;Sample Source&lt;br/&gt;&lt;br/&gt;&lt;/font&gt;&lt;font color='#006600'&gt;MyDefaultHandler.java&lt;/font&gt;&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;br/&gt;&lt;font color='#990000'&gt;class MyDefaultHandler extends DefaultHandler {&lt;br/&gt;&lt;br/&gt;    String _tmpValue = "", _tmpKey = "";&lt;br/&gt;    public HashMap&amp;lt;String, String&amp;gt; userList = new HashMap&amp;lt;String, String&amp;gt;();&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public void startElement(String uri, String localName, String qName,&lt;br/&gt;            Attributes attributes) throws SAXException {&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public void characters(char[] ch, int start, int length)&lt;br/&gt;            throws SAXException {&lt;br/&gt;        _tmpValue = new String(ch, start, length);&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public void endElement(String uri, String localName, String qName)&lt;br/&gt;            throws SAXException {&lt;br/&gt;        if (localName.equalsIgnoreCase("uname")) {&lt;br/&gt;            _tmpKey = _tmpValue;&lt;br/&gt;        } else if (localName.equalsIgnoreCase("pwd")) {&lt;br/&gt;            userList.put(_tmpKey.trim(), _tmpValue);&lt;br/&gt;        }&lt;br/&gt;    }&lt;br/&gt;}&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;&lt;u&gt;&lt;font color='#009900'&gt;SAXHelper.java&lt;/font&gt;&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;&lt;font color='#990000'&gt;public class SAXHelper {    &lt;br/&gt;    public HashMap&amp;lt;String, String&amp;gt; userList = new HashMap&amp;lt;String, String&amp;gt;();&lt;br/&gt;    public void parseContent(String parseContent) {&lt;br/&gt;        MyDefaultHandler df = new MyDefaultHandler();&lt;br/&gt;        try {&lt;br/&gt;            SAXParserFactory spf = SAXParserFactory.newInstance();&lt;br/&gt;            SAXParser sp = spf.newSAXParser();&lt;br/&gt;            XMLReader xr = sp.getXMLReader();            &lt;br/&gt;            xr.setContentHandler(df);&lt;br/&gt;            InputSource is = new InputSource();&lt;br/&gt;            is.setCharacterStream(new StringReader(parseContent));            &lt;br/&gt;            xr.parse(is);            &lt;br/&gt;            userList = df.userList;&lt;br/&gt;        } catch (Exception e) {&lt;br/&gt;            e.printStackTrace();&lt;br/&gt;        }&lt;br/&gt;    }&lt;br/&gt;}&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;&lt;u&gt;&lt;font color='#009900'&gt;Implementation Class&lt;/font&gt;&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;&lt;font color='#990000'&gt;public class MainActivity extends Activity {&lt;br/&gt;    /** Called when the activity is first created. */&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        String content = "&amp;lt;root&amp;gt;&amp;lt;uname&amp;gt;ganesan&amp;lt;/uname&amp;gt;&amp;lt;pwd&amp;gt;pwd2&amp;lt;/pwd&amp;gt; &amp;lt;uname&amp;gt;rama&amp;lt;/uname&amp;gt;&amp;lt;pwd&amp;gt;pwd1&amp;lt;/pwd&amp;gt; &amp;lt;/root&amp;gt;";&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        setContentView(R.layout.main);&lt;br/&gt;        TextView tv = (TextView) findViewById(R.id.TextView01);&lt;br/&gt;        SAXHelper sh = new SAXHelper();&lt;br/&gt;        sh.parseContent(content);&lt;br/&gt;        String data = (String) sh.userList.get("ganesan");&lt;br/&gt;        Log.d("DATA", data);&lt;br/&gt;        tv.setText(data);&lt;br/&gt;&lt;br/&gt;    }&lt;br/&gt;} &lt;/font&gt;   &lt;br/&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=0531b093-a63b-8637-a687-318ac8b489b3' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-383347596437100291?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/383347596437100291/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/02/sample-saxparser-in-android.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/383347596437100291'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/383347596437100291'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/02/sample-saxparser-in-android.html' title='Sample SAXParser in Android'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-139359076361262274</id><published>2010-02-23T19:07:00.000-08:00</published><updated>2010-02-23T19:15:32.568-08:00</updated><title type='text'>Steps to create a Sample TextToSpeech</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;The following steps to help you create a Sample TextToSpeech(TTS) Application&lt;br/&gt;&lt;br/&gt;1. Create a MainActivity which is extends Activity and Implements OnInitListener interface&lt;br/&gt;2. Check the Text Speech Feature using the " TextToSpeech.Engine.ACTION_CHECK_TTS_DATA " or Install the Feature. Ensure your API 1.6 or greater than the 1.6&lt;br/&gt;Because starting with Android 1.6 (API Level 4), the Android platform includes a new Text-to-Speech (TTS) capability. Also known as "speech synthesis", TTS enables your Android device to "speak" text of different languages. &lt;br/&gt;3. Create TextToSpeech instance or installed the TextToSpeech API and create instance. &lt;br/&gt;4. Configure with locale Implementation&lt;br/&gt;5. Call the speak() to test the TTS&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;b&gt;&lt;i&gt;Create a MainActivity which is extends Activity and Implements OnInitListener interface&lt;/i&gt;&lt;/b&gt;&lt;/u&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#330000'&gt;public class MainActivity extends Activity implements OnInitListener {&lt;br/&gt;    /** Called when the activity is first created. */&lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        setContentView(R.layout.main);&lt;br/&gt;        }&lt;br/&gt;        @Override&lt;br/&gt;    public void onInit(int status) {&lt;br/&gt;    }&lt;br/&gt;}&lt;br/&gt;&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;2.&lt;u&gt;&lt;b&gt;&lt;i&gt; Ch&lt;/i&gt;&lt;/b&gt;&lt;i&gt;&lt;b&gt;eck the Text Speech Feature using the " TextToSpeech.Engine.ACTION_CHECK_TTS_DATA " or Install the Feature&lt;/b&gt;&lt;/i&gt;&lt;/u&gt;. Ensure your API 1.6 or greater than the 1.6&lt;br/&gt;Because starting with Android 1.6 (API Level 4), the Android platform includes a new Text-to-Speech (TTS) capability. Also known as "speech synthesis", TTS enables your Android device to "speak" text of different languages. &lt;br/&gt;   &lt;i&gt;&lt;font color='#330000'&gt; Intent checkIntent = new Intent();&lt;br/&gt;        checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);&lt;br/&gt;        startActivityForResult(checkIntent, MY_DATA_CHECK_CODE);&lt;br/&gt;&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;u&gt;&lt;i&gt;&lt;b&gt;3. Create TextToSpeech instance or installed the TextToSpeech API and create instance. &lt;/b&gt;&lt;/i&gt;&lt;/u&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#330000'&gt;private TextToSpeech mTts;&lt;br/&gt;    protected void onActivityResult(&lt;br/&gt;            int requestCode, int resultCode, Intent data) {&lt;br/&gt;        if (requestCode == MY_DATA_CHECK_CODE) {&lt;br/&gt;            if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {&lt;br/&gt;                // success, create the TTS instance&lt;br/&gt;                mTts = new TextToSpeech(this, this);&lt;br/&gt;            } else {&lt;br/&gt;                // missing data, install it&lt;br/&gt;                Intent installIntent = new Intent();&lt;br/&gt;                installIntent.setAction(&lt;br/&gt;                    TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);&lt;br/&gt;                startActivity(installIntent);&lt;br/&gt;            }&lt;br/&gt;        }&lt;br/&gt;    }&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;i&gt;&lt;b&gt;4. Configure with locale Implementation&lt;/b&gt;&lt;/i&gt;&lt;/u&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#330000'&gt;    @Override&lt;br/&gt;    public void onInit(int status) {&lt;br/&gt;        mTts.setLanguage(Locale.US);    &lt;br/&gt;    }&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;i&gt;&lt;b&gt;5. Call the speak() to test the TTS&lt;/b&gt;&lt;/i&gt;&lt;/u&gt;&lt;br/&gt;  &lt;i&gt;&lt;font color='#330000'&gt;  mTts.speak("hai this is for testing, Karhtik is testing this application", TextToSpeech.QUEUE_FLUSH, null);&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;&lt;u&gt;&lt;i&gt;&lt;b&gt;6. Sample Code&lt;/b&gt;&lt;/i&gt;&lt;/u&gt;&lt;br/&gt;&lt;i&gt;&lt;font color='#330000'&gt;public class MainActivity extends Activity implements OnInitListener {&lt;br/&gt;    int MY_DATA_CHECK_CODE = 1;&lt;br/&gt;    private TextToSpeech mTts;&lt;br/&gt;    &lt;br/&gt;    @Override&lt;br/&gt;    public void onCreate(Bundle savedInstanceState) {&lt;br/&gt;        super.onCreate(savedInstanceState);&lt;br/&gt;        setContentView(R.layout.main);&lt;br/&gt;        Intent checkIntent = new Intent();&lt;br/&gt;        checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);&lt;br/&gt;        startActivityForResult(checkIntent, MY_DATA_CHECK_CODE);&lt;br/&gt;    }&lt;br/&gt;    &lt;br/&gt;&lt;br/&gt;    protected void onActivityResult(&lt;br/&gt;            int requestCode, int resultCode, Intent data) {&lt;br/&gt;        if (requestCode == MY_DATA_CHECK_CODE) {&lt;br/&gt;            if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {&lt;br/&gt;                // success, create the TTS instance&lt;br/&gt;                mTts = new TextToSpeech(this, this);&lt;br/&gt;            } else {&lt;br/&gt;                // missing data, install it&lt;br/&gt;                Intent installIntent = new Intent();&lt;br/&gt;                installIntent.setAction(&lt;br/&gt;                    TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);&lt;br/&gt;                startActivity(installIntent);&lt;br/&gt;            }&lt;br/&gt;        }&lt;br/&gt;    }&lt;br/&gt;&lt;br/&gt;    @Override&lt;br/&gt;    public void onInit(int status) {&lt;br/&gt;        mTts.setLanguage(Locale.US);&lt;br/&gt;        mTts.speak("hai this is for testing, Karhtik is testing this application", TextToSpeech.QUEUE_FLUSH, null);&lt;br/&gt;    }&lt;br/&gt;}&lt;/font&gt;&lt;/i&gt;&lt;br/&gt;&lt;br/&gt;Hope this is helpful for you. &lt;br/&gt;&lt;br/&gt;&lt;div class='zemanta-pixie'&gt;&lt;img src='http://img.zemanta.com/pixy.gif?x-id=66bb6840-a3c3-8ea4-bc86-680169918624' alt='' class='zemanta-pixie-img'/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5749561464469791346-139359076361262274?l=about-android.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://about-android.blogspot.com/feeds/139359076361262274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://about-android.blogspot.com/2010/02/steps-to-create-sample-texttospeech.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/139359076361262274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5749561464469791346/posts/default/139359076361262274'/><link rel='alternate' type='text/html' href='http://about-android.blogspot.com/2010/02/steps-to-create-sample-texttospeech.html' title='Steps to create a Sample TextToSpeech'/><author><name>Ganesan Shanmugam Pillai</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://4.bp.blogspot.com/_Y3dHlWzBWgA/TOSSi-DmSBI/AAAAAAAACuA/2SogljSmuF0/S220/DSCN0004.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5749561464469791346.post-4878461438484708593</id><published>2010-02-23T08:51:00.000-08:00</published><updated>2010-02-23T08:56:41.918-08:00</updated><title type='text'>Android Remote Service Sample</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;The following article used to create a remote service &lt;br/&gt;&lt;big&gt;&lt;b&gt;&lt;big&gt;&lt;font color='#003333'&gt;1.Create a Project Called RSDemo. &lt;/font&gt;&lt;/big&gt;&lt;/b&gt;&lt;/big&gt;&lt;br/&gt;&lt;img src='http://lh5.ggpht.com/_Y3dHlWzBWgA/S4QDKBAMaeI/AAAAAAAABtA/XZ-ab85Hv1k/%5BUNSET%5D.jpg?imgmax=800' style='max-width: 800px;'/&gt;&lt;br/&gt;&lt;b&gt;&lt;big&gt;&lt;big&gt;&lt;font color='#003333'&gt;&lt;br/&gt;2.Create a aidl in your IDE &lt;/font&gt;&lt;/big&gt;&lt;/big&gt;&lt;/b&gt;: &lt;br/&gt;&lt;font color='#330000'&gt;&lt;b&gt;AIDL (Android Interface Definition Language)&lt;/b&gt; i&lt;/font&gt;s an &lt;a href='http://en.wikipedia.org/wiki/Interface_description_language'&gt;IDL&lt;/a&gt;&lt;br/&gt;language used to generate code that enables two processes on an Android-powered device&lt;br/&gt;to talk using interprocess communication (IPC). If you have code&lt;br/&gt;in one process (for example, in an Activity) that needs to call methods on an&lt;br/&gt;object in another process (for example, a Service), you would use AIDL to&lt;br/&gt;generate code to marshall the parameters.&lt;br/&gt;&lt;br/&gt;&lt;img src='http://lh5.ggpht.com/_Y3dHlWzBWgA/S4QD2NLormI/AAAAAAAABtE/R7Pel2dUkfU/%5BUNSET%5D.jpg?imgmax=800' style='max-width: 800px;'/&gt;&lt;br/&gt;&lt;br/&gt;&lt;img src='http://lh3.ggpht.com/_Y3dHlWzBWgA/S4QEEqxcDrI/AAAAAAAABtI/FiJoT6W_dfs/%5BUNSET%5D.jpg?imgmax=800' style='max-width: 800px;'/&gt;&lt;br/&gt;&lt;br/&gt;&lt;img src='http://lh4.ggpht.com/_Y3dHlWzBWgA/S4QEOFbDrEI/AAAAAAAABtM/NK3rN7Om76U/%5BUNSET%5D.jpg?imgmax=800' style='max-width: 800px;'/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;AIDL is a simple syntax that lets you declare an interface with one or more    methods, that can take parameters and return values. These parameters and return    values can be of any type, even other AIDL-generated interfaces.  &lt;em&gt;However, it    is important to note&lt;/em&gt; that you &lt;em&gt;must&lt;/em&gt; import all non-built-in types,    &lt;em&gt;even if they are defined in the same package as your interface&lt;/em&gt;.&lt;/p&gt;&lt;b&gt;&lt;u&gt;Sample AIDL File &lt;/u&gt;&lt;/b&gt;&lt;br/&gt;package &amp;lt;&amp;lt;&amp;lt;YOUR PROJECT  PACKAGE &amp;gt;&amp;gt;&amp;gt;;&lt;br/&gt;interface IMyService {&lt;br/&gt;            int getStatus();&lt;br/&gt; }&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;&lt;big&gt;&lt;big&gt;&lt;font color='#003333'&gt;3. Ensure the Stub file in gen Folder. &lt;/font&gt;&lt;/big&gt;&lt;/big&gt;&lt;/b&gt;&lt;br/&gt;&lt;img src='http://lh4.ggpht.com/_Y3dHlWzBWgA/S4QGb0Z05RI/AAAAAAAABtQ/3z18QNeuBGU/%5BUNSET%5D.jpg?imgmax=800' style='max-width: 800px;'/&gt;&lt;br/&gt;  	 	 	 	&lt;style type='text/css'&gt; 	 	&lt;/style&gt;  &lt;p lang='en-US' style='margin-bottom: 0in; page-break-before: always;'&gt; &lt;font color='#008080'&gt;&lt;font face='Verdana'&gt;&lt;font size='3'&gt;&lt;b&gt;4. Create Service and create an instance for the stub class&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p lang='en-US' style='margin-bottom: 0in; page-break-before: always;'&gt;   	 	 	 	&lt;style type='text/css'&gt; 	 	&lt;/style&gt;  &lt;/p&gt;&lt;p lang='en-US' style='margin-bottom: 0in;'&gt;&lt;br/&gt;&lt;/p&gt; &lt;ol&gt;&lt;li&gt;&lt;p lang='en-US' style='margin-bottom: 0in; font-weight: normal;'&gt; 	&lt;font face='Verdana'&gt;&lt;font size='2' style='font-size: 11pt;'&gt;&lt;i&gt;Create 	a Service Class&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; 	&lt;/li&gt;&lt;li&gt;&lt;p lang='en-US' style='margin-bottom: 0in; font-weight: normal;'&gt; 	&lt;font face='Verdana'&gt;&lt;font size='2' style='font-size: 11pt;'&gt;&lt;i&gt;Create 	a instance for stub class with implmentation&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; 	&lt;/li&gt;&lt;li&gt;&lt;p lang='en-US' style='margin-bottom: 0in; font-weight: normal;'&gt; 	&lt;font face='Verdana'&gt;&lt;font size='2' style='font-size: 11pt;'&gt;&lt;i&gt;Return 	the instance while calling the IBind Method. &lt;/i&gt;&lt;/font&gt;&lt;/font&gt; 	&lt;/p&gt; &lt;/li&gt;&lt;/ol&gt;&lt;br/&gt;&lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;class&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; MyRemoteCounterService &lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;extends&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; Service {&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;	&lt;/font&gt;&lt;/font&gt;&lt;font color='#3f5fbf'&gt;&lt;font face='Courier New, monospace'&gt;/**&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#3f5fbf'&gt;&lt;font face='Courier New, monospace'&gt;	 * &lt;/font&gt;&lt;/font&gt;&lt;font color='#7f9fbf'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;@see&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#3f5fbf'&gt;&lt;font face='Courier New, monospace'&gt; android.app.Service#onBind(Intent)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#3f5fbf'&gt;&lt;font face='Courier New, monospace'&gt;	 */&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;br/&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;	&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;private&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt; IMyService.Stub &lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;imyserviceStub&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt; = &lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;new&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt; IMyService.Stub() &lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;span lang='en-US'&gt;&lt;u&gt;&lt;b&gt;	&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;{&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;		&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#646464'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;@Override&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;		&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;public&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt; &lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;int&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt; getStatus() &lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;throws&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt; RemoteException {&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;			&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;return&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt; 1;&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;		}&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;	};&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;br/&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;	&lt;/font&gt;&lt;/font&gt;&lt;font color='#646464'&gt;&lt;font face='Courier New, monospace'&gt;@Override&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;	&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; IBinder onBind(Intent intent) {&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;		Log.&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;i&gt;d&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;(&lt;/font&gt;&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;font face='Courier New, monospace'&gt;"REMOTE SERVICE "&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;, &lt;/font&gt;&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;font face='Courier New, monospace'&gt;"INVOKED"&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;		&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;return&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt; &lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;&lt;b&gt;imyserviceStub&lt;/b&gt;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;u&gt;;&lt;/u&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;	}&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;br/&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;	&lt;/font&gt;&lt;/font&gt;&lt;font color='#646464'&gt;&lt;font face='Courier New, monospace'&gt;@Override&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;	&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;void&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; onCreate() {&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;		&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;super&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;.onCreate();&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;	}&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;br/&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;	&lt;/font&gt;&lt;/font&gt;&lt;font color='#646464'&gt;&lt;font face='Courier New, monospace'&gt;@Override&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;	&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;void&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; onStart(Intent intent, &lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;int&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; startId) {&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;		&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;super&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;.onStart(intent, startId);&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;	}&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;br/&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;	&lt;/font&gt;&lt;/font&gt;&lt;font color='#646464'&gt;&lt;font face='Courier New, monospace'&gt;@Override&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;	&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;void&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; onDestroy() {&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;		&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;super&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;.onDestroy();&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;	}&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p/&gt;&lt;b&gt;&lt;big&gt;&lt;big&gt;&lt;font color='#003333'&gt;&lt;br/&gt;5. Create a Client Class Access the Service. &lt;/font&gt;&lt;/big&gt;&lt;/big&gt;&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;1.Create instances for Button for invoking and release the Connection&lt;br/&gt;2. Create a class Service Connector using the ServiceConnector Interface. &lt;br/&gt;3. Create a Instance for SeviceConnector and Stub class&lt;br/&gt;4. Bind the service using the bindService()&lt;br/&gt;5. Invoke the Service&lt;br/&gt;&lt;br/&gt;&lt;i&gt;&lt;u&gt;Create a class Service Connector using the ServiceConnector Interface   	&lt;/u&gt;&lt;/i&gt; 	 	 	&lt;style type='text/css'&gt; 	 	&lt;/style&gt;  &lt;p style='background: rgb(204, 204, 204) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;class&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; MyServiceStatus &lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;implements&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; ServiceConnection {&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(204, 204, 204) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;		&lt;/font&gt;&lt;/font&gt;&lt;font color='#646464'&gt;&lt;font face='Courier New, monospace'&gt;@Override&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(204, 204, 204) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;		&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;void&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; onServiceConnected(ComponentName arg0, &lt;/font&gt;&lt;/font&gt; &lt;/p&gt; &lt;p style='background: rgb(204, 204, 204) none repeat scroll 0% 0%; margin-left: 0.29in; text-indent: 0.29in; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;IBinder arg1) {&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(204, 204, 204) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;			&lt;/font&gt;&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;font face='Courier New, monospace'&gt;iMyService&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; = IMyService.Stub.&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;i&gt;asInterface&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;((IBinder)arg1);&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(204, 204, 204) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;			Log.&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;i&gt;d&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;(&lt;/font&gt;&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;font face='Courier New, monospace'&gt;"@G RemoteService"&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;font face='Courier New, monospace'&gt;"Connected"&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;);		&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(204, 204, 204) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;		}&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(204, 204, 204) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;		&lt;/font&gt;&lt;/font&gt;&lt;font color='#646464'&gt;&lt;font face='Courier New, monospace'&gt;@Override&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(204, 204, 204) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;		&lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;public&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;void&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; onServiceDisconnected(ComponentName name) {&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(204, 204, 204) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;			&lt;/font&gt;&lt;/font&gt;&lt;font color='#0000c0'&gt;&lt;font face='Courier New, monospace'&gt;iMyService&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt; = &lt;/font&gt;&lt;/font&gt;&lt;font color='#7f0055'&gt;&lt;font face='Courier New, monospace'&gt;&lt;b&gt;null&lt;/b&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(204, 204, 204) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;			Log.&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;&lt;i&gt;d&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;(&lt;/font&gt;&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;font face='Courier New, monospace'&gt;"@G RemoteService"&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;,&lt;/font&gt;&lt;/font&gt;&lt;font color='#2a00ff'&gt;&lt;font face='Courier New, monospace'&gt;"DisConnected"&lt;/font&gt;&lt;/font&gt;&lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;);&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style='background: rgb(204, 204, 204) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;		}&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p align='LEFT' style='background: rgb(204, 204, 204) none repeat scroll 0% 0%; margin-bottom: 0in; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; widows: 0; orphans: 0;'&gt; &lt;font color='#000000'&gt;&lt;font face='Courier New, monospace'&gt;}&lt;/font&gt;&lt;/font&gt;&lt;font face='Verdana'&gt;&lt;font size='2' style='font-size: 11pt;'&gt;&lt;span lang='en-US'&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt; &lt;/p&gt; &lt;br/&gt;&lt;i&gt;&lt;u&gt;Create a Instance for SeviceConnector and Stub class&lt;/u&gt;&lt;/i&gt;&lt;br/&gt;  	 	 	 	&lt;style type='text/css'&gt; 	 	&lt;/style&gt;  &lt;p style='background: rgb(230, 230, 230) none repeat scroll 0% 0
