<?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:blogger='http://schemas.google.com/blogger/2008' 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-4488365782025760635</id><updated>2024-11-01T05:01:26.507-07:00</updated><category term="Tips and Tricks"/><category term="Android Environment"/><category term="Errors and Exceptions"/><title type='text'>Android Ideas</title><subtitle type='html'>Android learning experience, tips and more...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>26</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-1675768868522877421</id><published>2012-09-28T13:50:00.001-07:00</published><updated>2012-10-03T08:37:36.660-07:00</updated><title type='text'>No resource identifier found for attribute &amp;#39;indicator_gravity&amp;#39; in package ….</title><content type='html'>I was trying to porting the &lt;a href=&quot;http://code.google.com/p/tree-view-list-android/&quot; target=&quot;_blank&quot;&gt;Tree-View-List-Android&lt;/a&gt; into my project recently. I have created a project called com.dotnetideas.treeview and added everything in. I can run the demo without any issue. But when I use it in another project, I kept getting “No resource identifier found for attribute &#39;indicator_gravity&#39; in package com.dotnetideas.treeview” in main_demo.xml.&lt;br /&gt;
Here is the xml looks like. &lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;
&lt;pre id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;xml&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;1.0&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;encoding&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;utf-8&quot;&lt;/span&gt;?&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;LinearLayout&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;xmlns:android&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;http://schemas.android.com/apk/res/android&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;xmlns:treeView&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;http://schemas.android.com/apk/res/com.dotnetideas.treeview&quot;&lt;/span&gt;
﻿  &lt;span style=&quot;color: red;&quot;&gt;android:orientation&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;vertical&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;android:layout_width&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;fill_parent&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;android:layout_height&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;fill_parent&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
﻿  &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;ListView&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;android:layout_width&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;0dip&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;android:layout_height&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;0dip&quot;&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;android:scrollbars&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;vertical&quot;&lt;/span&gt;
﻿  ﻿  &lt;span style=&quot;color: red;&quot;&gt;android:visibility&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;gone&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;&amp;lt;!-- Just to test some attributes in IDE --&amp;gt;&lt;/span&gt;
﻿  &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;ListView&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;
﻿  &lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;pl.polidea.treeview.TreeViewList&lt;/span&gt; android:id=&quot;@+id/mainTreeView&quot; android:layout_width=&quot;fill_parent&quot;
﻿  ﻿  android:layout_height=&quot;fill_parent&quot; treeView:indicator_gravity=&quot;right|center_vertical&quot;
﻿  ﻿  android:scrollbars=&quot;vertical&quot; android:smoothScrollbar=&quot;true&quot;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;LinearLayout&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
Although I followed the old code to changed the xml namespace from xmlns:treeView=&lt;a href=&quot;http://schemas.android.com/apk/res/pl.polidea.treeview&quot;&gt;http://schemas.android.com/apk/res/pl.polidea.treeview&lt;/a&gt; to xmlns:treeView=&lt;a href=&quot;http://schemas.android.com/apk/res/com.dotnetideas.treeview&quot;&gt;http://schemas.android.com/apk/res/com.dotnetideas.treeview&lt;/a&gt;. It doesn’t seem like valid xml namespace. It turned out that the namespace needs to be &lt;a href=&quot;xmlns:treeView=&amp;quot;http://com.dotnetideas.treeview/apk/res/treeview&amp;quot;&quot; title=&quot;xmlns:treeView=&amp;quot;http://com.dotnetideas.treeview/apk/res/treeview&amp;quot;&quot;&gt;xmlns:treeView=&quot;&lt;/a&gt;&lt;a href=&quot;http://schemas.android.com/apk/res/com.dotnetideas.treeview&quot;&gt;http://schemas.android.com/apk/res&lt;/a&gt;-auto&quot; if we reference as a library project.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/1675768868522877421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2012/09/no-resource-identifier-found-for.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/1675768868522877421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/1675768868522877421'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2012/09/no-resource-identifier-found-for.html' title='No resource identifier found for attribute &amp;#39;indicator_gravity&amp;#39; in package ….'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-6141733837717015809</id><published>2011-07-12T08:38:00.000-07:00</published><updated>2011-08-30T08:39:15.881-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>AlarmManager and NotificationManager sample code</title><content type='html'>&lt;h4&gt;This is not a complete tutorial on how to use AlarmManager and NotificationManager, but a simple sample.&lt;/h4&gt;The scenario is I want to have an alarm set to certain time. When it goes off, it show notification icon on status bar. When click on the notification, it will start an activity.&lt;br&gt; &lt;h2&gt;1. Create the BroadcastReceiver&lt;/h2&gt; &lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;span style=&quot;color: blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;class&lt;/span&gt; AlarmReceiver &lt;span style=&quot;color: blue&quot;&gt;extends&lt;/span&gt; BroadcastReceiver {
    @Override
    &lt;span style=&quot;color: blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;void&lt;/span&gt; onReceive(Context context, Intent intent) {
        NotificationManager mNM;
        mNM = (NotificationManager)context.getSystemService(context.NOTIFICATION_SERVICE);
        &lt;span style=&quot;color: green&quot;&gt;// Set the icon, scrolling text and timestamp&lt;/span&gt;
        Notification notification = &lt;span style=&quot;color: blue&quot;&gt;new&lt;/span&gt; Notification(R.drawable.icon, &lt;span style=&quot;color: #006080&quot;&gt;&quot;Test Alarm&quot;&lt;/span&gt;,
        System.currentTimeMillis());
        &lt;span style=&quot;color: green&quot;&gt;// The PendingIntent to launch our activity if the user selects this notification&lt;/span&gt;
        PendingIntent contentIntent = PendingIntent.getActivity(context, 0, &lt;span style=&quot;color: blue&quot;&gt;new&lt;/span&gt; Intent(context, TestActivity.&lt;span style=&quot;color: blue&quot;&gt;class&lt;/span&gt;), 0);
        &lt;span style=&quot;color: green&quot;&gt;// Set the info for the views that show in the notification panel.&lt;/span&gt;
        notification.setLatestEventInfo(context, context.getText(R.string.alarm_service_label), &lt;span style=&quot;color: #006080&quot;&gt;&quot;This is a Test Alarm&quot;&lt;/span&gt;, contentIntent);
        &lt;span style=&quot;color: green&quot;&gt;// Send the notification.&lt;/span&gt;
        &lt;span style=&quot;color: green&quot;&gt;// We use a layout id because it is a unique number. We use it later to cancel.&lt;/span&gt;
        mNM.notify(R.string.alarm_service_label, notification);
    }
}&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;h2&gt;2. Add Receiver to Manifest.xml&lt;/h2&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;span style=&quot;color: blue&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon&quot;&gt;receiver&lt;/span&gt; &lt;span style=&quot;color: red&quot;&gt;android:process&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;=&quot;:remote&quot;&lt;/span&gt; &lt;span style=&quot;color: red&quot;&gt;android:name&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;=&quot;AlarmReceiver&quot;&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon&quot;&gt;receiver&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;h2&gt;3. Set the alarm&lt;/h2&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;span style=&quot;color: blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;class&lt;/span&gt; AlarmService {
    &lt;span style=&quot;color: blue&quot;&gt;private&lt;/span&gt; Context context;
    &lt;span style=&quot;color: blue&quot;&gt;private&lt;/span&gt; PendingIntent mAlarmSender;
    &lt;span style=&quot;color: blue&quot;&gt;public&lt;/span&gt; AlarmService(Context context) {
        &lt;span style=&quot;color: blue&quot;&gt;this&lt;/span&gt;.context = context;
        mAlarmSender = PendingIntent.getBroadcast(context, 0, &lt;span style=&quot;color: blue&quot;&gt;new&lt;/span&gt; Intent(context, AlarmReceiver.&lt;span style=&quot;color: blue&quot;&gt;class&lt;/span&gt;), 0);
    }

    &lt;span style=&quot;color: blue&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;void&lt;/span&gt; startAlarm(){
        &lt;span style=&quot;color: green&quot;&gt;//Set the alarm to 10 seconds from now&lt;/span&gt;
        Calendar c = Calendar.getInstance();
        c.add(Calendar.SECOND, 10);
        &lt;span style=&quot;color: blue&quot;&gt;long&lt;/span&gt; firstTime = c.getTimeInMillis();
        &lt;span style=&quot;color: green&quot;&gt;// Schedule the alarm!&lt;/span&gt;
        AlarmManager am = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
        am.set(AlarmManager.RTC_WAKEUP, firstTime, mAlarmSender);
    }
}&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;  </content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/6141733837717015809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2011/07/alarmmanager-and-notificationmanager.html#comment-form' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/6141733837717015809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/6141733837717015809'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2011/07/alarmmanager-and-notificationmanager.html' title='AlarmManager and NotificationManager sample code'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-8592717990610259534</id><published>2011-07-12T07:51:00.001-07:00</published><updated>2011-08-30T07:52:37.673-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>How to use and customize tab(image, font)?</title><content type='html'>&lt;h2&gt;1. Create tabs&lt;/h2&gt; &lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br&gt;TabHost tabHost = getTabHost(); &lt;span style=&quot;color: #008000&quot;&gt;// The activity TabHost&lt;/span&gt;&lt;br&gt;TabHost.TabSpec spec; &lt;span style=&quot;color: #008000&quot;&gt;// Resusable TabSpec for each tab&lt;/span&gt;&lt;br&gt;Intent intent; &lt;span style=&quot;color: #008000&quot;&gt;// Reusable Intent for each tab&lt;/span&gt;&lt;br&gt;&lt;span style=&quot;color: #008000&quot;&gt;// Create an Intent to launch an Activity for the tab (to be reused)&lt;/span&gt;&lt;br&gt;intent = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; Intent().setClass(&lt;span style=&quot;color: #0000ff&quot;&gt;this&lt;/span&gt;, TaskActivity.&lt;span style=&quot;color: #0000ff&quot;&gt;class&lt;/span&gt;);&lt;br&gt;&lt;span style=&quot;color: #008000&quot;&gt;// Initialize a TabSpec for each tab and add it to the TabHost&lt;/span&gt;&lt;br&gt;spec = tabHost.newTabSpec(&lt;span style=&quot;color: #006080&quot;&gt;&quot;task&quot;&lt;/span&gt;).setIndicator(&lt;span style=&quot;color: #006080&quot;&gt;&quot;Task&quot;&lt;/span&gt;, null).setContent(intent);&lt;br&gt;tabHost.addTab(spec); &lt;span style=&quot;color: #008000&quot;&gt;// Do the same for the other tabs&lt;/span&gt;&lt;br&gt;intent = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; Intent().setClass(&lt;span style=&quot;color: #0000ff&quot;&gt;this&lt;/span&gt;, CalendarActivity.&lt;span style=&quot;color: #0000ff&quot;&gt;class&lt;/span&gt;);&lt;br&gt;spec = tabHost.newTabSpec(&lt;span style=&quot;color: #006080&quot;&gt;&quot;calendar&quot;&lt;/span&gt;).setIndicator(&lt;span style=&quot;color: #006080&quot;&gt;&quot;Calendar&quot;&lt;/span&gt;, null).setContent(intent);&lt;br&gt;tabHost.addTab(spec); &lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;h2&gt;2. Customize tabs&lt;/h2&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br&gt;&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;TabHost tabHost = getTabHost();&lt;br&gt;LinearLayout linearLayout = (LinearLayout) tabHost.getChildAt(0); &lt;br&gt;TabWidget tw = (TabWidget) linearLayout .getChildAt(0);&lt;br&gt;RelativeLayoutfirstTabLayout = (RelativeLayout) tw.getChildAt(0); &lt;br&gt;&lt;span style=&quot;color: #008000&quot;&gt;//First tab&lt;/span&gt;&lt;br&gt;TextViewtabHeader = (TextView) firstTabLayout .getChildAt(1); &lt;br&gt;tabHeader .setTextSize(18); &lt;span style=&quot;color: #008000&quot;&gt;//Change text size&lt;/span&gt;&lt;br&gt;tabHost.getTabWidget().getChildAt(0).getLayoutParams().height = 36; &lt;br&gt;&lt;span style=&quot;color: #008000&quot;&gt;//Change first tab header height&lt;/span&gt;&lt;br&gt;firstTabLayout.setBackgroundResource(R.drawable.group_background_overdue);&lt;br&gt;tabHeader.setText(&lt;span style=&quot;color: #006080&quot;&gt;&quot;Tab page 1&quot;&lt;/span&gt;);&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;  </content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/8592717990610259534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2011/07/how-to-use-and-customize-tabimage-font.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/8592717990610259534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/8592717990610259534'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2011/07/how-to-use-and-customize-tabimage-font.html' title='How to use and customize tab(image, font)?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-7690845900776202846</id><published>2011-07-12T07:51:00.000-07:00</published><updated>2011-08-30T07:52:01.261-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>How to sort array list?</title><content type='html'>&lt;h2&gt;Sort by simple type property&lt;/h2&gt; &lt;p&gt;1. Implement the Comparable interface&lt;/p&gt; &lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;class&lt;/span&gt; Item &lt;span style=&quot;color: #0000ff&quot;&gt;implements&lt;/span&gt; Comparable&amp;lt;Item&amp;gt; {&lt;br&gt;…&lt;br&gt;}&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;2. Implement the compareTo method. &lt;/p&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br&gt;@Override&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; compareTo(Item another) {&lt;br&gt;    &lt;span style=&quot;color: #008000&quot;&gt;//Compare the name&lt;/span&gt;&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;this&lt;/span&gt;.name.compareTo(another.name);&lt;br&gt;}&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;3. Call sort&lt;/p&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br&gt;List&amp;lt;Item&amp;gt; items = ..&lt;br&gt;items.sort();&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;h2&gt;Sort by user defined property&lt;/h2&gt;
&lt;p&gt;1. Create a new class&lt;/p&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;import&lt;/span&gt; java.util.Comparator;&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;class&lt;/span&gt; ItemCompareByLocation &lt;span style=&quot;color: #0000ff&quot;&gt;implements&lt;/span&gt; Comparator&amp;lt;Item&amp;gt;{&lt;br&gt;    @Override&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; compare(Item arg0, Item arg1) {&lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; arg0.getLocation().compareTo(arg1.getLocation());&lt;br&gt;    }&lt;br&gt;}&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;2. Call sort&lt;/p&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br&gt;Collections.sort(items, &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; ItemCompareByLocation());&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;  </content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/7690845900776202846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2011/07/how-to-sort-array-list.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/7690845900776202846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/7690845900776202846'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2011/07/how-to-sort-array-list.html' title='How to sort array list?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-3529016792777214037</id><published>2011-07-12T07:50:00.000-07:00</published><updated>2011-08-30T07:51:06.839-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>How to use Style</title><content type='html'>&lt;h2&gt;Create style.xml&lt;/h2&gt; &lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;xml&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;1.0&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;encoding&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;utf-8&quot;&lt;/span&gt;?&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;resources&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;style&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;DetailTextView&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;parent&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;@android:style/TextAppearance&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;android:layout_width&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;wrap_content&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;android:layout_height&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;wrap_content&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;android:textSize&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;14sp&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;android:textStyle&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;bold&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;style&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;DateTimeButton&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;parent&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;@android:style/Widget.Button&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;android:layout_width&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;fill_parent&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;android:layout_height&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;wrap_content&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;android:gravity&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;left|center_vertical&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;android:textSize&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;19sp&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;item&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;resources&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;h2&gt;Use it in layout&lt;/h2&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;TextView&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;android:id&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;@+id/TextView01&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;android:text&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;What&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;@style/DetailTextView&quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;  </content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/3529016792777214037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2011/07/how-to-use-style.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/3529016792777214037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/3529016792777214037'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2011/07/how-to-use-style.html' title='How to use Style'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-6868401149470183775</id><published>2011-07-12T07:00:00.000-07:00</published><updated>2011-08-30T07:01:20.612-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>How to show toast?</title><content type='html'>&lt;h2&gt;Simple toast:&lt;/h2&gt; &lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br&gt;Context context = getApplicationContext();&lt;br&gt;CharSequence text = &lt;span style=&quot;color: #006080&quot;&gt;&quot;Hello toast!&quot;&lt;/span&gt;;&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; duration = Toast.LENGTH_SHORT;&lt;br&gt;Toast toast = Toast.makeText(context, text, duration);&lt;br&gt;toast.show();&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;h2&gt;Customized toast:&lt;/h2&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br&gt;LayoutInflater inflater;&lt;br&gt;inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);&lt;br&gt;View layout = inflater.inflate(R.layout.detail_toast, &lt;br&gt;(ViewGroup)arg0.findViewById(R.id.toast_layout_root));&lt;br&gt;TextView taskTextView = (TextView) &lt;br&gt;layout.findViewById(R.id.taskTextView);&lt;br&gt;taskTextView.setText(task.getName());&lt;br&gt;TextView detailTextView = (TextView) &lt;br&gt;layout.findViewById(R.id.detailTextView);&lt;br&gt;detailTextView.setText(sb.toString());&lt;br&gt;Toast toast = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; Toast(context.getApplicationContext());&lt;br&gt;toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);&lt;br&gt;toast.setDuration(Toast.LENGTH_LONG);&lt;br&gt;toast.setView(layout);&lt;br&gt;toast.show();&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;  </content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/6868401149470183775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2011/07/how-to-show-toast.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/6868401149470183775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/6868401149470183775'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2011/07/how-to-show-toast.html' title='How to show toast?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-1710023460190730734</id><published>2010-11-10T05:56:00.000-08:00</published><updated>2011-08-30T06:59:03.489-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Errors and Exceptions"/><title type='text'>How to customize control</title><content type='html'>&lt;p&gt;There are some icons and xmls under C:\Android\android-sdk-windows-1.6_r1\platforms\android-1.5(or other version)\data\res\drawable&lt;/p&gt; &lt;p&gt;To use different icons for standard control, we can copy the xml file and icons used in the xml to our own \drawable folder and set it in the layout xml&lt;/p&gt; &lt;p&gt;1) Grab the checkbox_background.xml and checkbox.xml from above folder and copy to the drawable folder in my project&lt;/p&gt; &lt;p&gt;2) Copy all the PNG files for the checkbox to the drawable folder in my project&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://lh4.ggpht.com/-F2pkOrdMONY/TlzsaxZYB1I/AAAAAAAAAis/j-RHEnOvndI/s1600-h/image2.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;http://lh3.ggpht.com/-pxnt9gI2DEk/TlzsbFs-bSI/AAAAAAAAAiw/B94HCrKgSP4/image_thumb.png?imgmax=800&quot; width=&quot;244&quot; height=&quot;173&quot;&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;3) Change the layout to use the checkbox (In my case, it is a CheckedTextView)&lt;/p&gt; &lt;p&gt;android:checkMark=&quot;@drawable/checkbox&quot;&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://lh4.ggpht.com/-jyGctEwqZpQ/TlzsbSwiwHI/AAAAAAAAAi0/Nrvc2Nj-We0/s1600-h/image5.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;http://lh4.ggpht.com/-5zmt283wbUc/TlzsbhVZVoI/AAAAAAAAAi4/HcCOEpcf6Y4/image_thumb1.png?imgmax=800&quot; width=&quot;184&quot; height=&quot;77&quot;&gt;&lt;/a&gt;&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/1710023460190730734/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/11/how-to-customize-control.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/1710023460190730734'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/1710023460190730734'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/11/how-to-customize-control.html' title='How to customize control'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-pxnt9gI2DEk/TlzsbFs-bSI/AAAAAAAAAiw/B94HCrKgSP4/s72-c/image_thumb.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-5279986114468244643</id><published>2010-10-25T06:50:00.000-07:00</published><updated>2011-08-30T06:59:54.702-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Errors and Exceptions"/><title type='text'>java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap</title><content type='html'>&lt;p&gt;Recently our two applications on Android Market kept reporting error “java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap…”. If you look at the stack trace, there is no trace of our code. Below is one of the stack trace:&lt;/p&gt; &lt;p&gt;java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@4478a900 &lt;br&gt;at android.graphics.Canvas.throwIfRecycled(Canvas.java:955) &lt;br&gt;at android.graphics.Canvas.drawBitmap(Canvas.java:1044) &lt;br&gt;at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:323) &lt;br&gt;at android.widget.ImageView.onDraw(ImageView.java:842) &lt;br&gt;at android.view.View.draw(View.java:6740) &lt;br&gt;at android.view.ViewRoot.draw(ViewRoot.java:1407) &lt;br&gt;at android.view.ViewRoot.performTraversals(ViewRoot.java:1163) &lt;br&gt;at android.view.ViewRoot.handleMessage(ViewRoot.java:1727) &lt;br&gt;at android.os.Handler.dispatchMessage(Handler.java:99) &lt;br&gt;at android.os.Looper.loop(Looper.java:123) &lt;br&gt;at android.app.ActivityThread.main(ActivityThread.java:4627) &lt;br&gt;at java.lang.reflect.Method.invokeNative(Native Method) &lt;br&gt;at java.lang.reflect.Method.invoke(Method.java:521) &lt;br&gt;at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) &lt;br&gt;at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) &lt;br&gt;at dalvik.system.NativeStart.main(Native Method)&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;After searching around the Internet, I found some clues. It has something to do with the call of bitmap.recycle(). Some people suggest to remove all the calls to bitmap.recycle() and let the garbage collector to do the job. So I tried this solution and updated the Packing List application. I will give it a day or two to see if it settles the issue.&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/5279986114468244643/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/10/javalangruntimeexception-canvas-trying.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/5279986114468244643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/5279986114468244643'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/10/javalangruntimeexception-canvas-trying.html' title='java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-8806256357860735385</id><published>2010-08-19T20:01:00.001-07:00</published><updated>2010-08-19T20:02:17.790-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>Miscellaneous Tips</title><content type='html'>&lt;h4&gt;&lt;a name=&quot;_Toc267852159&quot;&gt;How to stretch a control&lt;/a&gt;?&lt;/h4&gt; &lt;p&gt;Set Layout_weight to greater than 0&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9rfxJv6ahlJW4FocBslL6DAZnF41PcEyaPZED9hVU-5x_-i9Sf40IyCzrsm7xlJMTTnZml69_67uHxHpovkI942Yw5CnKtsTumPtI34VC97B8FLaNljknNpSmbPD1Xy9xSH1wyKjqiys/s1600-h/image2.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz7b23MpJtlMHsFmzxD5nJ5Drpo_PYVMu0ePJKXg5yx6Jwke4xSQYAUMdtWZECaMgYu1hLfgJw4Ubyb-o5waLCqECdVXeuR7PEuKnmX6SdC3YzZPUyfEtmyBMjt4-81cH1JdKDtwWIYpA/?imgmax=800&quot; width=&quot;254&quot; height=&quot;42&quot;&gt;&lt;/a&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGSUrQaVMe3Gl0UBk0hmbhSmJQQZB1EkKx-0EmJw1d15bJUyodA1Tn5g6pddm_3S36CXy7bjBplysaXnFTuOYLTd9GQ0GCwCmgUcvDUiEQ4S2E87FpQQzK1Ty_gWnaRJcT1puAejzh1t8/s1600-h/image5.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihezRuM2utlX-auE6TsnKGb4MGRtJH5ErHkCPZUMWXxlMrTyUHvu6SLbzqIGHwKKQMFuunJcIbpm6JmGPKPL8bAfsqnxn5b26emcIQTAXpin201sHJYJKGq_JztgtXjTqm8uEv5G5GGEM/?imgmax=800&quot; width=&quot;244&quot; height=&quot;27&quot;&gt;&lt;/a&gt;  &lt;h4&gt;&amp;nbsp;&lt;/h4&gt; &lt;h4&gt;&lt;a name=&quot;_Toc267852160&quot;&gt;Issue with Check box in a list view&lt;/a&gt;&lt;/h4&gt; &lt;p&gt;When I use anything other than textview in a listview, the context menu stop working. Now to have a check box in a list view, I have to use CheckedTextView. But the text in CheckedTextView appears on the left side of the checkbox. I don’t know how to change it, so I use a CheckedTextView with no text and a TextView.  &lt;h4&gt;&amp;nbsp;&lt;/h4&gt; &lt;h4&gt;&lt;a name=&quot;_Toc267852161&quot;&gt;Show checkbox in CheckedTextView&lt;/a&gt;&lt;/h4&gt; &lt;div id=&quot;codeSnippetWrapper&quot;&gt; &lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;CheckedTextView&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;android:id&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;@+id/categoryCheckedTextView&quot;&lt;/span&gt;&lt;br&gt;    &lt;span style=&quot;color: #ff0000&quot;&gt;android:layout_width&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;wrap_content&quot;&lt;/span&gt; &lt;br&gt;    &lt;span style=&quot;color: #ff0000&quot;&gt;android:checkMark&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;?android:attr/listChoiceIndicatorMultiple&quot;&lt;/span&gt;&lt;br&gt;    &lt;span style=&quot;color: #ff0000&quot;&gt;android:layout_height&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;wrap_content&quot;&lt;/span&gt; &lt;br&gt;    &lt;span style=&quot;color: #ff0000&quot;&gt;android:clickable&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;true&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;CheckedTextView&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h4&gt;Display simple &lt;a name=&quot;_Toc267852164&quot;&gt;MessageBox in Android&lt;/a&gt;&lt;/h4&gt;
&lt;div&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br&gt;AlertDialog alertDialog;&lt;br&gt;alertDialog = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; AlertDialog.Builder(&lt;span style=&quot;color: #0000ff&quot;&gt;this&lt;/span&gt;).create();&lt;br&gt;alertDialog.setTitle(&lt;span style=&quot;color: #006080&quot;&gt;&quot;Packing List&quot;&lt;/span&gt;);&lt;br&gt;alertDialog.setMessage(&lt;span style=&quot;color: #006080&quot;&gt;&quot;Could not find the file.&quot;&lt;/span&gt;);&lt;br&gt;alertDialog.show();&lt;/pre&gt;&lt;/div&gt;
&lt;h4&gt;&amp;nbsp;&lt;/h4&gt;
&lt;h4&gt;&lt;a name=&quot;_Toc267852171&quot;&gt;Change emulator orientation&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Use&lt;strong&gt; KEYPAD_7 &lt;/strong&gt;or &lt;strong&gt;KEYPAD_9&lt;/strong&gt; on you desktop. You need to&lt;strong&gt; turn off your Num Lock.&lt;/strong&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;
&lt;h4&gt;&lt;a name=&quot;_Toc267852175&quot;&gt;Dynamically change the background color&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To dynamically change the background color, use myView.setBackgroundResource(R.color.my_color) instead myView.setBackgroundColor(R.color.my_color)
&lt;h4&gt;&amp;nbsp;&lt;/h4&gt;
&lt;h4&gt;How to align text in text view?&lt;/h4&gt;When trying to align the text to the right in text , set the “layout_gravity” to right doesn’t work. Need to set “gravity” to right. 
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;br&gt;&lt;/div&gt;  </content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/8806256357860735385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/08/miscellaneous-tips.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/8806256357860735385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/8806256357860735385'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/08/miscellaneous-tips.html' title='Miscellaneous Tips'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz7b23MpJtlMHsFmzxD5nJ5Drpo_PYVMu0ePJKXg5yx6Jwke4xSQYAUMdtWZECaMgYu1hLfgJw4Ubyb-o5waLCqECdVXeuR7PEuKnmX6SdC3YzZPUyfEtmyBMjt4-81cH1JdKDtwWIYpA/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-2979204646666397899</id><published>2010-08-09T13:09:00.001-07:00</published><updated>2010-08-09T13:09:45.693-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android Environment"/><title type='text'>Re-import Android project issue</title><content type='html'>&lt;p&gt;After my laptop crashes, I have to re-install everything. After importing the existing projects, I got the following error “The method onClick(DialogInterface, int) of type new DialogInterface.OnClickListener(){} must override superclass method” &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyGJX659_UudoGZCikezW_Bx_z6o0UnLHoXyDGm-V1QYCioOe1Q-V2z9BY8yeCLOV8kKhyphenhyphenCvIiZzX_jaOF6jtZMss0cnuuunvLqRflM1YShMByqFp17ytIpaqC8gyPVwspJPJBcKl4FPs/s1600-h/image%5B11%5D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiljO0-ZPtzUF2BWQUNjsdouAXiAx-8x677uXf5dQPx9p6xHDxKDX5meJkeYps4mTzyVo9ejo_8-kyfYKc8az-TlhRKQJT3mjfxfvsAAXo5ri6oS2PwRSElZ1WjVTlTThT4E_l4aY8lTmY/?imgmax=800&quot; width=&quot;545&quot; height=&quot;318&quot;&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;And this is what I found on google: &lt;p&gt;&lt;i&gt;Eclipse is defaulting to Java 1.5 and you have classes implementing interface methods (which in Java 1.6 can be annotated with @Override, but in Java 1.5 can only be applied to methods overriding a superclass method). &lt;/i&gt; &lt;p&gt;&lt;i&gt;Go to your project/ide preferences and set the java compiler level to 1.6 and also make sure you select JRE 1.6 to execute your program from eclipse.&lt;/i&gt;&lt;/p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNBDruaS5XmiKw_lnyRknl8kRZ4fwrKeXBXE-1nriJvc3IKxGoPjGYLG_qMHzVWRUkL_yrVGJ-DvYkBuBRTZI5Ir58wQEeDuK4J7kCAi4DleniSbHbwY-ogCL373TwKNhIoVkjXkySO30/s1600-h/image%5B8%5D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTUcecnRxTi3uXj9_F_L6vLaxTJFOHMYOi0nRQjlRTO0c617bbM3EAU3rjMaPisdazYKVGUp1CILGG5zyJvYc79QREwUcGYgJO6E5_BZVfJjhnd9DL32c2BSA3ynhFlvypMTRfXjtfBLo/?imgmax=800&quot; width=&quot;376&quot; height=&quot;363&quot;&gt;&lt;/a&gt;  </content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/2979204646666397899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/08/re-import-android-project-issue.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/2979204646666397899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/2979204646666397899'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/08/re-import-android-project-issue.html' title='Re-import Android project issue'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiljO0-ZPtzUF2BWQUNjsdouAXiAx-8x677uXf5dQPx9p6xHDxKDX5meJkeYps4mTzyVo9ejo_8-kyfYKc8az-TlhRKQJT3mjfxfvsAAXo5ri6oS2PwRSElZ1WjVTlTThT4E_l4aY8lTmY/s72-c?imgmax=800" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-4525637882994921907</id><published>2010-08-09T12:37:00.001-07:00</published><updated>2010-08-09T12:37:52.794-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android Environment"/><title type='text'>How to debug on device?</title><content type='html'>&lt;p&gt;For detail information, go to - &lt;a href=&quot;http://developer.android.com/guide/developing/device.html&quot;&gt;http://developer.android.com/guide/developing/device.html&lt;/a&gt;. The following is a simplified version for my own reference. &lt;p&gt;1. Declare your application as &quot;debuggable&quot; in your Android Manifest.  &lt;p&gt;In Eclipse, you can do this from the &lt;b&gt;Application&lt;/b&gt; tab when viewing the Manifest (on the right side, set &lt;b&gt;Debuggable&lt;/b&gt; to &lt;em&gt;true&lt;/em&gt;). Otherwise, in the &lt;code&gt;AndroidManifest.xml&lt;/code&gt; file, add &lt;code&gt;android:debuggable=&quot;true&quot;&lt;/code&gt; to the &lt;code&gt;&amp;lt;application&amp;gt;&lt;/code&gt; element. &lt;p&gt;2. Turn on &quot;USB Debugging&quot; on your device.  &lt;p&gt;On the device, go to the home screen, press &lt;b&gt;MENU&lt;/b&gt;, select &lt;b&gt;Applications&lt;/b&gt; &amp;gt; &lt;b&gt;Development&lt;/b&gt;, then enable &lt;b&gt;USB debugging&lt;/b&gt;. &lt;p&gt;3. Setup your system to detect your device.  &lt;p&gt;If you&#39;re developing on Windows, you need to install a USB driver for adb. See the &lt;a href=&quot;http://developer.android.com/sdk/win-usb.html&quot;&gt;Windows USB Driver&lt;/a&gt; documentation. &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxDZbM3LGk1ZQDwjCuYsW4TU37uddzVos8tuiWm-OSj7-Eo4TB6Fjs7ygTJ6Ccs6HiST_EGJD36zJcItLWcV7_tqxiB6KN34MN0OzT3cJuL6TSX6fP2Li1Uq_3cFWAIRmJduOLX24zyqg/s1600-h/image%5B2%5D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjog_2CsyVjATbMdSPbzZYnV7SBRg0rO574AuPN3HNXE3g7c92F0uRjT45M4Ej1QWii7wJ95oMFvWQId4yow1ycRTGhiEYDAaIodFb0M6kynBHkeVw5e4JGvoFolc9jdwmLeT9osuCtzyU/?imgmax=800&quot; width=&quot;244&quot; height=&quot;118&quot;&gt;&lt;/a&gt;  </content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/4525637882994921907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/08/how-to-debug-on-device.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/4525637882994921907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/4525637882994921907'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/08/how-to-debug-on-device.html' title='How to debug on device?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjog_2CsyVjATbMdSPbzZYnV7SBRg0rO574AuPN3HNXE3g7c92F0uRjT45M4Ej1QWii7wJ95oMFvWQId4yow1ycRTGhiEYDAaIodFb0M6kynBHkeVw5e4JGvoFolc9jdwmLeT9osuCtzyU/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-7590733628331794257</id><published>2010-08-09T12:06:00.001-07:00</published><updated>2010-08-09T12:06:53.120-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>ClassNotFound exception when unmarshalling</title><content type='html'>&lt;p&gt;The following code is the serialization part of the Category class in PackingList project. Since the category has an arraylist of items, I have to put it in Bundle. To de-serialize it, I need to retrieve items from the Bundle. To do that, I was using Bundle d = in.readBundle(). However, I received “ClassNotFound exception when unmarshalling”. I have to pass in the ClassLoader so it knows it’s for the Item. &lt;p&gt;&amp;nbsp; &lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;@Override&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;void&lt;/span&gt; writeToParcel(Parcel dest, &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; flags) {&lt;br&gt;    dest.writeString(category);&lt;br&gt;    Bundle b = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; Bundle();&lt;br&gt;    b.putParcelableArrayList(&lt;span style=&quot;color: #006080&quot;&gt;&quot;items&quot;&lt;/span&gt;, items);&lt;br&gt;    dest.writeBundle(b);&lt;br&gt;    &lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;final&lt;/span&gt; Parcelable.Creator&amp;lt;Category&amp;gt; CREATOR = &lt;br&gt;                &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; Parcelable.Creator&amp;lt;Category&amp;gt;() { &lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; Category createFromParcel(Parcel in) { &lt;br&gt;        Category category = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; Category();&lt;br&gt;        category.category = in.readString();&lt;br&gt;        Bundle b = in.readBundle(Item.&lt;span style=&quot;color: #0000ff&quot;&gt;class&lt;/span&gt;.getClassLoader());        &lt;br&gt;        category.items = b.getParcelableArrayList(&lt;span style=&quot;color: #006080&quot;&gt;&quot;items&quot;&lt;/span&gt;);&lt;br&gt;                    &lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; category;&lt;br&gt;    }&lt;br&gt;&lt;br&gt;    @Override&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; Category[] newArray(&lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; size) {&lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; Category[size];&lt;br&gt;    }&lt;br&gt;};&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;  </content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/7590733628331794257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/08/classnotfound-exception-when.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/7590733628331794257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/7590733628331794257'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/08/classnotfound-exception-when.html' title='ClassNotFound exception when unmarshalling'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-3911815841211405203</id><published>2010-08-09T11:57:00.001-07:00</published><updated>2010-08-09T11:57:54.755-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>How to display progress dialog?</title><content type='html'>&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;private&lt;/span&gt; ProgressDialog dialog;&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;void&lt;/span&gt; onCreate(Bundle savedInstanceState) {    &lt;br&gt;    ……&lt;br&gt;    &lt;br&gt;    dialog = ProgressDialog.show(&lt;span style=&quot;color: #0000ff&quot;&gt;this&lt;/span&gt;, &lt;span style=&quot;color: #006080&quot;&gt;&quot;&quot;&lt;/span&gt;,  &lt;br&gt;            &lt;span style=&quot;color: #006080&quot;&gt;&quot;Loading Calendar and Tasks. Please wait...&quot;&lt;/span&gt;, true);&lt;br&gt;    &lt;br&gt;    ……&lt;br&gt;    CalendarThread calendarThread = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; CalendarThread();&lt;br&gt;    calendarThread.start(); &lt;br&gt;    &lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;class&lt;/span&gt; CalendarThread &lt;span style=&quot;color: #0000ff&quot;&gt;extends&lt;/span&gt; Thread { &lt;br&gt;         &lt;br&gt;    @Override &lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;void&lt;/span&gt; run() {         &lt;br&gt;        &lt;span style=&quot;color: #008000&quot;&gt;//Long running process&lt;/span&gt;&lt;br&gt;        ……&lt;br&gt;&lt;br&gt;        handler.sendEmptyMessage(0); &lt;br&gt;    } &lt;br&gt;&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;private&lt;/span&gt; Handler handler = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; Handler() { &lt;br&gt;&lt;br&gt;        @Override &lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;void&lt;/span&gt; handleMessage(Message msg) { &lt;br&gt;            &lt;span style=&quot;color: #008000&quot;&gt;//Process after the long running process&lt;/span&gt;&lt;br&gt;            ……&lt;br&gt;            dialog.dismiss(); &lt;br&gt;        } &lt;br&gt;    }; &lt;br&gt;}&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;  </content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/3911815841211405203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/08/how-to-display-progress-dialog.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/3911815841211405203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/3911815841211405203'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/08/how-to-display-progress-dialog.html' title='How to display progress dialog?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-363297749069618460</id><published>2010-04-21T10:07:00.001-07:00</published><updated>2010-06-18T08:51:26.605-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android Environment"/><title type='text'>Android Emulator Issue</title><content type='html'>Yesterday I resumed the work on improving the Packing List 1.5. However, the Emulator didn’t corporate. It kept crashing. I was so frustrated. I deleted and re-created the image several times. It still didn’t work. The error I received was something like &quot;sad result from adb&quot;. What does “sad result” mean? They really should give it better description. Some times I received “the user data image is used by another emulator” while there was only one emulator and one user. I googled and no help. Finally, this morning I tried again, the emulator was so slow to start. So I checked the power mode on my laptop. It turned out I accidently set the power mode to “Power Saver” a couple of days ago. I changed it back. Now everything worked just fine!</content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/363297749069618460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/04/android-emulator-issue.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/363297749069618460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/363297749069618460'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/04/android-emulator-issue.html' title='Android Emulator Issue'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-4957312015498162999</id><published>2010-02-08T08:40:00.001-08:00</published><updated>2010-08-09T12:13:54.137-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>Creating custom dialog in Android</title><content type='html'>This blog shows you an example on how to create custom dialog. For more information on creating different kind of dialogs, please visit &lt;a href=&quot;http://developer.android.com/guide/topics/ui/dialogs.html&quot;&gt;http://developer.android.com/guide/topics/ui/dialogs.html&lt;/a&gt;&lt;br&gt;1. Create layout for the dialog&lt;br&gt; &lt;div id=&quot;codeSnippetWrapper&quot;&gt; &lt;div id=&quot;codeSnippetWrapper&quot;&gt; &lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&amp;lt;?xml version=&lt;span style=&quot;color: #006080&quot;&gt;&quot;1.0&quot;&lt;/span&gt; encoding=&lt;span style=&quot;color: #006080&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;?&amp;gt;&lt;br&gt;&amp;lt;LinearLayout&lt;br&gt;    xmlns:android=&lt;span style=&quot;color: #006080&quot;&gt;&quot;http://schemas.android.com/apk/res/android&quot;&lt;/span&gt;&lt;br&gt;    android:layout_width=&lt;span style=&quot;color: #006080&quot;&gt;&quot;fill_parent&quot;&lt;/span&gt; &lt;br&gt;    android:layout_height=&lt;span style=&quot;color: #006080&quot;&gt;&quot;fill_parent&quot;&lt;/span&gt; &lt;br&gt;    android:orientation=&lt;span style=&quot;color: #006080&quot;&gt;&quot;vertical&quot;&lt;/span&gt; &lt;br&gt;    android:padding=&lt;span style=&quot;color: #006080&quot;&gt;&quot;10sp&quot;&lt;/span&gt;&amp;gt;&lt;br&gt;    &amp;lt;EditText android:text=&lt;span style=&quot;color: #006080&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;br&gt;        android:id=&lt;span style=&quot;color: #006080&quot;&gt;&quot;@+id/categoryEditText&quot;&lt;/span&gt; &lt;br&gt;        android:layout_height=&lt;span style=&quot;color: #006080&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt; &lt;br&gt;        android:layout_width=&lt;span style=&quot;color: #006080&quot;&gt;&quot;fill_parent&quot;&lt;/span&gt; &lt;br&gt;        android:singleLine=&lt;span style=&quot;color: #006080&quot;&gt;&quot;true&quot;&lt;/span&gt;&amp;gt;&lt;br&gt;    &amp;lt;/EditText&amp;gt;    &lt;br&gt;&amp;lt;/LinearLayout&amp;gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
&lt;div&gt;2. Override onCreateDialog in the Activity&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;@Override&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;protected&lt;/span&gt; Dialog onCreateDialog(&lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; id) {&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;switch&lt;/span&gt; (id) {&lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;case&lt;/span&gt; CATEGORY_DETAIL:&lt;br&gt;            LayoutInflater li = LayoutInflater.from(&lt;span style=&quot;color: #0000ff&quot;&gt;this&lt;/span&gt;);&lt;br&gt;            View categoryDetailView = li.inflate(R.layout.category_detail, null);&lt;br&gt;            &lt;br&gt;            AlertDialog.Builder categoryDetailBuilder = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; AlertDialog.Builder(&lt;span style=&quot;color: #0000ff&quot;&gt;this&lt;/span&gt;);&lt;br&gt;            categoryDetailBuilder.setTitle(&lt;span style=&quot;color: #006080&quot;&gt;&quot;Edit Category&quot;&lt;/span&gt;);&lt;br&gt;            categoryDetailBuilder.setView(categoryDetailView);&lt;br&gt;            AlertDialog categoryDetail = categoryDetailBuilder.create();&lt;br&gt;            &lt;br&gt;            categoryDetail.setButton(&lt;span style=&quot;color: #006080&quot;&gt;&quot;OK&quot;&lt;/span&gt;, &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; OnClickListener(){&lt;br&gt;            &lt;br&gt;            @Override&lt;br&gt;            &lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;void&lt;/span&gt; onClick(DialogInterface dialog, &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; which) {&lt;br&gt;                AlertDialog categoryDetail = (AlertDialog)dialog;&lt;br&gt;                EditText et = (EditText)categoryDetail.findViewById(R.id.categoryEditText);&lt;br&gt;                &lt;span style=&quot;color: #0000ff&quot;&gt;if&lt;/span&gt; (categories.get(selectedIndex)!=null){&lt;br&gt;                    &lt;span style=&quot;color: #008000&quot;&gt;//... some code&lt;/span&gt;&lt;br&gt;                }               &lt;br&gt;            });&lt;br&gt;            &lt;br&gt;            categoryDetail.setButton2(&lt;span style=&quot;color: #006080&quot;&gt;&quot;Cancel&quot;&lt;/span&gt;, &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; DialogInterface.OnClickListener() {&lt;br&gt;            &lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;void&lt;/span&gt; onClick(DialogInterface dialog, &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; which) {&lt;br&gt;                &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt;;&lt;br&gt;            }}); &lt;br&gt;            &lt;br&gt;            &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; categoryDetail;&lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;default&lt;/span&gt;:&lt;br&gt;            &lt;span style=&quot;color: #0000ff&quot;&gt;break&lt;/span&gt;;&lt;br&gt;    }&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; null;&lt;br&gt;}&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
&lt;div&gt;3. Override onPrepareDialog to dynamically set default value before the dialog is open&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;@Override&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;void&lt;/span&gt; onPrepareDialog(&lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; id, Dialog dialog) {&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;switch&lt;/span&gt; (id) {&lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;case&lt;/span&gt; CATEGORY_DETAIL:&lt;br&gt;            AlertDialog categoryDetail = (AlertDialog)dialog;&lt;br&gt;            EditText et = (EditText)categoryDetail.findViewById(R.id.categoryEditText);&lt;br&gt;            et.setText(defaultValue);&lt;br&gt;            &lt;span style=&quot;color: #0000ff&quot;&gt;break&lt;/span&gt;;&lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;default&lt;/span&gt;:&lt;br&gt;            &lt;span style=&quot;color: #0000ff&quot;&gt;break&lt;/span&gt;;&lt;br&gt;    }&lt;br&gt;}&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;4. Call showDialog to display the dialog&lt;br&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;span style=&quot;color: blue&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: blue&quot;&gt;int&lt;/span&gt; CATEGORY_DETAIL = 1;
&lt;span style=&quot;color: green&quot;&gt;//... some code&lt;/span&gt;
showDialog(CATEGORY_DETAIL);&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;br&gt;&lt;/div&gt;  </content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/4957312015498162999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/02/creating-custom-dialog-in-android.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/4957312015498162999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/4957312015498162999'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/02/creating-custom-dialog-in-android.html' title='Creating custom dialog in Android'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-3745706603389355619</id><published>2010-02-01T12:18:00.001-08:00</published><updated>2010-06-18T08:52:34.596-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>Passing a list of objects between Activities</title><content type='html'>In Android, you can use Bundle to pass data between activities. There are many functions to pass Integer, String, etc. To pass an object, you will need to implement Parcelable interface and override some functions to serialize/de-serialize the object. Here is an example:&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; Category &lt;span style=&quot;color: blue;&quot;&gt;implements&lt;/span&gt; Parcelable {
&lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; String category;
&lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; ArrayList&amp;lt;Item&amp;gt; items;

&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; String getCategory() {
&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; category;
}

&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; setCategory(String category) {
&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.category = category;
}

&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; ArrayList&amp;lt;Item&amp;gt; getItems() {
&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; items;
}

&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; setItems(ArrayList&amp;lt;Item&amp;gt; items) {
&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.items = items;
}

&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; Category(){

}

&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; Category(String _category){
category = _category;
}

@Override
&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; describeContents() {
&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; 0;
}

@Override
&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; writeToParcel(Parcel dest, &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; flags) {
dest.writeString(category);
Bundle b = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Bundle();
b.putParcelableArrayList(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;items&quot;&lt;/span&gt;, items);
dest.writeBundle(b);

}

&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;final&lt;/span&gt; Parcelable.Creator&amp;lt;Category&amp;gt; CREATOR = 
&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Parcelable.Creator&amp;lt;Category&amp;gt;() { 
&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; Category createFromParcel(Parcel in) { 
Category category = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Category();
category.category = in.readString();
Bundle b = in.readBundle(Item.&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;.getClassLoader());        
category.items = b.getParcelableArrayList(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;items&quot;&lt;/span&gt;);

&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; category;
}

@Override
&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; Category[] newArray(&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; size) {
&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Category[size];
}
};
}&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;To pass an arraylist&amp;nbsp; of Category to another activity, &lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;intent i = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Intent(_av.getContext(), ItemList.&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;);
Bundle b = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; Bundle();
b.putParcelableArrayList(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;categories&quot;&lt;/span&gt;, categories);
b.putInt(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;index&quot;&lt;/span&gt;, _index);
i.putExtras(b);
startActivityForResult(i, ITEM_LIST);&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;To retrieve the data,&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;Bundle b = &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.getIntent().getExtras();

ArrayList&amp;lt;Category&amp;gt; cats = b.getParcelableArrayList(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;categories&quot;&lt;/span&gt;);
&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; index = b.getInt(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;index&quot;&lt;/span&gt;);
&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/3745706603389355619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/02/passing-list-of-objects-between.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/3745706603389355619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/3745706603389355619'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/02/passing-list-of-objects-between.html' title='Passing a list of objects between Activities'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-4469365035967853188</id><published>2010-02-01T11:55:00.001-08:00</published><updated>2010-06-18T08:52:45.888-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>How to add MessageBox in Android?</title><content type='html'>&lt;div id=&quot;codeSnippetWrapper&quot;&gt;Simple message box with no buttons&lt;/div&gt;&lt;div&gt;&lt;pre id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;AlertDialog alertDialog;
alertDialog = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; AlertDialog.Builder(&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;).create();
alertDialog.setTitle(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Packing List&quot;&lt;/span&gt;);
alertDialog.setMessage(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Could not find the file.&quot;&lt;/span&gt;);
alertDialog.show();
&lt;/pre&gt;&lt;br /&gt;
Message box with buttons&lt;/div&gt;&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;AlertDialog deleteAlert = &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; AlertDialog.Builder(&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;).create();
deleteAlert.setTitle(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Delete List&quot;&lt;/span&gt;);
deleteAlert.setMessage(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Are you sure you want to delete this list?&quot;&lt;/span&gt;);
deleteAlert.setButton(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;Yes&quot;&lt;/span&gt;, &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; OnClickListener(){

@Override
&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; onClick(DialogInterface dialog, &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; which) {               
&lt;span style=&quot;color: green;&quot;&gt;//...&lt;/span&gt;
}
});
deleteAlert.setButton2(&lt;span style=&quot;color: #006080;&quot;&gt;&quot;No&quot;&lt;/span&gt;, &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; OnClickListener(){

@Override
&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; onClick(DialogInterface dialog, &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; which) {
&lt;span style=&quot;color: green;&quot;&gt;//...&lt;/span&gt;
}
});
deleteAlert.show();&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/4469365035967853188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/02/how-to-add-messagebox-in-android.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/4469365035967853188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/4469365035967853188'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/02/how-to-add-messagebox-in-android.html' title='How to add MessageBox in Android?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-3394597304229953155</id><published>2010-01-14T13:53:00.001-08:00</published><updated>2010-06-18T08:53:09.377-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android Environment"/><title type='text'>How to deploy Android application?</title><content type='html'>1. Create icon for your application and add it to the project&lt;br /&gt;
&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhidIrZUp526BeTno_UR72BySxL9GWnDB_nq_p8Yq1uzQepeDn6oAy652yR0cnD1GYLpzSSfDxUL6Fl-PL3-BVrDAG82IMZQi_aDFdm0J0EU6ln4GLwKSmf_E1J4qTPWRb3AGXshNVxSBM/s1600-h/image%5B14%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;208&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhepiYp1IrX7TV-O3mgRrkOPdbXjyToHIYLoIIzTA-m39N5RjtaCyZvSKv_ASgZ9n1bprjtnsdsAoJLlSowB40QLN_NE3Zk46wpePRC5A8L71Y2vyfVW5Ar_CD8HkYGyf6rmTCugmivIhQ/?imgmax=800&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;222&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGZX-UNz2HK2DHN1tBDBJQIoAtsKBreX4ukIzuKZJYQF7Ot7qj8-pBOa937M_sGQ3isS9k34-SXfv_XvOZtID8FWtKy8fE8-T4eFqu6f6t2-EmXmZOGtrI7Q9NKP4kVCzzk9EzxielGFE/s1600-h/image%5B24%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;60&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQL38qWOIYGbgxdDifEZYvaqIodTTnLGEnsQJ-gb_AOuJZ12p-NVQmgMqc1bSVZf9Rsr5t7fW5qFsMu3bI_qxu65V1S2vDm3BszAZty29SphBJAMR-PDss35cwI8UcK2bKTsDg0ht2mBs/?imgmax=800&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;411&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
2. Export unsigned application&lt;br /&gt;
&lt;blockquote&gt;&lt;span style=&quot;color: #cceedd;&quot;&gt;Right click on the project. Click on “Android Tools-&amp;gt;Export Unsigned Application Package…”&lt;/span&gt;&lt;/blockquote&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYtNF5NJudTJXp_W5JglH7OVwy-VAq0Ww4x3GCJfFzM-TWxkJqOSwUUn04KSfdPyJJsRrUh2dCA4PtVJnMTLjJdpydo8GPiEe1WHAt-EMzpVLOz3MJahahtNjejeDshe-th-NtH8KqzWo/s1600-h/image%5B25%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;270&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEbw7pc8tgTs1Jmy2Jn4_DkVFf9j5Q27s4IU8UnKV0kkVUEWDIcSP4syWUm1QQWtZd81eVwZac86b2WfKbgfi9UZBL9rANqLLQ0ThWNtasib5W8Jq_BGCPt9JZ1M1jHEQuxR8pK-lO_48/?imgmax=800&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;412&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
2. Generate personal certificate by using keytool in java’s jre\bin directory&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZtsT2Zpi9joNsI1VjV74JFoffDdC_qZf3xVzpQWuRUuBZZ2I9VBGoITNHmxk6i2QikRHdYu_METdpRoNwGz3_ZFaFED4ya_S_9YfhLlJlPgHfvt5vUOmQ_88nji4Cfq8kFEXlceXqaZM/s1600-h/image%5B26%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;261&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDjpeOSnIdyZbUNBYndGrpBABd00w3eMx-nPgQNjQ6ocBwslv2gN5vSv318bAuRvcTgesqsuvyaGmRN8eqIQPPStvToiSy-bYWT4qUst1eJGfdiQuVKTpU3BOBzsT4OA_XPiLGIEb0lVQ/?imgmax=800&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;413&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
3. Sign Android application by using jarsigner in jre\bin direcotry&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibiEUl_90S43RySY6XP3UNb2GF8wboOihsxRCu0jPpuoNiBqfq3Rye5XCPaG77_abGboBz340gQTP0t45OT0rJhrGytb3_oFGE66yC5jlhbN7B1sVZqmRbhScQS57oLoHECeIX9Yq7O9c/s1600-h/image%5B28%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;133&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih8GP5162VtcdhLtSKXu7GY05mFSBfDQHHROR28eKP0lvQ6PkOiwhup4ZNL6Lbzv2OWuLTpu7vI4vfGJ5DwOWlbN8BpRhfh_iGxQWGnduC5JBjEl2DqYQsvMELg_tg3-k3hrikcJ89FSU/?imgmax=800&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;423&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
4. Installation&lt;br /&gt;
&lt;blockquote&gt;a) Install application on emulator&lt;/blockquote&gt;&lt;blockquote&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgGaiK4Q0Kj43jR5Y2_AFXLGy7HlIKM6udpE208-_xb4Ejh363YPtqLKecguwNNA4xZImGBt2zNEImA2DTjPTAHdHH6-KjdSXQX8vgLM9Rc7DE9gS4MLwAC5_-tfZY4W40Ul0TNICfs6Q/s1600-h/image%5B29%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;65&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiesCIykjMksruMGlDGqgKib9_bYi8Crjp3aCya_jKh0Xqg4R8k5creG4nfO35KUOkcW0RgcK1Bi4-VvamhxXfN56GQcxCydyVdu3CRCowjkby3jhnh7V8Fnq6BIep86mMSjtzRBcQ-UBo/?imgmax=800&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;391&quot; /&gt;&lt;/a&gt;&amp;nbsp;&lt;/blockquote&gt;&lt;blockquote&gt;b) Install application on device&lt;/blockquote&gt;&lt;blockquote&gt;I downloaded ASTRO File Manager and copied the apk file to device. Use File Manager to find the file and tap on it. It prompted me a couple of questions. I have to change my device setting to allow unknown source apps to be installed on my device. &lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/3394597304229953155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/how-to-deploy-android-application.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/3394597304229953155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/3394597304229953155'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/how-to-deploy-android-application.html' title='How to deploy Android application?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhepiYp1IrX7TV-O3mgRrkOPdbXjyToHIYLoIIzTA-m39N5RjtaCyZvSKv_ASgZ9n1bprjtnsdsAoJLlSowB40QLN_NE3Zk46wpePRC5A8L71Y2vyfVW5Ar_CD8HkYGyf6rmTCugmivIhQ/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-5319880213334008327</id><published>2010-01-14T13:10:00.001-08:00</published><updated>2010-06-18T08:53:23.515-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android Environment"/><title type='text'>How to obtain Google Map Key for Android Application?</title><content type='html'>This &lt;a href=&quot;http://code.google.com/android/add-ons/google-apis/mapkey.html&quot;&gt;link&lt;/a&gt; will give detailed information on how to get Google Map Key for Android Application. I don’t need to repeat it. Here I just want to give simplified steps for future reference:&lt;br /&gt;
1. Get MD5 Fingerprint of the Certificate&lt;br /&gt;
&lt;blockquote&gt;a) SDK Debug Certificate&lt;/blockquote&gt;&lt;blockquote&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMhbqia_oOp1-x6kNPCdrq5eq2LFfg_TGFybodBMRxUlPfkUBFwQ-6_eSGNmgXSQu1oCNiZczgPilbNyCitATsIPUsa0syNBwN3fDhbqDPIMBVtvdSJv6Plr4mDoaPkEZGGjXb3Pzj8kE/s1600-h/image%5B1%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;64&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcmFDX4niXFoxWXXDCykEiGCFVljYUMmaJXcrKxD3JuOEMqiHA0utoxk8xm_2uOywDnR2S2-oyVqc3m3mjCrnSBUqwV0zRfjpko-N-FOSiSQ724-1L6aajqDDm4yA1vj0kXky7BJxCylk/?imgmax=800&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;406&quot; /&gt;&lt;/a&gt; &lt;/blockquote&gt;&lt;blockquote&gt;b) Your Signing Certificate&lt;/blockquote&gt;&lt;blockquote&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeNBMgmgCllQ4gPtyOriVFpJH7JKd2mhwLPurwz3w0NBpXsZSL60MwEc9KtaIeOFEL91L58-fb4EfgDG0pS3b1z1wmsWN9j-AbfhqENE51FjE3jBoNZWMjihaFpXxSpigCAWwkQm9hiWY/s1600-h/image%5B4%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;118&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOhbwOz-wjkshwx3lFK0PNjQE3FlY_-fE3avP0RgGMF7RLDZ47xyZBot1s1xB_qt7Bo_RNmRLoJB0mU8yRESfjTRKc4UE_Jx2ZeUXNQ7fGtqbC3VOdt_2hAg10lekbk1oNcIbiuaDJxi8/?imgmax=800&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;399&quot; /&gt;&lt;/a&gt; &lt;/blockquote&gt;2. Go to this &lt;a href=&quot;http://code.google.com/android/maps-api-signup.html&quot;&gt;link&lt;/a&gt; to sign up for an Android Maps API key&lt;br /&gt;
3. Add the key to your application’s AndroidManifest.xml&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &amp;quot;Courier New&amp;quot;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;com.google.android.maps.MapView&lt;/span&gt;
android:layout_width=&quot;fill_parent&quot;
android:layout_height=&quot;fill_parent&quot;
android:apiKey=&quot;[your key]&quot;
&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/5319880213334008327/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/how-to-obtain-google-map-key-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/5319880213334008327'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/5319880213334008327'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/how-to-obtain-google-map-key-for.html' title='How to obtain Google Map Key for Android Application?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcmFDX4niXFoxWXXDCykEiGCFVljYUMmaJXcrKxD3JuOEMqiHA0utoxk8xm_2uOywDnR2S2-oyVqc3m3mjCrnSBUqwV0zRfjpko-N-FOSiSQ724-1L6aajqDDm4yA1vj0kXky7BJxCylk/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-6360584237143234505</id><published>2010-01-14T12:58:00.001-08:00</published><updated>2010-06-18T08:54:05.272-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android Environment"/><title type='text'>MapActivity cannot be resolved to a type</title><content type='html'>When I first working on with MapActivity, I got above error. I kept press Ctrl+Shift+O. However, the type just wouldn’t resolve. Finally I found the answer on the Internet. You need to change the build target to “Google API”&lt;br /&gt;
Right click on the project. Go to “Properties”. Change the “Build Target” from “Android 1.x to Google APIs 1.x” &lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjroTHBnPnW9uGHop6yOcc-wHYWbjEMWRklNH60YQMUUbgfdJeaRviWLDJliOnBVkJf8wZlk1HkekTw9RPAupvFeY92g8uiO94mafqnZUVLfueoLySa9AyeJbM7CC_-9Ds_sdDo6-9AVc0/s1600-h/image%5B1%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;326&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVVbu367S7HLOjbohmGT-iy9qEKnnO7KwTRitmO49ozwwWLde8tppQjS4aydPYAaC0m39k6euvLrA0DK6ZUVsKasQod365NCCYLpJ57C8iCTOkBaG-51U6ZkxmYsCotf7uLqCWUWPV0uY/?imgmax=800&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;372&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/6360584237143234505/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/mapactivity-cannot-be-resolved-to-type.html#comment-form' title='25 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/6360584237143234505'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/6360584237143234505'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/mapactivity-cannot-be-resolved-to-type.html' title='MapActivity cannot be resolved to a type'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVVbu367S7HLOjbohmGT-iy9qEKnnO7KwTRitmO49ozwwWLde8tppQjS4aydPYAaC0m39k6euvLrA0DK6ZUVsKasQod365NCCYLpJ57C8iCTOkBaG-51U6ZkxmYsCotf7uLqCWUWPV0uY/s72-c?imgmax=800" height="72" width="72"/><thr:total>25</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-2732200828579871827</id><published>2010-01-14T07:23:00.000-08:00</published><updated>2011-08-30T08:24:26.127-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks"/><title type='text'>Read, Write and Parse XML file in Android</title><content type='html'>1. Read and Parse Xml file&lt;br&gt;The sample XML file looks like the following:&lt;br&gt; &lt;div&gt; &lt;div id=&quot;codeSnippetWrapper&quot;&gt; &lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;packingList&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;category&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;category&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;packingList&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;&lt;br&gt;The following code shows you how to read and parse the file&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;ArrayList&amp;lt;Category&amp;gt; categories;&lt;br&gt;XmlPullParser parser = Xml.newPullParser();&lt;br&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;try&lt;/span&gt; {&lt;br&gt;    FileInputStream fIn = openFileInput(FILE_NAME); &lt;br&gt;    InputStreamReader isr = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; InputStreamReader(fIn);&lt;br&gt;    &lt;br&gt;    &lt;span style=&quot;color: #008000&quot;&gt;// auto-detect the encoding from the stream&lt;/span&gt;&lt;br&gt;    parser.setInput(isr);&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; eventType = parser.getEventType();&lt;br&gt;    Category currentCategory = null;&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;boolean&lt;/span&gt; done = false;&lt;br&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;while&lt;/span&gt; (eventType != XmlPullParser.END_DOCUMENT &amp;amp;&amp;amp; !done){&lt;br&gt;        String name = null;&lt;br&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;switch&lt;/span&gt; (eventType){&lt;br&gt;            &lt;span style=&quot;color: #0000ff&quot;&gt;case&lt;/span&gt; XmlPullParser.START_DOCUMENT:&lt;br&gt;                &lt;span style=&quot;color: #0000ff&quot;&gt;break&lt;/span&gt;;&lt;br&gt;            &lt;span style=&quot;color: #0000ff&quot;&gt;case&lt;/span&gt; XmlPullParser.START_TAG:&lt;br&gt;                name = parser.getName();&lt;br&gt;                &lt;span style=&quot;color: #0000ff&quot;&gt;if&lt;/span&gt; (name.equalsIgnoreCase(&lt;span style=&quot;color: #006080&quot;&gt;&quot;packingList&quot;&lt;/span&gt;)){&lt;br&gt;                    categories = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; ArrayList&amp;lt;Category&amp;gt;();&lt;br&gt;                } &lt;span style=&quot;color: #0000ff&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;if&lt;/span&gt; (categories != null){&lt;br&gt;                    &lt;span style=&quot;color: #0000ff&quot;&gt;if&lt;/span&gt; (name.equalsIgnoreCase(&lt;span style=&quot;color: #006080&quot;&gt;&quot;category&quot;&lt;/span&gt;))&lt;br&gt;                    currentCategory = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; Category(parser.getAttributeValue(0)); &lt;br&gt;                }&lt;br&gt;                &lt;span style=&quot;color: #0000ff&quot;&gt;break&lt;/span&gt;;&lt;br&gt;            &lt;span style=&quot;color: #0000ff&quot;&gt;case&lt;/span&gt; XmlPullParser.END_TAG:&lt;br&gt;                name = parser.getName();&lt;br&gt;                &lt;span style=&quot;color: #0000ff&quot;&gt;if&lt;/span&gt; (name.equalsIgnoreCase(&lt;span style=&quot;color: #006080&quot;&gt;&quot;category&quot;&lt;/span&gt;) &amp;amp;&amp;amp; &lt;br&gt;                    currentCategory != null){&lt;br&gt;                    categories.add(0, currentCategory);&lt;br&gt;                } &lt;span style=&quot;color: #0000ff&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;if&lt;/span&gt; (name.equalsIgnoreCase(&lt;span style=&quot;color: #006080&quot;&gt;&quot;packingList&quot;&lt;/span&gt;)){&lt;br&gt;                    done = true;&lt;br&gt;                }&lt;br&gt;                &lt;span style=&quot;color: #0000ff&quot;&gt;break&lt;/span&gt;;&lt;br&gt;            }&lt;br&gt;        eventType = parser.next();&lt;br&gt;        }&lt;br&gt;} &lt;span style=&quot;color: #0000ff&quot;&gt;catch&lt;/span&gt; (FileNotFoundException e) {&lt;br&gt;    &lt;span style=&quot;color: #008000&quot;&gt;// TODO&lt;/span&gt;&lt;br&gt;} &lt;span style=&quot;color: #0000ff&quot;&gt;catch&lt;/span&gt; (IOException e) {&lt;br&gt;    &lt;span style=&quot;color: #008000&quot;&gt;// TODO&lt;/span&gt;&lt;br&gt;} &lt;span style=&quot;color: #0000ff&quot;&gt;catch&lt;/span&gt; (Exception e){&lt;br&gt;    &lt;span style=&quot;color: #008000&quot;&gt;// TODO&lt;/span&gt;&lt;br&gt;}&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
&lt;div&gt;2. Write to file&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;
&lt;div id=&quot;codeSnippetWrapper&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;try&lt;/span&gt; {&lt;br&gt;    FileOutputStream fOut = openFileOutput(FILE_NAME, MODE_WORLD_READABLE); &lt;br&gt;    OutputStreamWriter osw = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; OutputStreamWriter(fOut);  &lt;br&gt;    String fileContent = …; &lt;span style=&quot;color: #008000&quot;&gt;//build file content&lt;/span&gt;&lt;br&gt;    osw.write(fileContent ); &lt;br&gt;    osw.flush(); &lt;br&gt;    osw.close();&lt;br&gt;    &lt;br&gt;} &lt;span style=&quot;color: #0000ff&quot;&gt;catch&lt;/span&gt; (FileNotFoundException e) {&lt;br&gt;…&lt;br&gt;}&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;  </content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/2732200828579871827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/read-write-and-parse-xml-file-in.html#comment-form' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/2732200828579871827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/2732200828579871827'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/read-write-and-parse-xml-file-in.html' title='Read, Write and Parse XML file in Android'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-3137058184342121846</id><published>2010-01-12T09:36:00.001-08:00</published><updated>2010-06-18T08:54:16.184-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android Environment"/><title type='text'>How to kill an application running in Android Emulator?</title><content type='html'>Since I am not a Java programmer, there is a learning curve using Eclipse. I am getting used it. But sometimes I have to search the Internet to find answers for really simple question like this one. And here is how.&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIpJ3Mvn41sfXEKyx5hTUcGzKb_h6c6sVrAQq6-rIJn_lIzcbUWgj0Ay0icLXhZTs0J-DTwp_-SO6KmmClSODErDy17JKOtcxcVT2Titqs0ISXbTTCeqTrB2lb3b91MKynLOTQ_MMUq5A/s1600-h/image%5B1%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;134&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIRiwgYfBO8D3gllunQvxPW1XbX8B1iP7k6vcoYb7OCJIb4GmGFbfHD2Oe7EetLz2ouNVp6MPKgpUs6RkppPqvu_VsfR5bJ46dmoBFbWCi2KiGDYK2ug7HHwiSYBEhu7dJrKNEKUxO3X8/?imgmax=800&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;418&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
1. Click on “DDMS”&lt;br /&gt;
2. Select the application you want to kill&lt;br /&gt;
3. Click on “Stop”</content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/3137058184342121846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/how-to-kill-application-running-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/3137058184342121846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/3137058184342121846'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/how-to-kill-application-running-in.html' title='How to kill an application running in Android Emulator?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIRiwgYfBO8D3gllunQvxPW1XbX8B1iP7k6vcoYb7OCJIb4GmGFbfHD2Oe7EetLz2ouNVp6MPKgpUs6RkppPqvu_VsfR5bJ46dmoBFbWCi2KiGDYK2ug7HHwiSYBEhu7dJrKNEKUxO3X8/s72-c?imgmax=800" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-5303063999215486511</id><published>2010-01-12T09:26:00.001-08:00</published><updated>2010-06-18T08:54:26.406-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android Environment"/><title type='text'>Android 2.0 Update</title><content type='html'>To get Android SDK 2.0 update, go to “Windows-&amp;gt;Android SDK Manager” to download the new update.&lt;br /&gt;
After download the update, I got the following message when try to open my existing application&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEia5OQnbllVDiDv8_KeLCjN02wGENAZMfc-4CWcDioXP7lGVqVozKen3xe3ilr0A_IqX1NUWl36kN93pPfgDKWyKiwf8S9sKL2K3W-foarVLzI3vT_rdB-coK0fThNwfZiyJrrkYS6hCtg/s1600-h/image%5B2%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;91&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUbqzh14qLtqRoWOMRDytuDl-7u9pCjq4-Ks6LyltgWS9ezcKRYhfRUNcIpUgS1s6IDycGoCB3aYW_AUT_S5pP0sOhLNmQmtGWLUEsGkOGcM1KRAWB5IqTCF7wL1oRCPTMI_2IOx8RFlM/?imgmax=800&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;244&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
I went to “Help-&amp;gt;Software Updates…” and installed the developer tools in below screen shot.&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtjxgFjrS5slg-r3P2qa0sTzVaRsIIP0cBKefAKvwgJlQ-wUKdwcq4gVuXG4z_izh5dYczuNBGI8kmoCp1vzBOf-GTkWGA8uEZkcbyg3sHxitv_zYtb-pHKt6CQflLSRWQgcan4wEAViA/s1600-h/image%5B5%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;139&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjX2gmhyum4_iw2ExdqrFNVt3_1zhwHiUglIhMoLQ-MAJ8IjJ2MBO-Bk14biFNP_rGX_-xzmH1RqLjOhyphenhyphenWIrbIeOVj8cqEOCofxOQEzB4HwLeTYy2MLjWILbcnbCatjapx3Xx7i2ayXLHo/?imgmax=800&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;244&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/5303063999215486511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/android-20-update.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/5303063999215486511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/5303063999215486511'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/android-20-update.html' title='Android 2.0 Update'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUbqzh14qLtqRoWOMRDytuDl-7u9pCjq4-Ks6LyltgWS9ezcKRYhfRUNcIpUgS1s6IDycGoCB3aYW_AUT_S5pP0sOhLNmQmtGWLUEsGkOGcM1KRAWB5IqTCF7wL1oRCPTMI_2IOx8RFlM/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-8511480366133729040</id><published>2010-01-12T08:32:00.001-08:00</published><updated>2010-06-18T08:54:40.050-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android Environment"/><title type='text'>Issues with running my first “Hello Android” application</title><content type='html'>Soon after I have the environment setup, I created my first Android application “Hello Android”. The app is sure simple, but I still run into some issues when running it. &lt;br /&gt;
The first one is “HelloAndroidConversion to Delvik format failed with error 1” (see screen shot below)&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizFtBIjRV_jWkUCzolZvL85vPx16zvCr6sfTq08PQF0JqwB6Vp85Nui6tJbIbwFVK9ozZZZRifOEgknB3l_gC0YrpWD3kAAWmYjgtVyILka_XDl2InDoOPRJj4UTHR-uoN_Y0dhlkplcY/s1600-h/image%5B2%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;37&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjX2H9fHA_iI1YU0b2EO3qRiDaBMHsZ70zFv8gwyfOjeNWOFwhzaxm5JM5Vh6DYTvPVcjyciRROJ27Dpy9bq-Wew0n2s1nfiUIsc4cZOozM775G7LDqLuoXRXMjfNMoqApov0hlfjogu7g/?imgmax=800&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;244&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
I am not a Java programmer and I have no idea what the issue is. After searching the answer on the Internet, I found the solution. That is go to “Project-Clean…” in Eclipse.&lt;br /&gt;
Then I received error “Could not find HelloAndroid.apk!”&lt;br /&gt;
&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTBnrp6QsHdEPCF5INpFVPd-NPezlUH-vdxo_2uu-lTRjydoXgy1slo-gYy43E0Nlx0RXeuFeoDYQx2k1luqviP2nA1i05jLKy6cWU9LNx50PiYorsGsAA7y9yWqVxTRsbvlXIaL3YoV0/s1600-h/image%5B5%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;30&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTjHhPz9GnDCvbE26VFBHGVG1kZZOgYYd8O3M17wPmBXfGJOzRChSNVALqe4pj3NUeNYgcoKcnLZTLyHUaSlVbsiLnHs4wwTE1dygV_PtyNkzDP1I_r_Zbw0cLsy8qw6AxqROVqYkZ-_Y/?imgmax=800&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;244&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
It turned out to be the path I added to the system variable. I added “C:\Android\GlassFish-Tools-Bundle-For-Eclipse-1.1\jre\bin” to Path in windows system environment variable. I removed “\bin” and do “Project-&amp;gt;Clean…” again. The issue is gone.&lt;br /&gt;
The emulator kept shutting down even after I passed these two issues. I had to start the emulator first. Even so, it failed to run it the first time. But it worked the second time and after. Strange!</content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/8511480366133729040/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/issues-with-running-my-first-hello.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/8511480366133729040'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/8511480366133729040'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/issues-with-running-my-first-hello.html' title='Issues with running my first “Hello Android” application'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjX2H9fHA_iI1YU0b2EO3qRiDaBMHsZ70zFv8gwyfOjeNWOFwhzaxm5JM5Vh6DYTvPVcjyciRROJ27Dpy9bq-Wew0n2s1nfiUIsc4cZOozM775G7LDqLuoXRXMjfNMoqApov0hlfjogu7g/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4488365782025760635.post-7057807805478465176</id><published>2010-01-07T18:23:00.001-08:00</published><updated>2010-06-18T08:38:08.360-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android Environment"/><title type='text'>Android Development Environment Setup</title><content type='html'>1. Download Android SDK 1.6&lt;br /&gt;
2. Download GlassFish tool bundle for Eclipse 1.1&lt;br /&gt;
&lt;blockquote&gt;&lt;span style=&quot;color: #cceedd;&quot;&gt;Don’t ask me why GlassFish. That is the first Eclipse tool I found, so I just installed it.&lt;/span&gt;&lt;/blockquote&gt;3. Install Android plug-in in Eclipse&lt;br /&gt;
&lt;blockquote&gt;If you got the “No repository found at &lt;a href=&quot;https://dl-ssl.google.com/android/eclipse/&quot;&gt;https://dl-ssl.google.com/android/eclipse/&lt;/a&gt;” error when using the URL on Andorid web site which is the checked one in the following screen shot, use the second URL on the screen instead.&lt;/blockquote&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWlTykazV8mQLv4mjCDS5c_yL-mbetus31nXIixLuJazc3blxJ-E2fh8XrzHrRl-FD21KzEpGDxWuEH8Wmqjr8pbFwNnvhUxl4DkwkBURooB8N_5dAUycbOTadzMiCugxjDZNqEYDr_lw/s1600-h/image%5B2%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;135&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSkQ1-rY5uQwfiG10QThIC8NKhKJXNiCKVI4sTut-AOtmyQQ6d8oHKV6vnZJVyywksGtStYn5x3ADnWH6AF1QClPrHXlByIkGsJasMURDbPHQSAM1LC7QjbqmH9NdMPh4D15tBmvooOHo/?imgmax=800&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;244&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
4. Install AVD(Android Virtual Device)&lt;br /&gt;
&lt;blockquote&gt;&lt;span style=&quot;color: #cceedd;&quot;&gt;\[Android sdk folder]\tools\android create avd –-target 2 –-name my_avd&lt;/span&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;span style=&quot;color: #cceedd;&quot;&gt;Don’t forget to &lt;/span&gt;add “[Eclipse folder]\jre” to the PATH in Environment Variables&lt;/blockquote&gt;5. Set up Android SDK location in Eclipse. Go to Windows-&amp;gt;Preferences&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMFUt1_B5lhOtrE9MO2V_iyppkmRmNnM1wEs2Zk0vCKQ28DKB_j_tHvK3Zxl5toAQ2ocANonVzRJgs-UyetLIsBbzgpg9hORZ8fqETyzMdaoIG4-6R5TvhgUBcIO1_v_63rWPOVBU-TOQ/s1600-h/image%5B8%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;89&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPFTRzo2pbiUDZjFJI2HyuSYQNMKXfxgahuWhRmm2xq5j_67aPqiAEPeCCJbi7D9kJlHptgLEgerMgLMoRZC55nNQqKuvgVQ9KEd_3_iiKnrSntUscvFTf-cX1EjF4k3Fvz5FIJPE2BUA/?imgmax=800&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;244&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://androidideasblog.blogspot.com/feeds/7057807805478465176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/android-development-environment-setup.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/7057807805478465176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4488365782025760635/posts/default/7057807805478465176'/><link rel='alternate' type='text/html' href='http://androidideasblog.blogspot.com/2010/01/android-development-environment-setup.html' title='Android Development Environment Setup'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSkQ1-rY5uQwfiG10QThIC8NKhKJXNiCKVI4sTut-AOtmyQQ6d8oHKV6vnZJVyywksGtStYn5x3ADnWH6AF1QClPrHXlByIkGsJasMURDbPHQSAM1LC7QjbqmH9NdMPh4D15tBmvooOHo/s72-c?imgmax=800" height="72" width="72"/><thr:total>1</thr:total></entry></feed>