<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Android Tales</title>
	
	<link>http://android.amberfog.com</link>
	<description>Just another Android developers blog</description>
	<lastBuildDate>Fri, 03 Sep 2010 12:59:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AndroidTales" /><feedburner:info uri="androidtales" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Disable animation between Activities in Android</title>
		<link>http://feedproxy.google.com/~r/AndroidTales/~3/fy3BuMd0S98/</link>
		<comments>http://android.amberfog.com/?p=498#comments</comments>
		<pubDate>Fri, 03 Sep 2010 12:59:32 +0000</pubDate>
		<dc:creator>villain_dm</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[reflection]]></category>
		<category><![CDATA[disable animation]]></category>
		<category><![CDATA[FLAG_ACTIVITY_NO_ANIMATION]]></category>
		<category><![CDATA[overridePendingTransition]]></category>

		<guid isPermaLink="false">http://android.amberfog.com/?p=498</guid>
		<description><![CDATA[Sometimes you may want to disable Activity start/end animation. Here&#8217;re some tricks how to do this. Use FLAG_ACTIVITY_NO_ANIMATION flag. If you compile your code for 1.5 &#8211; just use 65536 Intent intent = new Intent(xxx); intent.addFlags(65536); // no animation (api 5) startActivity(intent); But you will still have animations after finish() events in your Activity. To [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you may want to disable Activity start/end animation. Here&#8217;re some tricks how to do this.</p>
<ol>
<li>Use FLAG_ACTIVITY_NO_ANIMATION flag. If you compile your code for 1.5 &#8211; just use 65536
<pre class="brush: java;">
Intent intent = new Intent(xxx);
intent.addFlags(65536); // no animation (api 5)
startActivity(intent);
</pre>
</li>
<li>But you will still have animations after finish() events in your Activity. To remove this &#8211; call overridePendingTransition function (Activity class, api 5) with zero arguments right after finish().<br />
If you compile your code for 1.5&#8230; just use reflection! <img src='http://android.amberfog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre class="brush: java;">
Class myTarget;
Class[] paramTypes = {
       Integer.TYPE, Integer.TYPE
};
Method myMethod = null;
...
try {
    myTarget = Class.forName(&quot;android.app.Activity&quot;);
    myMethod = myTarget.getDeclaredMethod(&quot;overridePendingTransition&quot;, paramTypes);
} catch (Exception e) {
    e.printStackTrace();
}
...
finish();
try {
    myMethod.invoke(this, 0, 0); // this - your Activity instance
} catch (Exception e) {
    e.printStackTrace();
}
</pre>
</li>
</ol>
<p>//DL</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://android.amberfog.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><img src="http://feeds.feedburner.com/~r/AndroidTales/~4/fy3BuMd0S98" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://android.amberfog.com/?feed=rss2&amp;p=498</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://android.amberfog.com/?p=498</feedburner:origLink></item>
		<item>
		<title>How to quick create QR-code for your Android application</title>
		<link>http://feedproxy.google.com/~r/AndroidTales/~3/c7sViqSRUkY/</link>
		<comments>http://android.amberfog.com/?p=485#comments</comments>
		<pubDate>Wed, 11 Aug 2010 10:28:10 +0000</pubDate>
		<dc:creator>goalstudio</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[Android Market]]></category>
		<category><![CDATA[Google Chart API]]></category>
		<category><![CDATA[QR-code]]></category>

		<guid isPermaLink="false">http://android.amberfog.com/?p=485</guid>
		<description><![CDATA[Sometimes you need QR-code to be posted somewhere to promote your Android application. You can use a lot of online tools to create such image, but from my point of view the fastest way is to use Google Chart API for this. What do you need is to create URL-request to Google Chart API with [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you need QR-code to be posted somewhere to promote your Android application. You can use a lot of online tools to create such image, but from my point of view the fastest way is to use Google Chart API for this.<br />
What do you need is to create URL-request to Google Chart API with correct parameters:</p>
<p>1. The main part is URL:</p>
<pre class="brush: plain; gutter: false; highlight: [1]; wrap-lines: true;">

http://chart.apis.google.com/chart?cht=qr
</pre>
<p>where cht=qr is the first parameter saying that we need QR-code.</p>
<p>2. Then adding image size, for example 200&#215;200 pixels:</p>
<pre class="brush: plain; gutter: false; highlight: [1]; wrap-lines: true;">

http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200
</pre>
<p>3. At last you should add label to be encoded in QR-code, and you need to have direct link to Android Market with your application. To do this you need to create market:// scheme url:</p>
<pre class="brush: plain; gutter: false; highlight: [1]; wrap-lines: true;">
market://details?id=com.your.packagename
</pre>
<p>where &#8220;com.your.packagename&#8221; is the main package name of your application. Now add it to the full charts url:</p>
<pre class="brush: plain; gutter: false; highlight: [1]; wrap-lines: true;">

http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market://details?id=com.yota.screentest
</pre>
<p>The result of it is the QR-code image that you can add as src to img html tag:<br />
<img src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market://details?id=com.yota.screentest"></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://android.amberfog.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><img src="http://feeds.feedburner.com/~r/AndroidTales/~4/c7sViqSRUkY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://android.amberfog.com/?feed=rss2&amp;p=485</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://android.amberfog.com/?p=485</feedburner:origLink></item>
		<item>
		<title>long or notlong</title>
		<link>http://feedproxy.google.com/~r/AndroidTales/~3/u4nSswxaZbg/</link>
		<comments>http://android.amberfog.com/?p=478#comments</comments>
		<pubDate>Sat, 12 Jun 2010 10:17:35 +0000</pubDate>
		<dc:creator>villain_dm</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[xml layout]]></category>
		<category><![CDATA[aspect ratio]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[long]]></category>
		<category><![CDATA[notlong]]></category>
		<category><![CDATA[resource]]></category>

		<guid isPermaLink="false">http://android.amberfog.com/?p=478</guid>
		<description><![CDATA[As you know you can name layout or resource folders with &#8220;-long&#8221; or &#8220;-notlong&#8221; postfix. Documentation says: long - resources for screens of any size or density that have a significantly taller (in portrait mode) and wider (in landscape mode) aspect ratio than the baseline screen configuration. notlong - resources for use only on screens [...]]]></description>
			<content:encoded><![CDATA[<p>As you know you can name layout or resource folders with &#8220;-long&#8221; or &#8220;-notlong&#8221; postfix.<br />
<a href="http://developer.android.com/guide/practices/screens_support.html" target="_blank"> Documentation</a> says:</p>
<ol>
<li><strong>long </strong>- resources for screens of any size or density that have a significantly taller (in portrait mode) and wider (in landscape mode) aspect ratio  than the baseline screen configuration.</li>
<li><strong>notlong </strong>- resources for use only on screens that have an aspect ratio that is similar to the baseline screen configuration.</li>
</ol>
<p>What does it mean in practice?</p>
<p>hvga &#8211; notlong<br />
qvga &#8211; notlong<br />
wqvga400 &#8211; long<br />
wqvga432 &#8211; long<br />
wvga800 &#8211; long<br />
wvga854 &#8211; long</p>
<p>i.e. if you have aspect ration &gt; 1.5 like 1.78 (480&#215;854) <strong>long </strong>folders will be used by Android.</p>
<p>For example if you scale layout hvga (1.5) to wvga854 (1.78) &#8211; you should take into account additional 480*1.5=720; 854-730=134 pixels in the middle.</p>
<p>p.s. Motorola <a href="http://community.developer.motorola.com/t5/MOTODEV-Blog/Developing-for-the-Motorola-FLIPOUT/ba-p/5657" target="_blank">Flipout</a> is <strong>notlong </strong>also because it is just landscape qvga.</p>
<p>//DL</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://android.amberfog.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><img src="http://feeds.feedburner.com/~r/AndroidTales/~4/u4nSswxaZbg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://android.amberfog.com/?feed=rss2&amp;p=478</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://android.amberfog.com/?p=478</feedburner:origLink></item>
		<item>
		<title>How to use PhantomReference</title>
		<link>http://feedproxy.google.com/~r/AndroidTales/~3/0_0I31wHaWo/</link>
		<comments>http://android.amberfog.com/?p=470#comments</comments>
		<pubDate>Tue, 08 Jun 2010 15:03:18 +0000</pubDate>
		<dc:creator>villain_dm</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[PhantomReference]]></category>
		<category><![CDATA[ReferenceQueue]]></category>
		<category><![CDATA[reflection]]></category>
		<category><![CDATA[ressurection]]></category>

		<guid isPermaLink="false">http://android.amberfog.com/?p=470</guid>
		<description><![CDATA[What is PhantomReference? They allow you to determine exactly when an object was removed from memory. They are in fact the only way to determine that. This isn&#8217;t generally that useful, but might come in handy in certain very specific circumstances like manipulating large images: if you know for sure that an image should be [...]]]></description>
			<content:encoded><![CDATA[<p>What is PhantomReference?</p>
<ul></ul>
<ol>
<li>They allow you to determine exactly when an object was removed from memory. They are in fact the only way to determine that. This isn&#8217;t generally that useful, but might come in handy in certain very specific circumstances like manipulating large images: if you know for sure that an image should be garbage collected, you can wait until it actually is before attempting to load the next image, and therefore make the dreaded OutOfMemoryError less likely [<a href="http://weblogs.java.net/blog/enicholas/archive/2006/05/understanding_w.html" target="_blank">read more</a>]</li>
<li>The  main advantage of using a PhantomReference over finalize() is that  finalize() is called by a garbage-collector thread, meaning it  introduces concurrency even in a single-threaded program, with all the  potential issues (like correctly synchronizing shared state). With a  PhantomReference, you choose the thread that dequeues references from your  queue (in a single-threaded program, that thread could periodically do  this job) [<a href="http://code-o-matic.blogspot.com/2009/01/subtleties-of-phantomreference-and.html" target="_blank">read more</a>]</li>
</ol>
<ul></ul>
<p>Read more about references here: <a href="http://www.ibm.com/developerworks/library/j-refs/" target="_blank">http://www.ibm.com/developerworks/library/j-refs/</a></p>
<p>See example in Email application in Android platform: <a href="http://google.com/codesearch/p?hl=en#SS2by_AKaLs/src/org/apache/commons/io/FileCleaningTracker.java" target="_blank">http://google.com/codesearch/p?hl=en#SS2by_AKaLs/src/org/apache/commons/io/FileCleaningTracker.java</a></p>
<p>Btw, you can also ressurect object with reflection (<a href="http://code-o-matic.blogspot.com/2009/01/subtleties-of-phantomreference-and.html" target="_blank">http://code-o-matic.blogspot.com/2009/01/subtleties-of-phantomreference-and.html</a>)</p>
<p>Here&#8217;re small exaple of usage:</p>
<pre class="brush: java;">
import java.lang.ref.PhantomReference;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.reflect.Field;
import java.util.ArrayList;

public class MemoryTest {
    private ReferenceQueue&lt;Data&gt; mQueue = new ReferenceQueue&lt;Data&gt;();
    private boolean mIsRun = true;

    public void test() {

        final ArrayList&lt;PhantomReference&lt;Data&gt;&gt; blocks = new ArrayList&lt;PhantomReference&lt;Data&gt;&gt;();
        ArrayList&lt;Data&gt; dataArray = new ArrayList&lt;Data&gt;();
        System.out.println(&quot;occupied mem 1 = &quot; + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
        for (int i = 0; i &lt; 10; i++) {
            Data data = new Data(i);
            PhantomReference&lt;Data&gt; ref = new PhantomReference&lt;Data&gt;(data, mQueue);
            blocks.add(ref);
            dataArray.add(data);
        }
        System.out.println(&quot;occupied mem 2 = &quot; + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
        System.out.println(&quot;remove strong ref to object 0 and 1&quot;);
        dataArray.remove(0);
        dataArray.remove(0);
        new Thread() {
            public void run() {
                System.out.println(&quot;thread started&quot;);
                while (mIsRun) {
                    Reference&lt;?&gt; ref = null;
                    try {
                        ref = mQueue.remove(1000);
                    } catch (IllegalArgumentException e) {
                        e.printStackTrace();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    if (ref != null) {
                        System.out.println(&quot;&gt;&gt; removed ref = &quot; + ref);
                        blocks.remove(ref);
                        Field f = null;
                        try {
                            f = Reference.class.getDeclaredField(&quot;referent&quot;);
                            f.setAccessible(true);
                            System.out.println(&quot;I see dead objects! --&gt; &quot; + f.get(ref));
                        } catch (SecurityException e) {
                            e.printStackTrace();
                        } catch (NoSuchFieldException e) {
                            e.printStackTrace();
                        } catch (IllegalAccessException e) {
                            e.printStackTrace();
                        }
                    }
                }
                System.out.println(&quot;thread ended&quot;);
            }
        }.start();
        System.out.println(&quot;objects created&quot;);
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(&quot;occupied mem 2 = &quot; + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
        System.out.println(&quot;run gc() to make object enqueued&quot;);
        System.gc();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(&quot;collect memory&quot;);
        System.runFinalization();
        System.gc();
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(&quot;occupied mem 4 = &quot; + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
        mIsRun = false;
    }

    private static class Data {
        int id;
        byte[] memoryBlock = new byte[1048576];

        public Data(int id) {
            this.id = id;
            System.out.println(&quot;Data created: &quot; + this);
        }

        @Override
        public String toString() {
            return &quot;{id=&quot; + id + &quot; &quot; + super.toString() + &quot;}&quot;;
        }
    }
}
</pre>
<p>What we can see in LogCat:</p>
<pre class="brush: plain; highlight: [5,9,31,39,42,43,44,45,47,48];">
06-08 14:38:51.154: INFO/System.out(1385): occupied mem 1 = 2186800
06-08 14:38:51.254: DEBUG/dalvikvm(1385): GC freed 845 objects / 56288 bytes in 94ms
06-08 14:38:51.295: INFO/dalvikvm-heap(1385): Grow heap (frag case) to 4.119MB for 1048592-byte allocation
06-08 14:38:51.394: DEBUG/dalvikvm(1385): GC freed 11 objects / 544 bytes in 93ms
06-08 14:38:51.404: INFO/System.out(1385): Data created: {id=0 com.gtug.test.MemoryTest$Data@4373e658}
06-08 14:38:51.484: DEBUG/dalvikvm(1385): GC freed 22 objects / 1456 bytes in 80ms
06-08 14:38:51.534: INFO/dalvikvm-heap(1385): Grow heap (frag case) to 5.119MB for 1048592-byte allocation
06-08 14:38:51.724: DEBUG/dalvikvm(1385): GC freed 159 objects / 7136 bytes in 191ms
06-08 14:38:51.734: INFO/System.out(1385): Data created: {id=1 com.gtug.test.MemoryTest$Data@4372b7e8}
06-08 14:38:51.825: DEBUG/dalvikvm(1385): GC freed 20 objects / 1352 bytes in 92ms
06-08 14:38:51.865: INFO/dalvikvm-heap(1385): Grow heap (frag case) to 6.112MB for 1048592-byte allocation
06-08 14:38:51.965: DEBUG/dalvikvm(1385): GC freed 36 objects / 18336 bytes in 96ms
06-08 14:38:51.974: INFO/System.out(1385): Data created: {id=2 com.gtug.test.MemoryTest$Data@43734338}
06-08 14:38:52.054: DEBUG/dalvikvm(1385): GC freed 20 objects / 1344 bytes in 87ms
06-08 14:38:52.105: INFO/dalvikvm-heap(1385): Grow heap (frag case) to 7.112MB for 1048592-byte allocation
06-08 14:38:52.204: DEBUG/dalvikvm(1385): GC freed 0 objects / 0 bytes in 98ms
06-08 14:38:52.214: INFO/System.out(1385): Data created: {id=3 com.gtug.test.MemoryTest$Data@4372a968}
06-08 14:38:52.285: INFO/System.out(1385): Data created: {id=4 com.gtug.test.MemoryTest$Data@4372a498}
06-08 14:38:52.375: DEBUG/dalvikvm(1385): GC freed 44 objects / 2888 bytes in 92ms
06-08 14:38:52.455: INFO/System.out(1385): Data created: {id=5 com.gtug.test.MemoryTest$Data@43736180}
06-08 14:38:52.565: DEBUG/dalvikvm(1385): GC freed 25 objects / 1464 bytes in 102ms
06-08 14:38:52.635: INFO/System.out(1385): Data created: {id=6 com.gtug.test.MemoryTest$Data@4372b950}
06-08 14:38:52.755: DEBUG/dalvikvm(1385): GC freed 28 objects / 1584 bytes in 116ms
06-08 14:38:52.804: INFO/ActivityManager(578): Displayed activity com.gtug.test/.PhantomTest: 2327 ms
06-08 14:38:52.875: INFO/System.out(1385): Data created: {id=7 com.gtug.test.MemoryTest$Data@4373b680}
06-08 14:38:53.065: DEBUG/dalvikvm(1385): GC freed 26 objects / 1600 bytes in 179ms
06-08 14:38:53.104: INFO/System.out(1385): Data created: {id=8 com.gtug.test.MemoryTest$Data@437381a8}
06-08 14:38:53.185: DEBUG/dalvikvm(1385): GC freed 24 objects / 1504 bytes in 74ms
06-08 14:38:53.224: INFO/System.out(1385): Data created: {id=9 com.gtug.test.MemoryTest$Data@4373aec8}
06-08 14:38:53.235: INFO/System.out(1385): occupied mem 2 = 12600240
06-08 14:38:53.235: INFO/System.out(1385): remove strong ref to object 0 and 1
06-08 14:38:53.244: INFO/System.out(1385): thread started
06-08 14:38:53.244: INFO/System.out(1385): objects created
06-08 14:38:56.254: INFO/System.out(1385): run gc() -&gt; overrided finalyze print
06-08 14:38:56.324: DEBUG/dalvikvm(1385): GC freed 45 objects / 2512 bytes in 74ms
06-08 14:38:56.334: INFO/System.out(1385): Data finalized: {id=1 com.gtug.test.MemoryTest$Data@4372b7e8}
06-08 14:38:56.334: INFO/System.out(1385): Data finalized: {id=0 com.gtug.test.MemoryTest$Data@4373e658}
06-08 14:38:58.184: DEBUG/dalvikvm(622): GC freed 119 objects / 5872 bytes in 79ms
06-08 14:38:59.344: INFO/System.out(1385): occupied mem 3 = 12602504
06-08 14:38:59.344: INFO/System.out(1385): run gc() second time to make object enqueued
06-08 14:38:59.434: DEBUG/dalvikvm(1385): GC freed 45 objects / 2944 bytes in 85ms
06-08 14:38:59.434: INFO/System.out(1385): &gt;&gt; removed ref = java.lang.ref.PhantomReference@4373a4c0
06-08 14:38:59.434: INFO/System.out(1385): I see dead objects! --&gt; {id=1 com.gtug.test.MemoryTest$Data@4372b7e8}
06-08 14:38:59.434: INFO/System.out(1385): &gt;&gt; removed ref = java.lang.ref.PhantomReference@437343f8
06-08 14:38:59.434: INFO/System.out(1385): I see dead objects! --&gt; {id=0 com.gtug.test.MemoryTest$Data@4373e658}
06-08 14:39:02.446: INFO/System.out(1385): collect memory
06-08 14:39:02.524: DEBUG/dalvikvm(1385): GC freed 75 objects / 2101968 bytes in 76ms
06-08 14:39:07.554: INFO/System.out(1385): occupied mem 4 = 10503728
06-08 14:39:08.454: INFO/System.out(1385): thread ended&lt;!--more--&gt;
</pre>
<p>happy coding!</p>
<p>//DL</pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://android.amberfog.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><img src="http://feeds.feedburner.com/~r/AndroidTales/~4/0_0I31wHaWo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://android.amberfog.com/?feed=rss2&amp;p=470</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://android.amberfog.com/?p=470</feedburner:origLink></item>
		<item>
		<title>HTC Legend &amp; Desire Grayscale Reproduction Issue</title>
		<link>http://feedproxy.google.com/~r/AndroidTales/~3/i6ruidOgZJ0/</link>
		<comments>http://android.amberfog.com/?p=460#comments</comments>
		<pubDate>Thu, 03 Jun 2010 12:38:57 +0000</pubDate>
		<dc:creator>goalstudio</dc:creator>
				<category><![CDATA[HTC]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[AMOLED]]></category>
		<category><![CDATA[grayscale issue]]></category>
		<category><![CDATA[grayscale reproduction]]></category>
		<category><![CDATA[HTC Desire]]></category>
		<category><![CDATA[HTC Legend]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[ScreenTest]]></category>

		<guid isPermaLink="false">http://android.amberfog.com/?p=460</guid>
		<description><![CDATA[It was reported by Phandroid that all or some of HTC Legend and Desire Android smartphones have poor grayscale reproduction. Now you can quick check your HTC device does it have this grayscale issue or not using small tool from Android Market &#8211; Screen Test. Originally application was created to help in dead pixels finding. [...]]]></description>
			<content:encoded><![CDATA[<p>It was <a href="http://phandroid.com/2010/06/02/does-the-htc-legend-screen-have-poor-grayscale-reproduction/">reported by Phandroid</a> that all or some of HTC Legend and Desire Android smartphones have poor grayscale reproduction.</p>
<p><a href="http://android.amberfog.com/wp-content/uploads/2010/06/htclegendgrayscale-small.jpg"><img class="aligncenter size-full wp-image-465" src="http://android.amberfog.com/wp-content/uploads/2010/06/htclegendgrayscale-small.jpg" alt="" width="300" height="189" /></a></p>
<p>Now you can quick check your HTC device does it have this grayscale issue or not using small tool from Android Market &#8211; <strong>Screen Test</strong>.<br />
Originally application was created to help in dead pixels finding. Current release has some extra useful screens to test your device and now includes grayscale gradient to be sure that your HTC Legend or Desire phone is fine.</p>
<p>You can download application from Android Market by searching &#8220;Screen Test&#8221; or just scan QR-code below.</p>
<p><img src="http://qrcode.kaywa.com/img.php?s=5&amp;d=market%3A%2F%2Fdetails%3Fid%3Dcom.yota.screentest" alt="ScreenTest QR Code" /></p>
<p>And don&#8217;t forget to comment on this or  <a href="http://phandroid.com/2010/06/02/does-the-htc-legend-screen-have-poor-grayscale-reproduction/">original Phandroid post</a> to clarify is this is the issue for all HTC Legend phones or not.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://android.amberfog.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><img src="http://feeds.feedburner.com/~r/AndroidTales/~4/i6ruidOgZJ0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://android.amberfog.com/?feed=rss2&amp;p=460</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://android.amberfog.com/?p=460</feedburner:origLink></item>
		<item>
		<title>Android 2.2 Froyo new APIs</title>
		<link>http://feedproxy.google.com/~r/AndroidTales/~3/1xe-c0HhKTQ/</link>
		<comments>http://android.amberfog.com/?p=452#comments</comments>
		<pubDate>Wed, 26 May 2010 13:50:17 +0000</pubDate>
		<dc:creator>goalstudio</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[2.2]]></category>
		<category><![CDATA[froyo]]></category>

		<guid isPermaLink="false">http://android.amberfog.com/?p=452</guid>
		<description><![CDATA[Just a reference list of classes. Make sure you haven&#8217;t missed some of them like AndroidHttpClient or HeterogeneousExpandableList. http://developer.android.com/sdk/api_diff/8/changes.html Completely new packages: android.app.admin android.app.backup javax.xml.datatype javax.xml.namespace javax.xml.transform javax.xml.transform.dom javax.xml.transform.sax javax.xml.transform.stream javax.xml.validation javax.xml.xpath org.w3c.dom.ls New classes android.app SearchableInfo UiModeManager android.content DialogInterface.OnShowListener EntityIterator Entity PeriodicSync SyncInfo android.gesture GestureUtils ImageFormat YuvImage android.hardware Camera.OnZoomChangeListener android.media AudioManager.OnAudioFocusChangeListener MediaScannerConnection.OnScanCompletedListener SoundPool.OnLoadCompleteListener CamcorderProfile [...]]]></description>
			<content:encoded><![CDATA[<p>Just a reference list of classes. Make sure you haven&#8217;t missed some of them like <a href="http://developer.android.com/reference/android/net/http/AndroidHttpClient.html">AndroidHttpClient</a> or <a href="http://developer.android.com/reference/android/widget/HeterogeneousExpandableList.html">HeterogeneousExpandableList</a>.</p>
<p><a href="http://developer.android.com/sdk/api_diff/8/changes.html" target="_blank">http://developer.android.com/sdk/api_diff/8/changes.html</a></p>
<p>Completely new packages:</p>
<ul>
<li><a href="http://developer.android.com/reference/android/app/admin/package-summary.html">android.app.admin</a></li>
<li><a href="http://developer.android.com/reference/android/app/backup/package-summary.html">android.app.backup</a></li>
<li><a href="http://developer.android.com/reference/javax/xml/datatype/package-summary.html"> </a></li>
<li><a href="http://developer.android.com/reference/javax/xml/datatype/package-summary.html">javax.xml.datatype</a></li>
<li><a href="http://developer.android.com/reference/javax/xml/namespace/package-summary.html">javax.xml.namespace</a></li>
<li><a href="http://developer.android.com/reference/javax/xml/transform/package-summary.html">javax.xml.transform</a></li>
<li><a href="http://developer.android.com/reference/javax/xml/transform/dom/package-summary.html">javax.xml.transform.dom</a></li>
<li><a href="http://developer.android.com/reference/javax/xml/transform/sax/package-summary.html">javax.xml.transform.sax</a></li>
<li><a href="http://developer.android.com/reference/javax/xml/transform/stream/package-summary.html">javax.xml.transform.stream</a></li>
<li><a href="http://developer.android.com/reference/javax/xml/validation/package-summary.html">javax.xml.validation</a></li>
<li><a href="http://developer.android.com/reference/javax/xml/xpath/package-summary.html">javax.xml.xpath</a></li>
<li><a href="http://developer.android.com/reference/org/w3c/dom/ls/package-summary.html">org.w3c.dom.ls</a></li>
</ul>
<p>New classes</p>
<p><strong><a href="http://developer.android.com/reference/android/app/package-summary.html">android.app</a><a href="http://developer.android.com/reference/android/app/SearchableInfo.html"> </a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/app/SearchableInfo.html">SearchableInfo</a></li>
<li><a href="http://developer.android.com/reference/android/app/UiModeManager.html">UiModeManager</a></li>
</ul>
<p><span id="more-452"></span></p>
<p><strong><a href="http://developer.android.com/reference/android/content/package-summary.html">android.content</a><a href="http://developer.android.com/reference/android/content/DialogInterface.OnShowListener.html"> </a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/content/DialogInterface.OnShowListener.html">DialogInterface.OnShowListener</a></li>
<li><a href="http://developer.android.com/reference/android/content/EntityIterator.html">EntityIterator</a></li>
<li><a href="http://developer.android.com/reference/android/content/Entity.html">Entity</a></li>
<li><a href="http://developer.android.com/reference/android/content/PeriodicSync.html">PeriodicSync</a></li>
<li><a href="http://developer.android.com/reference/android/content/SyncInfo.html">SyncInfo</a></li>
</ul>
<p><strong><a href="http://developer.android.com/reference/android/gesture/package-summary.html">android.gesture</a><a href="http://developer.android.com/reference/android/gesture/GestureUtils.html"> </a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/gesture/GestureUtils.html">GestureUtils</a></li>
<li><a href="http://developer.android.com/reference/android/graphics/ImageFormat.html">ImageFormat</a></li>
<li><a href="http://developer.android.com/reference/android/graphics/YuvImage.html">YuvImage</a></li>
</ul>
<p><strong><a href="http://developer.android.com/reference/android/hardware/package-summary.html">android.hardware</a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/hardware/Camera.OnZoomChangeListener.html">Camera.OnZoomChangeListener</a></li>
</ul>
<p><strong><a href="http://developer.android.com/reference/android/media/package-summary.html">android.media</a><a href="http://developer.android.com/reference/android/media/AudioManager.OnAudioFocusChangeListener.html"> </a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/media/AudioManager.OnAudioFocusChangeListener.html">AudioManager.OnAudioFocusChangeListener</a></li>
<li><a href="http://developer.android.com/reference/android/media/MediaScannerConnection.OnScanCompletedListener.html">MediaScannerConnection.OnScanCompletedListener</a></li>
<li><a href="http://developer.android.com/reference/android/media/SoundPool.OnLoadCompleteListener.html">SoundPool.OnLoadCompleteListener</a></li>
<li><a href="http://developer.android.com/reference/android/media/CamcorderProfile.html">CamcorderProfile</a></li>
<li><a href="http://developer.android.com/reference/android/media/CameraProfile.html">CameraProfile</a></li>
<li><a href="http://developer.android.com/reference/android/media/ThumbnailUtils.html">ThumbnailUtils</a></li>
</ul>
<p><strong><a href="http://developer.android.com/reference/android/net/package-summary.html">android.net</a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/net/SSLSessionCache.html">SSLSessionCache</a></li>
<li><a href="http://developer.android.com/reference/android/net/TrafficStats.html">TrafficStats</a></li>
</ul>
<p><strong><a href="http://developer.android.com/reference/android/net/http/package-summary.html">android.net.http</a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/net/http/AndroidHttpClient.html">AndroidHttpClient</a></li>
<li><a href="http://developer.android.com/reference/android/net/http/SslError.html">SslError</a></li>
</ul>
<p><strong><a href="http://developer.android.com/reference/android/opengl/package-summary.html">android.opengl</a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/opengl/ETC1.html">ETC1</a></li>
<li><a href="http://developer.android.com/reference/android/opengl/ETC1Util.html">ETC1Util</a></li>
<li><a href="http://developer.android.com/reference/android/opengl/ETC1Util.ETC1Texture.html">ETC1Util.ETC1Texture</a></li>
<li><a href="http://developer.android.com/reference/android/opengl/GLES20.html">GLES20</a></li>
</ul>
<p><strong><a href="http://developer.android.com/reference/android/os/package-summary.html">android.os</a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/os/RecoverySystem.ProgressListener.html">RecoverySystem.ProgressListener</a></li>
<li><a href="http://developer.android.com/reference/android/os/DropBoxManager.html">DropBoxManager</a></li>
<li><a href="http://developer.android.com/reference/android/os/DropBoxManager.Entry.html">DropBoxManager.Entry</a></li>
<li><a href="http://developer.android.com/reference/android/os/RecoverySystem.html">RecoverySystem</a></li>
</ul>
<p><strong><a href="http://developer.android.com/reference/android/speech/package-summary.html">android.speech</a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/speech/RecognitionListener.html">RecognitionListener</a></li>
<li><a href="http://developer.android.com/reference/android/speech/RecognitionService.html">RecognitionService</a><br />
<a href="http://developer.android.com/reference/android/speech/RecognitionService.Callback.html">RecognitionService.Callback</a></li>
<li><a href="http://developer.android.com/reference/android/speech/SpeechRecognizer.html">SpeechRecognizer</a></li>
</ul>
<p><strong><a href="http://developer.android.com/reference/android/test/mock/package-summary.html">android.test.mock</a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/test/mock/MockContentProvider.html">MockContentProvider</a></li>
<li><a href="http://developer.android.com/reference/android/test/mock/MockCursor.html">MockCursor</a></li>
</ul>
<p><strong><a href="http://developer.android.com/reference/android/text/style/package-summary.html">android.text.style</a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/text/style/LeadingMarginSpan.LeadingMarginSpan2.html">LeadingMarginSpan.LeadingMarginSpan2</a></li>
</ul>
<p><strong><a href="http://developer.android.com/reference/android/util/package-summary.html">android.util</a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/util/Base64.html">Base64</a></li>
<li><a href="http://developer.android.com/reference/android/util/Base64InputStream.html">Base64InputStream</a></li>
<li><a href="http://developer.android.com/reference/android/util/Base64OutputStream.html">Base64OutputStream</a></li>
<li><a href="http://developer.android.com/reference/android/util/EventLog.html">EventLog</a></li>
<li><a href="http://developer.android.com/reference/android/util/EventLog.Event.html">EventLog.Event</a></li>
<li><a href="http://developer.android.com/reference/android/util/Patterns.html">Patterns</a></li>
</ul>
<p><strong><a href="http://developer.android.com/reference/android/view/package-summary.html">android.view</a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/view/ScaleGestureDetector.OnScaleGestureListener.html">ScaleGestureDetector.OnScaleGestureListener</a></li>
<li><a href="http://developer.android.com/reference/android/view/ScaleGestureDetector.html">ScaleGestureDetector</a></li>
<li><a href="http://developer.android.com/reference/android/view/ScaleGestureDetector.SimpleOnScaleGestureListener.html">ScaleGestureDetector.SimpleOnScaleGestureListener</a></li>
</ul>
<p><strong><a href="http://developer.android.com/reference/android/webkit/package-summary.html">android.webkit</a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/webkit/ConsoleMessage.html">ConsoleMessage</a></li>
<li><a href="http://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel.html">ConsoleMessage.MessageLevel</a></li>
<li><a href="http://developer.android.com/reference/android/webkit/WebSettings.PluginState.html">WebSettings.PluginState</a></li>
</ul>
<p><strong><a href="http://developer.android.com/reference/android/widget/package-summary.html">android.widget</a></strong></p>
<ul>
<li><a href="http://developer.android.com/reference/android/widget/HeterogeneousExpandableList.html">HeterogeneousExpandableList</a></li>
</ul>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://android.amberfog.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><img src="http://feeds.feedburner.com/~r/AndroidTales/~4/1xe-c0HhKTQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://android.amberfog.com/?feed=rss2&amp;p=452</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://android.amberfog.com/?p=452</feedburner:origLink></item>
		<item>
		<title>Metal Android</title>
		<link>http://feedproxy.google.com/~r/AndroidTales/~3/iPWQSU4Tr78/</link>
		<comments>http://android.amberfog.com/?p=445#comments</comments>
		<pubDate>Sat, 22 May 2010 08:41:32 +0000</pubDate>
		<dc:creator>goalstudio</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[handmade]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[metal]]></category>

		<guid isPermaLink="false">http://android.amberfog.com/?p=445</guid>
		<description><![CDATA[It&#8217;s just great! Share passion to the Droids:) source: http://vkontakte.ru/album-15955496_105624045]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s just great! Share passion to the Droids:)</p>

<a href='http://android.amberfog.com/?attachment_id=446' title='Metal Handmade Google Android'><img width="150" height="150" src="http://android.amberfog.com/wp-content/uploads/2010/05/1-150x150.jpg" class="attachment-thumbnail" alt="Metal Handmade Google Android" title="Metal Handmade Google Android" /></a>
<a href='http://android.amberfog.com/?attachment_id=447' title='Metal Handmade Google Android'><img width="150" height="150" src="http://android.amberfog.com/wp-content/uploads/2010/05/2-150x150.jpg" class="attachment-thumbnail" alt="Metal Handmade Google Android" title="Metal Handmade Google Android" /></a>
<a href='http://android.amberfog.com/?attachment_id=448' title='Metal Handmade Google Android'><img width="150" height="150" src="http://android.amberfog.com/wp-content/uploads/2010/05/3-150x150.jpg" class="attachment-thumbnail" alt="Metal Handmade Google Android" title="Metal Handmade Google Android" /></a>

<p>source: <a title="Vkontakte Android Fans" href="http://vkontakte.ru/album-15955496_105624045" target="_blank">http://vkontakte.ru/album-15955496_105624045</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://android.amberfog.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><img src="http://feeds.feedburner.com/~r/AndroidTales/~4/iPWQSU4Tr78" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://android.amberfog.com/?feed=rss2&amp;p=445</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://android.amberfog.com/?p=445</feedburner:origLink></item>
		<item>
		<title>Transparency problem after Bitmap copy in Android 2.1</title>
		<link>http://feedproxy.google.com/~r/AndroidTales/~3/zhf8aVo2XwM/</link>
		<comments>http://android.amberfog.com/?p=430#comments</comments>
		<pubDate>Wed, 28 Apr 2010 14:05:03 +0000</pubDate>
		<dc:creator>selfsames</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[alpha channel]]></category>
		<category><![CDATA[Android transparency problem]]></category>
		<category><![CDATA[ARGB_8888]]></category>
		<category><![CDATA[bitmap]]></category>
		<category><![CDATA[Bitmap.copy]]></category>

		<guid isPermaLink="false">http://android.amberfog.com/?p=430</guid>
		<description><![CDATA[In our application we need to apply mask to some icons to make them semitransparent. The original images are in RGB format i.e. without alpha channel. To apply mask we need add alpha channel to original images. Before Android 2.0 we did this like: Bitmap dest = src.copy(Bitmap.Config.ARGB_8888, true); When we run our application on [...]]]></description>
			<content:encoded><![CDATA[<p>In our application we need to apply mask to some icons to make them semitransparent. The original images are in RGB format i.e. without alpha channel. To apply mask we need add alpha channel to original images. Before Android 2.0 we did this like:</p>
<pre class="brush: java; gutter: false;">
Bitmap dest = src.copy(Bitmap.Config.ARGB_8888, true);
</pre>
<p>When we run our application on Android 2.1 device we noticed that the destination bitmap is created but without alpha channel. After applying mask, pixels that should be semitransparent become black.</p>
<p>The getPixel() method returns different value than was set by setPixel() method.</p>
<p>So, how to add alpha channel to RGB bitmap?</p>
<p>There are three ways:</p>
<p>First:</p>
<p>Use ARGB_4444 format:</p>
<pre class="brush: java; gutter: false;">
Bitmap dest = src.copy(Bitmap.Config.ARGB_4444, true);
</pre>
<p>In this case the alpha channel will be added, but you will lose the quality of image</p>
<p>Second:</p>
<p>Create empty bitmap with dimensions of original image and ARGB_8888 format:</p>
<pre class="brush: java; gutter: false;">
int width =  src.getWidth();
int height = src.getHeight();
Bitmap dest = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
</pre>
<p>Copy pixels from source bitmap to the int array:</p>
<pre class="brush: java; gutter: false;">
int[] pixels = new int[width * height];
src.getPixels(pixels, 0, width, 0, 0, width, height);
</pre>
<p>And set these pixels to destination bitmap:</p>
<pre class="brush: java; gutter: false;">
dest.setPixels(pixels, 0, width, 0, 0, width, height);
</pre>
<p>The alpha channel will be added without losing image quality. But this way is too slow ~ 5027ms average for 1000 bitmaps</p>
<p>Third: (Thanks to Cyril Mottier <a href="http://android.cyrilmottier.com/?p=230" target="_blank">post</a>)</p>
<p>First of all you need to create mask image which you want to apply to the icon and put it in to the resources.</p>
<p>Then you need to create Paint object and set xfermode to it:</p>
<pre class="brush: java; gutter: false;">
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
</pre>
<p>And draw source bitmap and mask on canvas:</p>
<pre class="brush: java; gutter: false;">
canvas.drawBitmap(src, 0, 0, null);
canvas.drawBitmap(icon, 0, 0, paint);
</pre>
<p>This way requires to have mask image (you can&#8217;t modify source bitmap on the fly), but it is fast (~ 2659ms average for 1000 bitmaps) and without quality loss</pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://android.amberfog.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><img src="http://feeds.feedburner.com/~r/AndroidTales/~4/zhf8aVo2XwM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://android.amberfog.com/?feed=rss2&amp;p=430</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://android.amberfog.com/?p=430</feedburner:origLink></item>
		<item>
		<title>Google Android secret_code for testing</title>
		<link>http://feedproxy.google.com/~r/AndroidTales/~3/7ZiNUtuP__A/</link>
		<comments>http://android.amberfog.com/?p=422#comments</comments>
		<pubDate>Wed, 28 Apr 2010 13:04:28 +0000</pubDate>
		<dc:creator>goalstudio</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[*#*#4636#*#*]]></category>
		<category><![CDATA[android secret codes]]></category>
		<category><![CDATA[android.provider.Telephony.SECRET_CODE]]></category>
		<category><![CDATA[android_secret_code]]></category>
		<category><![CDATA[dialer]]></category>
		<category><![CDATA[secret code]]></category>

		<guid isPermaLink="false">http://android.amberfog.com/?p=422</guid>
		<description><![CDATA[Found today a post Go to phone app Dial *#*#4636#*#* See secret test menu:) I&#8217;ve looked deep into platform code. Here&#8217;s are the code from Phone.git static boolean handleSecretCode(Context context, String input) { // Secret codes are in the form *#*#&#60;code&#62;#*#* int len = input.length(); if (len &#62; 8 &#38;&#38; input.startsWith(&#34;*#*#&#34;) &#38;&#38; input.endsWith(&#34;#*#*&#34;)) { Intent [...]]]></description>
			<content:encoded><![CDATA[<p>Found today <a href="http://www.androidsoftwaredeveloper.com/2010/04/27/built-in-testing-app/" target="_blank">a post</a></p>
<ol>
<li>Go to phone app</li>
<li>Dial *#*#4636#*#*</li>
<li>See secret test menu:)</li>
</ol>
<p style="text-align: center;"><a href="http://android.amberfog.com/wp-content/uploads/2010/04/device.png"><img class="size-full wp-image-423 aligncenter" title="Google Android secret test menu" src="http://android.amberfog.com/wp-content/uploads/2010/04/device.png" alt="*#*#4636#*#*" width="320" height="480" /></a></p>
<p><a href="http://android.amberfog.com/wp-content/uploads/2010/04/device.png"></a>I&#8217;ve looked deep into platform code. Here&#8217;s are the code from Phone.git</p>
<pre class="brush: java;">
    static boolean handleSecretCode(Context context, String input) {
        // Secret codes are in the form *#*#&lt;code&gt;#*#*
        int len = input.length();
        if (len &gt; 8 &amp;&amp; input.startsWith(&quot;*#*#&quot;) &amp;&amp; input.endsWith(&quot;#*#*&quot;)) {
            Intent intent = new Intent(Intents.SECRET_CODE_ACTION,
                    Uri.parse(&quot;android_secret_code://&quot; + input.substring(4, len - 4)));
            context.sendBroadcast(intent);
            return true;
        }

        return false;
    }
</pre>
<p>So, let&#8217;s search for Intent filters:</p>
<p><strong>Settings.git</strong></p>
<pre class="brush: java;">
        &lt;receiver android:name=&quot;TestingSettingsBroadcastReceiver&quot;&gt;
            &lt;intent-filter&gt;
                 &lt;action android:name=&quot;android.provider.Telephony.SECRET_CODE&quot; /&gt;
                 &lt;data android:scheme=&quot;android_secret_code&quot; android:host=&quot;4636&quot; /&gt;
            &lt;/intent-filter&gt;
       &lt;/receiver&gt;
</pre>
<p><strong>CalendarProvider.git</strong> (this one works only on &gt;2.0)</p>
<pre class="brush: java;">
        &lt;receiver android:name=&quot;TestingSettingsBroadcastReceiver&quot;&gt;
            &lt;intent-filter&gt;
                 &lt;action android:name=&quot;android.provider.Telephony.SECRET_CODE&quot; /&gt;
                 &lt;data android:scheme=&quot;android_secret_code&quot; android:host=&quot;225&quot; /&gt;
            &lt;/intent-filter&gt;
       &lt;/receiver&gt;
</pre>
<p><strong>VoiceDialer.git</strong></p>
<pre class="brush: java;">
      &lt;!--  Voice Dialer Logging Enabled, *#*#VDL1#*#* --&gt;
      &lt;intent-filter&gt;
        &lt;action android:name=&quot;android.provider.Telephony.SECRET_CODE&quot; /&gt;
        &lt;data android:scheme=&quot;android_secret_code&quot; android:host=&quot;8351&quot; /&gt;
      &lt;/intent-filter&gt;

      &lt;!--  Voice Dialer Logging Disabled, *#*#VDL0#*#* --&gt;
      &lt;intent-filter&gt;
        &lt;action android:name=&quot;android.provider.Telephony.SECRET_CODE&quot; /&gt;
        &lt;data android:scheme=&quot;android_secret_code&quot; android:host=&quot;8350&quot; /&gt;
      &lt;/intent-filter&gt;
</pre>
<p>You can add your own codes!:)</p>
<p>//DL</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://android.amberfog.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><img src="http://feeds.feedburner.com/~r/AndroidTales/~4/7ZiNUtuP__A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://android.amberfog.com/?feed=rss2&amp;p=422</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://android.amberfog.com/?p=422</feedburner:origLink></item>
		<item>
		<title>Add Headset button support to your Android application</title>
		<link>http://feedproxy.google.com/~r/AndroidTales/~3/AbOTADA1EMw/</link>
		<comments>http://android.amberfog.com/?p=415#comments</comments>
		<pubDate>Tue, 27 Apr 2010 13:59:44 +0000</pubDate>
		<dc:creator>goalstudio</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[device]]></category>
		<category><![CDATA[headset]]></category>
		<category><![CDATA[intent]]></category>
		<category><![CDATA[ACTION_MEDIA_BUTTON]]></category>
		<category><![CDATA[bluetooth]]></category>
		<category><![CDATA[broadcast]]></category>
		<category><![CDATA[headset android support]]></category>

		<guid isPermaLink="false">http://android.amberfog.com/?p=415</guid>
		<description><![CDATA[It&#8217;s relatively easy to add headset button support to your application. For example you want to play/pause media playback in your super media player. But here are a few moments that you should take into consideration: You should register your broadcast receiver inside your application (not in manifest file). Otherwise Google Music player will catch [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s relatively easy to add headset button support to your application. For example you want to play/pause media playback in your super media player.</p>
<p>But here are a few moments that you should take into consideration:</p>
<ul></ul>
<ol>
<li>You should register your broadcast receiver inside your application (not in manifest file). Otherwise Google Music player will catch your broadcast and aboard it. <a href="http://android.git.kernel.org/?p=platform/packages/apps/Music.git;a=blob;f=src/com/android/music/MediaButtonIntentReceiver.java" target="_blank">http://android.git.kernel.org/?p=platform/packages/apps/Music.git;a=blob;f=src/com/android/music/MediaButtonIntentReceiver.java</a></li>
<li>Your IntentFilter priority should be higher that other media players priorities in your phone:) That&#8217;s kind of tricky thing.</li>
</ol>
<ul></ul>
<p>The code snippet will look like:</p>
<pre class="brush: java;">
MediaButtonIntentReceiver mMediaButtonReceiver = new MediaButtonIntentReceiver();
IntentFilter mediaFilter = new IntentFilter(Intent.ACTION_MEDIA_BUTTON);
mediaFilter.setPriority(MEDIA_BUTTON_INTENT_EMPIRICAL_PRIORITY_VALUE);
registerReceiver(mMediaButtonReceiver, mediaFilter);
</pre>
<p>And MediaButtonIntentReceiver.java</p>
<pre class="brush: java;">
public class MediaButtonIntentReceiver extends BroadcastReceiver {

    public MediaButtonIntentReceiver() {
        super();
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        String intentAction = intent.getAction();
        if (!Intent.ACTION_MEDIA_BUTTON.equals(intentAction)) {
            return;
        }
        KeyEvent event = (KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
        if (event == null) {
            return;
        }
        int action = event.getAction();
        if (action == KeyEvent.ACTION_DOWN) {
	    // do something
        }
        abortBroadcast();
    }
}
</pre>
<ol>
<li>Don&#8217;t forget to unregister your broadcast receiver</li>
<li>Add &#8220;android.permission.BLUETOOTH&#8221; permission if you want to support bluetooth headset</li>
</ol>
<p>// DL</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://android.amberfog.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><img src="http://feeds.feedburner.com/~r/AndroidTales/~4/AbOTADA1EMw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://android.amberfog.com/?feed=rss2&amp;p=415</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://android.amberfog.com/?p=415</feedburner:origLink></item>
	</channel>
</rss>
