<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>Howling at the Blackmoon</title>
	<atom:link href="http://www.blackmoonit.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blackmoonit.com</link>
	<description>Experiences of a wolf learning to build Androids</description>
	<lastBuildDate>Wed, 02 May 2012 23:51:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>File Browser 7.8 released!</title>
		<link>http://www.blackmoonit.com/2012/03/file-browser-7-8/</link>
		<comments>http://www.blackmoonit.com/2012/03/file-browser-7-8/#comments</comments>
		<pubDate>Tue, 27 Mar 2012 00:35:12 +0000</pubDate>
		<dc:creator>Uncle Code Monkey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[File Browser]]></category>
		<category><![CDATA[Promote]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[file browser]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://www.blackmoonit.com/?p=386</guid>
		<description><![CDATA[I have just published my latest File Browser release, version 7.8!  The app is available on a variety of markets, but you can also download it from here if you like. Lots of little improvements and bug fixes along with &#8230; <a href="http://www.blackmoonit.com/2012/03/file-browser-7-8/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have just published my latest File Browser release, version 7.8!  The app is available on a variety of markets, but you can also download it from here if you like. <div id='wpdm_file_3' class='wpdm_file wpdm-only-button'><div class='cont'><div class='btn_outer'><div class='btn_outer_c'><a class='btn_left  ' rel='3' title='Blackmoon File Browser APK' href='http://www.blackmoonit.com/?wpdmact=process&did=My5ob3RsaW5r'  >Blackmoon File Browser APK</a><span class='btn_right'>&nbsp;</span></div></div><div class='clear'></div></div></div></p>
<p>Lots of little improvements and bug fixes along with a couple of new features. You can read about all the change details over in the <a href="http://www.blackmoonit.com/android/filebrowser/versioninfo/">changelog</a>. The biggest changes are that  thumbnails are now being cached for 3 days and the new option to &#8220;Use Full Screen&#8221; which will hide the Notification Bar (aka Status Bar). The &#8220;Use Full Screen&#8221; option is only available to Android pre-3.0 since you cannot hide the Notification bar in 3.0 and 4.0+.</p>
<p>Thanks to all my translators for helping me with this update and a special thanks goes out to Raffaele Dell&#8217;Aversana for translating the entire app into Italian!</p>
<p>I hope you all enjoy using it as much as I do. =D</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackmoonit.com/2012/03/file-browser-7-8/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Android&#8217;s onCreateContextMenu() called with no ContextMenuInfo</title>
		<link>http://www.blackmoonit.com/2012/03/oncreatecontextmenu-menuinfo/</link>
		<comments>http://www.blackmoonit.com/2012/03/oncreatecontextmenu-menuinfo/#comments</comments>
		<pubDate>Sun, 25 Mar 2012 15:29:15 +0000</pubDate>
		<dc:creator>Uncle Code Monkey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[context menu]]></category>
		<category><![CDATA[exceptions]]></category>
		<category><![CDATA[listview]]></category>
		<category><![CDATA[mouse event]]></category>

		<guid isPermaLink="false">http://www.blackmoonit.com/?p=380</guid>
		<description><![CDATA[I recently had an exception report from an eeePC using a mouse which caused the following code to give a NullPointerException: public void onCreateContextMenu(ContextMenu aMenu, View aView, ContextMenuInfo aMenuInfo) { AdapterView.AdapterContextMenuInfo theMenuInfo = null; try { theMenuInfo = (AdapterView.AdapterContextMenuInfo) aMenuInfo; &#8230; <a href="http://www.blackmoonit.com/2012/03/oncreatecontextmenu-menuinfo/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently had an exception report from an eeePC using a mouse which caused the following code to give a NullPointerException:</p>
<pre class="brush:java">public void onCreateContextMenu(ContextMenu aMenu, View aView, ContextMenuInfo aMenuInfo) {
	AdapterView.AdapterContextMenuInfo theMenuInfo = null;
	try {
		theMenuInfo = (AdapterView.AdapterContextMenuInfo) aMenuInfo;
	} catch (ClassCastException e) {
		return;
	}
	File theFile = myActivity.getListItem(theMenuInfo.position);
	//...snip rest of code...
}</pre>
<p>The only way that theMenuInfo would be NULL in order to cause the NullPointerException is that the passed in aMenuInfo was NULL &#8212; and that is not supposed to be the case.</p>
<p>I am not quite sure how such an event occurred. It could be a result of &#8220;right-clicking&#8221; on a spot where there is no list item shown, except that the behavior in that case should have not resulted in a context menu since there is no item there at all. While I should not have to protect my code against a NULL being passed in for the required ContextMenuInfo parameter, I have to live in the world that <em>is</em>, not the world of <em>should</em>. Who knows, maybe this is the start of a trend where &#8220;right clicking&#8221; on the &#8220;white space&#8221; of a list will pass in NULL for that parameter and cause a completely different menu to popup for quick actions that provide the same functionality as clicking on the Menu button and choosing some deeper submenu from that list. Then again, it is probably just a bug in the OS and will be fixed at a later point in time. Either way, it&#8217;s best to protect against NULL parameters even if they should never be NULL.</p>
<p>My new code:</p>
<pre class="brush:java">public void onCreateContextMenu(ContextMenu aMenu, View aView, ContextMenuInfo aMenuInfo) {
	AdapterView.AdapterContextMenuInfo theMenuInfo = null;
	File theFile = null;
	try {
		theMenuInfo = (AdapterView.AdapterContextMenuInfo) aMenuInfo;
		theFile = myActivity.getListItem(theMenuInfo.position);
	} catch (ClassCastException cce) {
		return;
	} catch (NullPointerException npe) {
		return;
	}
	//...snip rest of code...
}</pre>
<p>If you know why the ContextMenuInfo parameter is sometimes NULL, please feel free to share the reason as I know several developers that would be interested in it besides myself.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackmoonit.com/2012/03/oncreatecontextmenu-menuinfo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SD Card speed class explained</title>
		<link>http://www.blackmoonit.com/2012/02/sd-card-speed-class-explained/</link>
		<comments>http://www.blackmoonit.com/2012/02/sd-card-speed-class-explained/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 16:29:39 +0000</pubDate>
		<dc:creator>Uncle Code Monkey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Promote]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[customer experience]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[Nexus One]]></category>
		<category><![CDATA[SD card]]></category>

		<guid isPermaLink="false">http://blackmoonit.com/?p=146</guid>
		<description><![CDATA[What class memory card to get for the Nexus One I was on the Google help forums this morning and I read a post by a guy who said he was getting a 16 gig class 6 memory card for &#8230; <a href="http://www.blackmoonit.com/2012/02/sd-card-speed-class-explained/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: medium;"><strong>What class memory card to get for the Nexus One</strong></span></p>
<p><a href="http://en.wikipedia.org/wiki/File:MicroSD_MemoryCard_002.jpg" target="_blank"><img class="alignright" style="border: 0pt none;" src="http://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/MicroSD_MemoryCard_002.jpg/189px-MicroSD_MemoryCard_002.jpg" alt="" width="188" height="229" border="0" /> </a>I was on the Google help forums this morning and I read a post by a guy who said he was getting a 16 gig class 6 memory card for his Nexus One so I figured I would come on here and explain why this individual is spending more money than necessary.</p>
<p>There are two things you need to consider when buying a memory card..</p>
<ul>
<li>Size</li>
<li>Speed</li>
</ul>
<p>I think most people understand size numbers. The bigger the number, the more music, pics, video, etc you can store on the card.</p>
<p>Speed on the other hand is a bit of a mystery to some.  <span id="more-146"></span>While bigger numbers mean faster speeds, device limitations are much more severe than size limitations. The common speeds right now are 2, 4 and 6 (I think Panasonic just came out with a 10)</p>
<p>Here is a list what each speed is good for.</p>
<p>Class 2 : H.264 video recording, MPEG-4, MPEG-2 video recording<br />
Class 4: MEPG-2 (HDTV) video recording, DSC consecutive shooting<br />
Class 6: Mega-pixel DSC consecutive shooting, professional video camera</p>
<p>As you can see, Class 6 is beyond overkill for the nexus one. This is intended for high-speed high definition video. Class 4 is also not necessary as it is intended for high-def recording. The nexus one video camera specs: MPEG-4 SP, H.264.</p>
<p>So please, don&#8217;t waste your money paying for speed you will never need. If you want to cover yourself just in case you decide to use the card for something else in the future, get yourself a Class 4. Otherwise stick with a high quality Class 2 card.</p>
<p>I like SanDisk cards the best. Here are two: (at really good prices)</p>
<p><strong><a href="http://www.amazon.com/gp/product/B000WPDKRI?ie=UTF8&amp;tag=nexfor-20&amp;link_code=as3&amp;camp=211189&amp;creative=373489&amp;creativeASIN=B000WPDKRI" target="_blank">SanDisk 8GB MicroSDHC Memory Card</a></strong></p>
<p><a href="http://www.amazon.com/gp/product/B001F6YRNO?ie=UTF8&amp;tag=nexfor-20&amp;link_code=as3&amp;camp=211189&amp;creative=373489&amp;creativeASIN=B001F6YRNO" target="_blank">Sandisk 16GB Microsd Card</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackmoonit.com/2012/02/sd-card-speed-class-explained/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New site</title>
		<link>http://www.blackmoonit.com/2012/02/new-site/</link>
		<comments>http://www.blackmoonit.com/2012/02/new-site/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 21:54:07 +0000</pubDate>
		<dc:creator>Uncle Code Monkey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.blackmoonit.com/?p=195</guid>
		<description><![CDATA[Hi everyone, I must apologize for being so quiet for so long.  My blog account with Blogger got frozen by Google when they consolidated their services and accounts.  I tried to work with Google&#8217;s help forums (as they have no &#8230; <a href="http://www.blackmoonit.com/2012/02/new-site/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hi everyone, I must apologize for being so quiet for so long.  My blog account with Blogger got frozen by Google when they consolidated their services and accounts.  I tried to work with Google&#8217;s help forums (as they have no other kind of help&#8230;.) in order to correct the issues I had, but to no avail &#8212; they don&#8217;t care about the little guy and my issues were completely ignored.  Since then, I have moved to a new Domain registrar thanks to GoDaddy&#8217;s stupidly backing SOPA and, with the help of a good friend, moved both my blog and my website into a combined whole.</p>
<p>The site is still a bit rough around the edges as I am still working on updating it, but the bulk has been moved over mostly intact and at least it&#8217;s not offline like it has been for a few weeks.  It will be nice to start posting again!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackmoonit.com/2012/02/new-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android: Proof that findViewById() is slower than using a ViewHolder</title>
		<link>http://www.blackmoonit.com/2011/06/proof-findviewbyid-slower-than-viewholder/</link>
		<comments>http://www.blackmoonit.com/2011/06/proof-findviewbyid-slower-than-viewholder/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 16:49:07 +0000</pubDate>
		<dc:creator>Uncle Code Monkey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Promote]]></category>
		<category><![CDATA[listview]]></category>

		<guid isPermaLink="false">http://blackmoonit.com/?p=124</guid>
		<description><![CDATA[I was recently asked to provide proof of why using a ViewHolder would be faster than just using findViewById() when populating the item views of each item in a ListView. A fair question since empirically stating &#8220;it seems faster&#8221; is &#8230; <a href="http://www.blackmoonit.com/2011/06/proof-findviewbyid-slower-than-viewholder/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I was recently asked to provide proof of why using a <a href="/2010/12/findviewbyid-slow-inside-listview/">ViewHolder</a> would be faster than just using findViewById() when populating the item views of each item in a ListView. A fair question since empirically stating &#8220;it seems faster&#8221; is hardly proof and my results may have been from other factors I had not thought of at the time. So, I delved into the Android source code and pulled a bit of research together to present proof <span id="more-124"></span>of why using a ViewHolder mechanism instead of findViewById() inside a ListView.getView() is more efficient and faster. I will be using Big O notation here, so if you need a refresher on it&#8217;s definition and meaning, I highly recommend skimming the definition over at <a href="http://en.wikipedia.org/wiki/Big_O_notation">Wiki</a> as well as reading a fairly clear explanation of the meaning of using Big O notation from <a href="http://www.cforcoding.com/2009/07/plain-english-explanation-of-big-o.html">William Shields</a>.</p>
<p>First, some assumptions need to be made. The list contains <em>m</em> number of items. Each item contains a ViewGroup, such as a LinearLayout or RelativeLayout, consisting of <em>n</em> number of views needing to be found and populated. Small numbers of either list items or views will not show a significant difference, but once you start using more than a handful of either, the difference become noticeable.</p>
<h3>findViewById() is O(<em>n</em>!)</h3>
<p>The findViewById() Android API method requires an algorithm to search your view hierarchy every time you call it by traversing the entire structure looking for the ID of your view. Traversing the hierarchy to find all <em>n</em> Views will result in the algorithm having O(<em>n</em>!) efficiency at best. A very simple example would be a LinearLayout with 5 views and no subchild views to search through. The first findViewById() would find the first view on the first child; the second find will read the first view and then the second; the third find would read the first, second, and then return the third view; and so on. You can verify my take on this algorithm by researching the Android source code yourself. To help get you started, I will point you to the ViewGroup&#8217;s method that actually <a href="http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.4_r1/android/view/ViewGroup.java#ViewGroup.findViewTraversal%28int%29">performs the find</a> (in Android 2.3.4 r1).</p>
<h3>ViewHolder is O(1)</h3>
<p>The ViewHolder mechanism stores the results returned by findViewById() in a HashMap and subsequent calls search the HashMap for the view instead of using findViewById(). In general, a hash algorithm is fast because it &#8220;hashes&#8221; the key and turns it directly into the location of the bin where the value is stored, making it an O(1) operation. Since we are using an int for our key and we are using Java&#8217;s HashMap, we have an O(1) efficiency (some discussion about this can be found <a href="http://stackoverflow.com/questions/1055243/is-a-java-hashmap-really-o1">here</a>).</p>
<h3>O(<em>m</em>) is better than O(<em>m n</em>!)</h3>
<p>Comparing the two methods, ViewHolder is the best case scenario with O(1) and findViewById() comes in second with O(<em>n</em>!), but the distinction becomes even more apparent when you factor in the fact that these methods are done for <em>each item</em> in your list. O(<em>m</em>) is noticeably more efficient than O(<em>m n</em>!) &#8212; depending on the values of <em>m</em> and <em>n</em>, this can sometimes be better or worse than O(<em>m</em><sup>2</sup>), but it will always be worse than O(<em>m</em>) for lists with more than 1 item.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackmoonit.com/2011/06/proof-findviewbyid-slower-than-viewholder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android: Notification Icons</title>
		<link>http://www.blackmoonit.com/2011/06/android-notification-icons/</link>
		<comments>http://www.blackmoonit.com/2011/06/android-notification-icons/#comments</comments>
		<pubDate>Sun, 05 Jun 2011 17:53:33 +0000</pubDate>
		<dc:creator>Uncle Code Monkey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[icons]]></category>

		<guid isPermaLink="false">http://blackmoonit.com/?p=120</guid>
		<description><![CDATA[The Android notification bar has been white for a very long time. A great many apps that put up icons inside this bar create black icons with transparencies so they appear black on white when viewed against this white notification &#8230; <a href="http://www.blackmoonit.com/2011/06/android-notification-icons/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The Android notification bar has been white for a very long time. A great many apps that put up icons inside this bar create black icons with transparencies so they appear black on white when viewed against this white notification bar. Unfortunately, with Android 2.3.3+ and 3.0+, the notification bar is now black. Black icons on black bars do not show up well at all.</p>
<p>I highly advise against creating separate icons for the different versions and instead offer the tip of creating a white background for your black icons. In my apps that require a notification icon, I gave the icons a round, white background that used the alpha channel to fade the white from the center to the edge. The effect is that on the older, white notification bars, no difference is detected since white fading into white is the same thing as nothing at all. On a black background, however, the effect is that my black icon is visible within a white circle that fades to black, making it look like a modern, 3D rounded icon.</p>
<p><a href="http://blackmoonit.com/wp-content/uploads/2011/09/music_icon_diff_themes.png"><img class="alignnone size-medium wp-image-121" title="music_icon_diff_themes" src="http://blackmoonit.com/wp-content/uploads/2011/09/music_icon_diff_themes-300x67.png" alt="Example Notification Icon" width="300" height="67" /></a></p>
<p>Personally, I detest the current state of my 2.3.4 phone&#8217;s notification colors since most of the apps currently use black or dark grey notification icons (including stock apps) and as such makes it nearly impossible to see them at a glance when checking my phone for messages out in bright daylight. Whomever&#8217;s bright idea it was to push this change out to phones that have been using and expecting white notification bars for years now should be given a painful wedgie!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackmoonit.com/2011/06/android-notification-icons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Query Result Loops</title>
		<link>http://www.blackmoonit.com/2011/04/php-query-result-loops/</link>
		<comments>http://www.blackmoonit.com/2011/04/php-query-result-loops/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 14:20:20 +0000</pubDate>
		<dc:creator>Uncle Code Monkey</dc:creator>
				<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[queries]]></category>

		<guid isPermaLink="false">http://blackmoonit.com/?p=118</guid>
		<description><![CDATA[Pro Tip: when you loop through the results of a query like this: $theDatabase-&#62;getSqlData($theSQLtext); while ( $theDatabase-&#62;getNextRow() ) {     //... do a ton of stuff ... } I would like to point out that it will fail eventually. Why? Oh there&#8217;s nothing &#8230; <a href="http://www.blackmoonit.com/2011/04/php-query-result-loops/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Pro Tip:</strong> when you loop through the results of a query like this:</p>
<pre class="brush:php">$theDatabase-&gt;getSqlData($theSQLtext);
while ( $theDatabase-&gt;getNextRow() ) {
    //... do a ton of stuff ...
}</pre>
<p>I would like to point out that it <strong><em>will fail</em> </strong>eventually. Why? Oh there&#8217;s nothing wrong with it, per se&#8230;</p>
<p>But if somewhere in all of that ton of stuff inside the while loop you ask the database for something else (like a small list of items for a drop down control), then when you get back to the &#8220;while&#8221; line, it will now either return the wrong data row or most likely just end prematurely &#8212; because of lazy coding!</p>
<p>All that is needed to avoid this hard to detect bug, is to save off the query result given in the first line and use it in the &#8220;while&#8221; line. No question now which row will be returned and everything will be correct no matter how many nested database calls you put inside the while loop.</p>
<pre class="brush:php">$theQueryResult = $theDatabase-&gt;getSqlData($theSQLtext);
while ( $theDatabase-&gt;getNextRow($theQueryResult) ) {
    //... do a ton of stuff...
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.blackmoonit.com/2011/04/php-query-result-loops/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android Dialogs and onContextItemSelected()</title>
		<link>http://www.blackmoonit.com/2011/03/android-dialogs-and-oncontextitemselected/</link>
		<comments>http://www.blackmoonit.com/2011/03/android-dialogs-and-oncontextitemselected/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 20:39:51 +0000</pubDate>
		<dc:creator>Uncle Code Monkey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[listview]]></category>
		<category><![CDATA[submenu]]></category>

		<guid isPermaLink="false">http://blackmoonit.com/?p=116</guid>
		<description><![CDATA[ListViews and GridViews are great widgets to use in an Activity for your app. Sometimes it is useful to also create smaller versions of them for dialogs within your app. There&#8217;s only one problem: Context Menus. If you have tried &#8230; <a href="http://www.blackmoonit.com/2011/03/android-dialogs-and-oncontextitemselected/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>ListViews and GridViews are great widgets to use in an Activity for your app. Sometimes it is useful to also create smaller versions of them for dialogs within your app. There&#8217;s only one problem: Context Menus. If you have tried to put a context menu on a ListView inside a dialog, you may have found out that while onCreateContextMenu() is called, onContextItemSelected() is not. There is a workaround, though, because onContextItemSelected() is actually a convenience method called from onMenuItemSelected(int, MenuItem). If you add the following method to your dialog containing the ListView (or GridView), you will find that onContextItemSelected() is working again.</p>
<pre class="brush:java">@Override
public boolean onMenuItemSelected(int aFeatureId, MenuItem aMenuItem) {
    if (aFeatureId==Window.FEATURE_CONTEXT_MENU)
        return onContextItemSelected(aMenuItem);
    else
        return super.onMenuItemSelected(aFeatureId, aMenuItem);
}</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackmoonit.com/2011/03/android-dialogs-and-oncontextitemselected/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Android: Programmatically Show the Soft Keyboard, If Needed</title>
		<link>http://www.blackmoonit.com/2011/03/android-show-soft-keyboard/</link>
		<comments>http://www.blackmoonit.com/2011/03/android-show-soft-keyboard/#comments</comments>
		<pubDate>Sat, 26 Mar 2011 19:54:23 +0000</pubDate>
		<dc:creator>Uncle Code Monkey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[customer experience]]></category>
		<category><![CDATA[keyboard]]></category>

		<guid isPermaLink="false">http://blackmoonit.com/?p=114</guid>
		<description><![CDATA[If you are expecting user input, a polite app will check to see if there is a hardware keyboard and if one is not present, then automatically display one so the user does not have to click the edit box &#8230; <a href="http://www.blackmoonit.com/2011/03/android-show-soft-keyboard/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you are expecting user input, a polite app will check to see if there is a hardware keyboard and if one is not present, then automatically display one so the user does not have to click the edit box first in order to pop one up. This kind of behavior is especially nice if there is only one input box being presented. While there are a few methods available out on the net in various places, I wrote my own to be compatible with Android 1.5+ and works in all cases where a keyboard is not part of the physical device as well as does nothing if a physical device has a keyboard.</p>
<p>The source code provided is written from the perspective of a static utility class.</p>
<pre class="brush:java">    /**
     * Show soft keyboard if device does not already have a hardware one available.
     * @param aView - the View that will receive the keyboard input
     */
    public static void popKeyboard(final View aView) {
        aView.post(new Runnable() {
            @Override
            public void run() {
                ((InputMethodManager)aView.getContext().getSystemService(
                        Context.INPUT_METHOD_SERVICE)).showSoftInput(aView,
                        InputMethodManager.SHOW_IMPLICIT);
            }
        });
    }</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.blackmoonit.com/2011/03/android-show-soft-keyboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android ListView and setSelection</title>
		<link>http://www.blackmoonit.com/2011/03/android-listview-and-setselection/</link>
		<comments>http://www.blackmoonit.com/2011/03/android-listview-and-setselection/#comments</comments>
		<pubDate>Sat, 26 Mar 2011 02:33:46 +0000</pubDate>
		<dc:creator>Uncle Code Monkey</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[customer experience]]></category>
		<category><![CDATA[listview]]></category>

		<guid isPermaLink="false">http://blackmoonit.com/?p=112</guid>
		<description><![CDATA[Android&#8217;s ListView is a powerful class that is capable of presenting a list of whatever you wish fairly easily. One of the issues that has vexed me has been scrolling the ListView to a particular entry. While newer Android versions &#8230; <a href="http://www.blackmoonit.com/2011/03/android-listview-and-setselection/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Android&#8217;s ListView is a powerful class that is capable of presenting a list of whatever you wish fairly easily. One of the issues that has vexed me has been scrolling the ListView to a particular entry. While newer Android versions have provided better support in this area, trying to maintain backward compatibility with Android 1.5 presents some challenges. In light of this <a href="http://code.google.com/p/android/issues/detail?id=6741">Google issue</a> and it&#8217;s comments, I have come up with a decent method of scrolling a ListView to a particular position if it is not already visible. I clear the focus after setting the selection because users became confused at why an &#8220;orange box suddenly appeared&#8221; when they did not expressly tap a selection with their finger or scroll with the trackball.</p>
<pre class="brush:java">//this method would be part of a ListView class
    @Override
    public void scrollToPosition(final int anItemPos) {
        if (anItemPos!=AdapterView.INVALID_POSITION) {
            int theFirstItemPos = getFirstVisibleItemPos();
            int theLastItemPos = getLastVisibleItemPos();
            if (anItemPos&lt;theFirstItemPos || theLastItemPos&lt;anItemPos) {
                getListView().post(new Runnable() {
                    @Override
                    public void run() {
                        getListView().setSelection(anItemPos);
                        getListView().clearFocus();
                    }    
                });
            }
        }
    }</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.blackmoonit.com/2011/03/android-listview-and-setselection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

