<?xml version="1.0" encoding="UTF-8"?>
<!--Generated by Squarespace Site Server v5.11.81 (http://www.squarespace.com/) on Tue, 29 May 2012 09:17:36 GMT--><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>Java Blog</title><link>http://glennbech.com/java-en/</link><description></description><lastBuildDate>Sun, 27 May 2012 22:02:18 +0000</lastBuildDate><copyright></copyright><language>en-US</language><generator>Squarespace Site Server v5.11.81 (http://www.squarespace.com/)</generator><item><title>A couple of IntelliJ live templates for Android developers</title><dc:creator>Glenn Bech</dc:creator><pubDate>Thu, 03 Nov 2011 06:50:27 +0000</pubDate><link>http://glennbech.com/java-en/2011/11/3/a-couple-of-intellij-live-templates-for-android-developers.html</link><guid isPermaLink="false">364421:8518338:13576831</guid><description><![CDATA[<p>IntelliJ is very good at making developers type less. When developing Android however; I find myself typing a couple of lines over and over. I have created a few Live templates to save some finger work.</p>
<p>This Live template creates a static TAG string than can be used for logging &nbsp;&nbsp;</p>
<blockquote>
<p>private static String TAG = $className$.class.getName();</p>
</blockquote>
<p>&nbsp;This Live tmplate creates a Toast.</p>
<blockquote>
<div id="_mcePaste">Toast.makeText(this,"$TEXT$", Toast.LENGTH_LONG).show();</div>
</blockquote>
<div></div>
<p>&nbsp;Do you have any Live templates for Android that you want to share?</p>
<p>&nbsp;</p>]]></description><wfw:commentRss>http://glennbech.com/java-en/rss-comments-entry-13576831.xml</wfw:commentRss></item><item><title>The Google Plus App for Android does not respect the background data setting</title><dc:creator>Glenn Bech</dc:creator><pubDate>Sat, 03 Sep 2011 07:49:19 +0000</pubDate><link>http://glennbech.com/java-en/2011/9/3/the-google-plus-app-for-android-does-not-respect-the-backgro.html</link><guid isPermaLink="false">364421:8518338:12716645</guid><description><![CDATA[<p><span id="internal-source-marker_0.061782138189300895"><span class="full-image-float-left ssNonEditable"><span><img src="http://www.simonjstuart.com/wp-content/uploads/2011/07/google_plus-150x150.png?__SQUARESPACE_CACHEVERSION=1315036261611" alt="" /></span></span></span><span>In the Account/Sync menu on Android phones there is a setting that a user can check to allow or deny data traffic from applications that are running in the background. The value of this setting is available to developers in the API through the getBackgroundDataSetting method on the ConnectivityManager.</span></p>
<p><span>The documentation says</span><br /><br /><em><span>&ldquo;Developers should respect this setting, and check the value of this before performing any background data operations.&rdquo; </span><br /></em><br /><span>The wording is &ldquo;</span><span>should</span><span>&rdquo;, and I suspect that many developers either forget, ignore or do not know this. Why should your app be polite and respect the setting, when the rest of the world does not? &nbsp;</span>Even the official Google Plus App totally ignores this and uploads your photos via the &ldquo;Instant upload&rdquo;, regardless of the setting. Here is how to test it:</p>
<p>1. Make sure WIFI is disabled, and mobile data is enbaled<br />2. In the Account/Sync page in your Android settings, disable the "Background data setting".<br />3. Make sure you have the "Instant upload" setting enabled in Google Plus.&nbsp;<br />4. Take a photo<br />5. In a couple of minutes the image will be available online.</p>
<p>The concept of having a common setting for background data is a great idea and very user friendly. The user shouldn't have to disable background data in every single app. Some apps may even lack a setting to turn data off.&nbsp;</p>
<p><span>I suspect that google is stuck between a rock and a hard place right now. If they change the Android operating system to enforce this setting, a lot of applications would be cut off from the Internet, including their own.&nbsp;</span></p>
<p><span>Why not enforce the setting, or remove it? Right now it gives users a false <br />sense of&nbsp;</span>security. It also adds confusion since a lot of apps ignore the setting. Google could also practice what they preach and respect &nbsp;the setting in their own applications to set a good example.</p>]]></description><wfw:commentRss>http://glennbech.com/java-en/rss-comments-entry-12716645.xml</wfw:commentRss></item><item><title>Ny norsk Android app på market</title><dc:creator>Glenn Bech</dc:creator><pubDate>Tue, 02 Aug 2011 05:02:59 +0000</pubDate><link>http://glennbech.com/java-en/2011/8/2/ny-norsk-android-app-pa-market.html</link><guid isPermaLink="false">364421:8518338:12364827</guid><description><![CDATA[<p><span class="full-image-float-left ssNonEditable"><span><a href="https://market.android.com/details?id=com.glennbech&amp;feature=search_result"><img src="http://glennbech.com/storage/solbrennt.png?__SQUARESPACE_CACHEVERSION=1312262073844" alt="" /></a></span></span><a href="https://market.android.com/details?id=com.glennbech&amp;feature=search_result">Jeg har n&aring; publisert Android applikasjonen "Solbrent" som viser UV data fra Yr.no.</a> Man kan sjekke applikasjonen f&oslash;r man reiser p&aring; stranda, og se hvor sterk sola er den dagen.</p>
<p>V&aelig;r obs p&aring; at applikasjonen laster ned mye data. Det finnes ikke noe god m&aring;te &aring; sl&aring; opp UV indeksen for en gitt lokasjon i APIet til yr. Jeg &nbsp;m&aring; derfor lese igjennom hele XML dokumentet til man finner en UV m&aring;ling som er i n&aelig;rheten av brukerens lokasjon.&nbsp;</p>
<p>Denne applikasjonen fikke en noe trang f&oslash;dsel med en rekke problemer f&oslash;rste uken;&nbsp;</p>
<p>Det er flere pixler p&aring; HTC Sensation enn Samsung Galaxy 2 og en del andre "store" Android telefoner. Veldig mange av de nyere og store telefonene har en oppl&oslash;sning p&aring; 480 x 800, mens min HTC Sensation har 960 x 540. Dette gjorde at noe av innholdet i appen ble skj&oslash;vet utenfor skjermen.</p>
<p>Lokasjon, Lokasjon, Lokasjon. Hvorfor skal dette v&aelig;re s&aring; vanskelig?</p>
<p>Jeg kl&oslash;net til i konstruksjon av URLen jeg henter UV-XML data ifra. Istedet for <strong>2007-08-01</strong> som var riktig datoformat, laget min applikasjon URLer uten ledende null-tegn p&aring; dag; <strong>2007-08-1 </strong>(!) Dette gjorde at applikasjonen krasjet 1. August og oppdatering var n&oslash;dvendig. Unit testing ville plukket opp dette! &nbsp; &nbsp;&nbsp;</p>
<p><strong>Leassons learned</strong></p>
<p>Enhetstesting er minst like viktig p&aring; Android som ved Enterprise</p>
<p>Lokasjon er vanskelig! <a href="http://android-developers.blogspot.com/2011/06/deep-dive-into-location.html">En ganske god artikkel, som ogs&aring; belyser hvor vanskelig dette egentlig er; ble publisert av Reto Meier.</a>&nbsp;Koden han har skrevet er langt fra perfekt, og inneholder konkrete feil. N&aring;r Google kl&oslash;ner det det til er det ikke enkelt!</p>
<p>Stream-basert parsing er nyttig n&aring;r man &oslash;nsker &aring; l&oslash;pe igjennom et XML dokument helt til man finner det man er interessert i, og s&aring; avslutte. Man har to alternativer; SAX Parseren i JDKen, og XMLPullParser som er innebygget i rammeverket.&nbsp;</p>
<p>&nbsp;</p>]]></description><wfw:commentRss>http://glennbech.com/java-en/rss-comments-entry-12364827.xml</wfw:commentRss></item><item><title>Unable to add window -- token null is not for an application</title><dc:creator>Glenn Bech</dc:creator><pubDate>Tue, 19 Jul 2011 21:26:33 +0000</pubDate><link>http://glennbech.com/java-en/2011/7/19/unable-to-add-window-token-null-is-not-for-an-application.html</link><guid isPermaLink="false">364421:8518338:12185257</guid><description><![CDATA[<div id="_mcePaste">I have encountered this problem twice now, So I can just as well put it up here.&nbsp;</div>
<div></div>
<div>If you get this error, or something like it, you are probably working on an Android app that uses the maps library.&nbsp;If I add an Overlay to a map by extending the&nbsp;ItemizedOverlay class, I must provide a constructor that keeps a reference to the Context.</div>
<div></div>
<div></div>
<div></div>
<div></div>
<div>
<div></div>
<blockquote>
<div>public SomeItemizedOverlay(Drawable marker, Context context) {</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; super(boundCenterBottom(marker));</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; this.mContext = context;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; populate();</div>
<div>&nbsp;}</div>
</blockquote>
<div></div>
</div>
<div></div>
<div></div>
<div>When I implement the onTap method I give the context to a AlertDialog.Builder</div>
<div></div>
<div></div>
<div></div>
<blockquote>
<div>&nbsp; &nbsp; @Override</div>
<div>&nbsp; &nbsp; protected boolean onTap(int index) {</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; dialog.setTitle("Title");</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; dialog.setMessage("Message");</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; dialog.show();</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; return true;</div>
<div>&nbsp; &nbsp; }&nbsp;</div>
<div></div>
</blockquote>
<div></div>
<div>It is VERY importalt that the Context given to the AlertDialog.Builder is the Activity that extends MapActivity. If you do not, you end up with the exception below.</div>
<div></div>
<div>So, the code&nbsp;</div>
<div></div>
<div></div>
<div></div>
<div>
<blockquote>
<div><em>SomeItemizedOverlay overlay =</em></div>
<div><em><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;new&nbsp;</span>SomeItemizedOverlay&nbsp;<span>(marker, <strong>getApplicationContext</strong>());</span></em></div>
<div></div>
</blockquote>
</div>
<div></div>
<div></div>
<div>Does not work, but the following does&nbsp;</div>
<div></div>
<div>
<div></div>
<div></div>
<blockquote>
<div><em>SomeItemizedOverlay&nbsp;<span>overlay =</span></em></div>
<div><em>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new&nbsp;SomeItemizedOverlay&nbsp;(marker, <strong>this)</strong>;</em></div>
<div><em><br /></em></div>
</blockquote>
</div>
<div></div>
<div></div>
<div>ERROR/AndroidRuntime(29246): FATAL EXCEPTION: main</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewRoot.setView(ViewRoot.java:562)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.app.Dialog.show(Dialog.java:265)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.app.AlertDialog$Builder.show(AlertDialog.java:802)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at com.norsktrafikkinfo.activities.RoadMessagesItemizedOverlay.onTap(RoadMessagesItemizedOverlay.java:46)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at com.google.android.maps.ItemizedOverlay.onTap(ItemizedOverlay.java:453)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at com.google.android.maps.OverlayBundle.onTap(OverlayBundle.java:83)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at com.google.android.maps.MapView$1.onSingleTapUp(MapView.java:356)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at com.google.android.maps.GestureDetector.onTouchEvent(GestureDetector.java:533)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at com.google.android.maps.MapView.onTouchEvent(MapView.java:683)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.view.View.dispatchTouchEvent(View.java:3932)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:955)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1784)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1157)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.app.Activity.dispatchTouchEvent(Activity.java:2228)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1759)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2340)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewRoot.handleMessage(ViewRoot.java:1980)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.os.Handler.dispatchMessage(Handler.java:99)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.os.Looper.loop(Looper.java:143)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at android.app.ActivityThread.main(ActivityThread.java:4293)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at java.lang.reflect.Method.invokeNative(Native Method)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at java.lang.reflect.Method.invoke(Method.java:507)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)</div>
<div id="_mcePaste">&nbsp; &nbsp; &nbsp; &nbsp; at dalvik.system.NativeStart.main(Native Method)</div>
<p>RROR/AndroidRuntime(29246): FATAL EXCEPTION: main&nbsp; &nbsp; &nbsp; &nbsp; android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewRoot.setView(ViewRoot.java:562)&nbsp; &nbsp; &nbsp; &nbsp; at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)&nbsp; &nbsp; &nbsp; &nbsp; at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)&nbsp; &nbsp; &nbsp; &nbsp; at android.app.Dialog.show(Dialog.java:265)&nbsp; &nbsp; &nbsp; &nbsp; at android.app.AlertDialog$Builder.show(AlertDialog.java:802)&nbsp; &nbsp; &nbsp; &nbsp; at com.norsktrafikkinfo.activities.RoadMessagesItemizedOverlay.onTap(RoadMessagesItemizedOverlay.java:46)&nbsp; &nbsp; &nbsp; &nbsp; at com.google.android.maps.ItemizedOverlay.onTap(ItemizedOverlay.java:453)&nbsp; &nbsp; &nbsp; &nbsp; at com.google.android.maps.OverlayBundle.onTap(OverlayBundle.java:83)&nbsp; &nbsp; &nbsp; &nbsp; at com.google.android.maps.MapView$1.onSingleTapUp(MapView.java:356)&nbsp; &nbsp; &nbsp; &nbsp; at com.google.android.maps.GestureDetector.onTouchEvent(GestureDetector.java:533)&nbsp; &nbsp; &nbsp; &nbsp; at com.google.android.maps.MapView.onTouchEvent(MapView.java:683)&nbsp; &nbsp; &nbsp; &nbsp; at android.view.View.dispatchTouchEvent(View.java:3932)&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:955)&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1015)&nbsp; &nbsp; &nbsp; &nbsp; at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1784)&nbsp; &nbsp; &nbsp; &nbsp; at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1157)&nbsp; &nbsp; &nbsp; &nbsp; at android.app.Activity.dispatchTouchEvent(Activity.java:2228)&nbsp; &nbsp; &nbsp; &nbsp; at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1759)&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2340)&nbsp; &nbsp; &nbsp; &nbsp; at android.view.ViewRoot.handleMessage(ViewRoot.java:1980)&nbsp; &nbsp; &nbsp; &nbsp; at android.os.Handler.dispatchMessage(Handler.java:99)&nbsp; &nbsp; &nbsp; &nbsp; at android.os.Looper.loop(Looper.java:143)&nbsp; &nbsp; &nbsp; &nbsp; at android.app.ActivityThread.main(ActivityThread.java:4293)&nbsp; &nbsp; &nbsp; &nbsp; at java.lang.reflect.Method.invokeNative(Native Method)&nbsp; &nbsp; &nbsp; &nbsp; at java.lang.reflect.Method.invoke(Method.java:507)&nbsp; &nbsp; &nbsp; &nbsp; at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)&nbsp; &nbsp; &nbsp; &nbsp; at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)&nbsp; &nbsp; &nbsp; &nbsp; at dalvik.system.NativeStart.main(Native Method)</p>]]></description><wfw:commentRss>http://glennbech.com/java-en/rss-comments-entry-12185257.xml</wfw:commentRss></item><item><title>First encounter with the Amazon App store</title><dc:creator>Glenn Bech</dc:creator><pubDate>Sun, 10 Jul 2011 05:34:17 +0000</pubDate><link>http://glennbech.com/java-en/2011/7/10/first-encounter-with-the-amazon-app-store.html</link><guid isPermaLink="false">364421:8518338:12067020</guid><description><![CDATA[<div>
<div><span><span class="full-image-float-left ssNonEditable"><span><img src="http://bechonjava.squarespace.com/storage/amazon-icon-final-large-512512._V184103533_.jpg?__SQUARESPACE_CACHEVERSION=1310278981966" alt="" /></span></span>I am working on an application called HOGER. (Hands off google reader). It&rsquo;s a niche app I admint, for Google reader users, like myself, &nbsp;that want to quickly browse through headlines while doing something else; like exercising, eating or working. &nbsp;</span><br /><br /><span>To increase the reach of my app, I have submitted it to Handster and the Amazon App Store in addition to the Android Market. &nbsp;The big difference between Amazon and Google is that they follow in apple&rsquo;s footsteps and review all applications before they are accepted into the store.</span></div>
<div><span>&nbsp;</span><br /><span><strong>First rejection</strong></span></div>
<div><span><strong><br /></strong></span></div>
<div>The first time I submitted my app, I checked back every hour to see if it was published. The review process can take days, sometimes weeks I learned. After four days Amazon reported back that there was a slight problem with my submission. A small Icon was visually inconsistent with a larger icon I submitted.&nbsp;</div>
<div><br /><span>They obviously care about the look of their storefront. Excellent! I have seen a couple of bad looking icons or two in the Android Market. I think this Quality assurance process benefits both store and seller. It was also the fault of my own not to read the guidelines </span><a href="about:blank"><span>https://developer.amazon.com/help/faq.html#Program Overview</span></a><span> properly before submitting. </span><br /><br /><span><strong>Second Rejection</strong></span></div>
<div><span><strong><br /></strong></span></div>
<div><span>This morning I have had my app rejected again. It seems that it crash with an &ldquo;out of memory&rdquo; error on devices with hardware keyboards, but only if the user changes orientation from portrait to landscape, during the loading of Google news items. </span><br /><br /><span>The feedback I got shows very clearly that a real person- or team has installed my app and are testing it, including corner cases. It also seem that they test on different devices.</span><br /><br /><span>I test my applications of three devices; A galaxy Tab 10.1, HTC Sensation and a lower end device with a slow CPU and small screen; Huawei IDEOS. This takes out a lot of bugs, but with 400+ Android devices available, test help is greatly welcome! </span><br /><br /><span><strong>Hoger. My "Hands off Google Reader Reader"</strong></span></div>
<div></div>
<div></div>
<div><strong><span class="full-image-block ssNonEditable"><span><img src="http://glennbech.com/storage/Untitled-1.png?__SQUARESPACE_CACHEVERSION=1310492815912" alt="" /></span></span></strong></div>
<div><strong><br /></strong></div>
<div></div>
<div><strong><br /></strong></div>
<div><strong>Developer complaints</strong></div>
<div><span><strong><br /></strong></span></div>
<div><span>The Amazon App store is young, and some developers complain. The Swedish team, bithack, behind the popular game &ldquo;Apparatus&rdquo; <a href="http://bithack.se/news/apparatus-amazon-july-4-2011.html.  ">decided to pull their game from the web store earlier this month&nbsp;</a></span><br /><br /><span>To Amazon&rsquo;s defence, the most significant problem they point out is also present in the Android market. Getting in touch with complaining customers is very difficult. </span><br /><br /><span>All in all I look forward to working with Amazon. I find it assuring that they actually invest time and money on all submitted applications. Quality problems, malware and to some degrees Spam is starting to become an issue in the Android Market. It will be interesting to see how they will succeed with a more &ldquo;appelish&rdquo; approach to their market.&nbsp;</span></div>
<div><span><br /></span></div>
</div>]]></description><wfw:commentRss>http://glennbech.com/java-en/rss-comments-entry-12067020.xml</wfw:commentRss></item><item><title>Jeg fikk Android 2.3.4 i dag tidlig. På tide med ny telefon?</title><dc:creator>Glenn Bech</dc:creator><pubDate>Thu, 05 May 2011 07:38:53 +0000</pubDate><link>http://glennbech.com/java-en/2011/5/5/jeg-fikk-android-234-i-dag-tidlig-pa-tide-med-ny-telefon.html</link><guid isPermaLink="false">364421:8518338:11366917</guid><description><![CDATA[<p><span>Jeg fikk Android 2.3.4 p&aring; telefonen min i dag tidlig. Entusiastisk installerte jeg den. Selvf&oslash;lgelig er det spennende &aring; v&aelig;re blant de f&oslash;rste som f&aring;r oppdateringen p&aring; "offisiell" m&aring;te!</span></p>
<p><span>Litt skuffet n&aring;r jeg fant ut at den viktigste endringen er Video Chat fra GTalk. Video chat er sikkert spennende det, men min snart to &aring;r gamle Nexus One har jo ikke kamera i front.&nbsp;</span></p>
<p><span>Nexus S eiere og andre med nyere telefoner kan jo glede seg!</span></p>
<p><span>http://www.youtube.com/watch?v=zJAiH5-64sI&amp;feature=player_embedded</span></p>]]></description><wfw:commentRss>http://glennbech.com/java-en/rss-comments-entry-11366917.xml</wfw:commentRss></item><item><title>En liten rapport fra JFokus 2011</title><dc:creator>Glenn Bech</dc:creator><pubDate>Wed, 16 Feb 2011 09:53:38 +0000</pubDate><link>http://glennbech.com/java-en/2011/2/16/en-liten-rapport-fra-jfokus-2011.html</link><guid isPermaLink="false">364421:8518338:10498434</guid><description><![CDATA[<p><span class="full-image-float-left ssNonEditable"><span><img style="width: 400px;" src="http://glennbech.com/storage/last ned.jpg?__SQUARESPACE_CACHEVERSION=1297922253865" alt="" /></span></span></p>
<p>Da er jeg om min kollega fra <a href="http://www.inmeta.com">Inmeta Consulting </a>tilbake fra Jfokus. Vi er forn&oslash;yde, men kan vel konkludere med at JavaZone fortsatt er storebror til S&ouml;ta bror.</p>
<p>Ekspo-omr&aring;det som m&oslash;tte oss var dominert av en diger Oracle stand i midten som flagget budskapet "The future of Java". Ellers var det bare 15-20 stands, og ingen som utmerket seg nevneverdig. Jeg tror ikke Oracle f&aring;r lov til &aring; kj&oslash;pe seg like dominerende stand p&aring; JavaZone, som jeg tror er en smule mer leverand&oslash;r-n&oslash;ytral.&nbsp;</p>
<p>Forelesningene var av varierende kvalitet,&nbsp; men utvalget var bra. De kj&oslash;rte i fire paralelle rom, hele dager og begge dagene.</p>
<p>Det hele startet veldig lovende med en presentasjon om visualisering av code metrics. Neal Ford fra Thoughworks viste frem en lang rekke verkt&oslash;y jeg ikke tidligere har sett. Blant annet viste han frem et verkt&oslash;y som visualiserte kode som en by i 3D med pakker som distrikter, og klasser som byggninger. Jo h&oslash;yere hus, jo flere metoder, jo st&oslash;rre grunnflate, jo flere linjer med kode.</p>
<p>For meg var nok Matthew McCullough sitt satiriske foredrag om GIT et h&oslash;ydepunkt, og frustrasjonen n&aring;dde nye h&oslash;yder i foredraget "Running your JEE6 applications in the cloud". Arun Gupta fra Oracle presterte &aring; vise frem en SUN/Oracle server, som han hadde lyst til &aring; ha p&aring; kontoret (Det var et cloud foredrag ikke sant? Hvordan er det mulig?) s&aring; presterer han i tillegg &aring; bruke halvparten av tiden sin p&aring; &aring; forklare hvor enkelt det er&aring; bygge en JEE6 applikasjon med NetBeans (!).</p>
<p>Erik Hellman fra Ericsson viste ogs&aring; frem de nyeste leket&oslash;yene fra Ericsson. Jeg fikk ta p&aring; playstation mobilen, selv om den ikke hadde noe spill installert. Han demonstrerte ogs&aring; 3D motoren fra Unity som gj&oslash;r det mulig &aring; f&aring; ganske heftig 3D grafikk p&aring; Android mobiler med h&oslash;y frame-rate.</p>
<div></div>
<p>Gjennomg&aring;ende var ogs&aring; Oracle sin konstante "pushing" av JEE6. Det viker nesten som om de er litt desperate etter &aring; fortelle alle at det er klart for bruk. Pt. Er vel Glassfish 3 den eneste containeren som st&oslash;tte hele spesifikasjonen, selv om Websphere (8 Beta) og Jboss ikke er langt unna.</p>
<p>Konferansesenteret var helt nytt og det fysiske milj&oslash;et rundt konferansen var up&aring;klagelig, selv om de presterte &aring; g&aring; tom for kaffe i kaffepausene :-)&nbsp;</p>
<p>Helt p&aring; tampen fikk vi begge en presentasjon med Scala vi faktisk forsto. En ansatt i et svensk reklamebyr&aring; viste frem hvordan man kunne snik-innf&oslash;re Scala i prosjekter ved &aring; starte med testene. Han viste ogs&aring; frem at prosessen med &aring; generere testdata er enklere i Scala. Med enklere mener han da at man m&aring;&nbsp; skrive mindre kode.</p>
<p>Konferansesenteret var helt nytt og det fysiske milj&oslash;et rundt konferansen var up&aring;klagelig, selv om de presterte &aring; g&aring; tom for kaffe i kaffepausene. Det er skikkelig ikke-bra!</p>]]></description><wfw:commentRss>http://glennbech.com/java-en/rss-comments-entry-10498434.xml</wfw:commentRss></item><item><title>Compatibility problems with android 1.6 and the SAX Parser?</title><dc:creator>Glenn Bech</dc:creator><pubDate>Wed, 26 Jan 2011 20:09:57 +0000</pubDate><link>http://glennbech.com/java-en/2011/1/26/compatibility-problems-with-android-16-and-the-sax-parser.html</link><guid isPermaLink="false">364421:8518338:10236951</guid><description><![CDATA[<p>I have written an application that parses an RSS data feed using SAX. The application works on my Nexus one and Android 2.1 in the Emulator. With an 1.6 AVD it fails.&nbsp;</p>
<p>I have implemented a SAX Handler that overrides the BaseHandler method</p>
<p><strong><em>public</em></strong><em> void endElement(String uri, String localName, String name) &hellip;.</em></p>
<p>According to the documentation the values of these parameters will depend on two features that can be set on the sax parser factory:</p>
<div id="_mcePaste">
<ul>
<li>The feature http://xml.org/sax/features/namespaces</li>
<li>The feature http://xml.org/sax/features/namespace-prefixes</li>
</ul>
</div>
<div></div>
<p>My code uses the &ldquo;name&rdquo; parameter that contains xml element names on Stock Android 2.1 (Nexus one).</p>
<p>In an emulator, running SDK version 4 (Android 1.6) it returns null. (The uri and localname parameters are used instead).</p>
<p>Modifying the code to explicit setting these properties fixes the problem and makes the code robust;</p>
<p>SAXParserFactory factory = SAXParserFactory.newInstance();<br /> factory.setFeature("http://xml.org/sax/features/namespaces", false);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; factory.setFeature("http://xml.org/sax/features/namespace-prefixes", &shy;true);<br /> parser = factory.newSAXParser();</p>
<p><strong>The documentation says;&nbsp;</strong>﻿</p>
<p>"Any or all of these may be provided, depending on the values of the&nbsp;<var>http://xml.org/sax/features/namespaces</var>&nbsp;and the&nbsp;<var>http://xml.org/sax/features/namespace-prefixes</var>&nbsp;properties"</p>
<ul>
<li>the Namespace URI and local name are required when the namespaces property is&nbsp;<var>true</var>&nbsp;(the default), and are optional when the namespaces property is&nbsp;<var>false</var>&nbsp;(if one is specified, both must be)</li>
<li>the qualified name is required when the namespace-prefixes property is&nbsp;<var>true</var>, and is optional when the namespace-prefixes property is&nbsp;<var>false</var>&nbsp;(the default)</li>
</ul>
<p>&nbsp;</p>
<p>(<a href="http://download.oracle.com/javase/1.4.2/docs/api/org/xml/sax/ContentHandler.html#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)">http://download.oracle.com/javase/1.4.2/docs/api/org/xml/sax/ContentHandler.html#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)</a></p>
<p>Weird or what? This means that the default SAX Parser features have changed between 1.6 and 2.x.</p>]]></description><wfw:commentRss>http://glennbech.com/java-en/rss-comments-entry-10236951.xml</wfw:commentRss></item><item><title>Open Faces 3.0 lansert med JSF 2.0 støtte</title><dc:creator>Glenn Bech</dc:creator><pubDate>Fri, 12 Nov 2010 07:42:19 +0000</pubDate><link>http://glennbech.com/java-en/2010/11/12/open-faces-30-lansert-med-jsf-20-sttte.html</link><guid isPermaLink="false">364421:8518338:9450091</guid><description><![CDATA[<p>Java Server Faces (JSF) fikk en treg start. JSF 1.0 og 1.1 som ble  spesifisert av JSR-127 n&aring;dde &nbsp;"Final Release" mai 2004.  Presentasjonsrammeverket tok liksom aldri helt av og fikk mye  negativ,&nbsp;velfortjent, omtale i starten.&nbsp;</p>
<p>Jeg jobbet en god del med JSF1.2, i 2007/2008 og hadde generelt gode  erfaringer n&aring;r man kunne tilpasse spesifikasjonen rammeverket. Matraen  var &aring; stryke hunden (JSF) med h&aring;rene. Det var vanskelig &aring; skrive egne  komponenter, og programmeringsmodellen er litt uvant n&aring;r man er vant med  MVC rammeverk som Struts og Spring MVC. Ajax st&oslash;tte var ogs&aring;  begrenset.&nbsp;</p>
<p>N&aring; er mye forbedret i JSF 2.0 og den nylig lanserte<a href="http://openfaces.org/">&nbsp;implementasjonen Open Faces 3.0</a>&nbsp;ser  ut til &aring; ha et vellutviklet komponentbibliotek. Man kan velge mellom &aring;  kj&oslash;pe en komersiell lisens, eller bruke rammeverket under en LGPL  lisens.</p>
<p><a href="http://openfaces.org/demo/overview/homepage.jsf">Ta en kikk p&aring; demoen her</a>.</p>
<p><span style="text-decoration: underline;">Lenker</span></p>
<p><a href="http://openfaces.org/">http://openfaces.org/</a>&nbsp;(Open Faces 3.0)<br /><a href="http://www.jcp.org/en/jsr/detail?id=314">http://www.jcp.org/en/jsr/detail?id=314</a>&nbsp;(JSR-314/JSF &nbsp;2.0)<br /><a href="http://www.jcp.org/en/jsr/detail?id=127">http://www.jcp.org/en/jsr/detail?id=127</a>&nbsp;(JSR-127/JSF 1.0 &amp; 1.1)</p>
<p>﻿</p>]]></description><wfw:commentRss>http://glennbech.com/java-en/rss-comments-entry-9450091.xml</wfw:commentRss></item><item><title>About Eclipse and Tekken</title><dc:creator>Glenn Bech</dc:creator><pubDate>Tue, 13 Mar 2007 14:23:00 +0000</pubDate><link>http://glennbech.com/java-en/2007/3/13/about-eclipse-and-tekken.html</link><guid isPermaLink="false">364421:8518338:9450075</guid><description><![CDATA[<p><strong>Eclipse and Tekken</strong></p><p>The keyboard shortcuts in eclipse are a bit like advanced Tekken combat moves, for those who aren't into computer games; Tekken is a very good fighting game for the Sony Play Station consoles. A lot of the cool moves can only be made using insane combinations of the controller buttons, in the right sequence. In that sense, Eclipse and the computer game has a lot in common.</p><p>So... I'm using Eclipse for the moment, and have after a long period of swearing started to adapt a way of working that is similar to what I'm used to with IntelliJ. Here are a few painkillers for other Eclipse users that are used to IntelliJ. I guess most of this will be "old news" to experienced Eclipse users, but who knows. Why might pick up a trick or two.</p><p>Before starting I have to say that I try to learn keyboard shortcuts for everything I do. Other people prefer clicking around in the interface and I respect that. However, working with mostly the keyboard has some advantages; It's faster, It's better for your health and it's faster (did I mention that?)</p><p>Even after a months of using Eclipse, I still get confused on what shortcuts that are available through CTRL+SHIFT and what is through ALT+SHIFT. A good way to remember what is what is to think of the alt+shift shortcuts as "menu shortcuts". To Illustrate; Pressing Alt+shift+s gives you about the same options as pressing "source" on the menu. The CTRL+SHIFT shortcurs are more often helper dialogues like Open resource (CTRL+SHIFT+R) or open type. (CTRL+SHIFT+T)</p><p>Anyhow; here's a compilation of my most used keyboard shortcuts for eclipse. If you use these in combination, you can probably put the mouse away entirely.</p><p><strong>Ctrl+M (Maximise) </strong></p><p>I try to do as much work as possible with the source code window maximised. I try to use the "Navigator", and "Package Explorer" windows as little as possible, as I have found no way to switch to them with focus, without using the mouse.</p><p><strong>Ctrl+F7 (Switch views)<br/></strong><br/>In IntelliJ U can easily hide and show windows like the project navigator using the ALT key and number in combination, when you want the window to go away, you can press the same key, or escape.</p><p>Using the Ctrl+F7 and Ctrl+M (see previous) in combination makes navigating the different windows a bit easier. This shortcut lets you switch between the editor, navigator, console and all other views. I use it a lot to quickly go to the editor and almost always follow up with a CTRL+M, to use the entire screen area for code editing.</p><p><strong>Ctrl + . (Next problem)<br/></strong><br/>This navigates you to the next "problem" (red or yellow marker in the sidebar).</p><p><strong>Ctrl+Shift+T (Find Type)<br/></strong><br/>Finding a class in the package explorer or navigator can be like finding the famous needle in the haystack. It is often faster to hit this combo, and start typing the name of your class.</p><p>The good news is that wildcards and camel-back searching works like a dream.</p><p><strong>Ctrl+Shift+R (Find Resource)<br/></strong><br/>Same as above, only for resources that is not java classes. (JSP files ,properties etc. )</p><p><strong>Alt+Shift+T (Refactor)<br/></strong><br/>This shortcut is pretty neat as it pops up all refactoring options, given the context of the cursor position. The action you want to take is available in only one more keystroke. In full "Tekken* style" the shortcut key for "rename" is the key 'n', instead of using for example 'r' (that is unused). Don't ask me why.</p><p><strong>Ctrl+F6 (Open files) </strong></p><p>This is probably my single most used Eclipse shortcut. It pops up a list of all the recent files you have edited. An annoying "feature" of this key is that the CTRL key has to be pressed while doing a selection, or at least for a period of time for the window to "stick". If you briefly press Ctrl+F6, you get your last window. The design idea is probably that you often swap between the two most recent files.</p><p>I always use the combo "alt+right/left key" for that, so for me this extra "intelligence" is just annoying.</p><p><strong>Alt+Right and left Arrows<br/></strong><br/>The alt key in combination with the left and right arrow keys can be used as a "back" and "forward" in the file history.</p><p><strong>F3 (Go to declaration) and "Ctrl clicking"<br/></strong><br/>The entire source code can be navigated as a hyperlinked system. If the cursor is over a class name and you press F3, you immediately go to the declaration of that class.. Pressing F3 while the cursor is over a variable takes you to the declaration of that variable.</p><p>Similar navigation can be done by holding down the ctrl key and moving the mouse around. When the mouse pointer is hovering over a class name or variable, the name of the class or variable turns into a clickable hyperlink.</p><p>other usefull shortcuts that you're probably used to from IntelliJ</p><p><strong>Ctrl+Shift+O (Optimize Imports)<br/></strong><br/>This is one of many features that IntelliJ has implemented a bit smoother than Eclipse.</p><p>In general, the "Auto import" feature doesn't work to well if your code has compilation errors. This can be impractical if you let's for example say you want to copy / paste a block into your code from somewhere, and get a lot of "red markers" in your code as a result of the unknown classes.</p><p>In Eclipse you should avoid typing entire class names, it's better to type half way through and ctri+space to auto complete. This is because it imples an automatic import.</p><p><strong>Ctrl+Shift+F (Format code)<br/></strong><br/>This key combo formats your code according to default of project specific format.</p><p><strong>Alt+Shift+X, T (Run as unit test)<br/></strong><br/>This is one of many Tekken moves in Eclipse. Press Alt+shift+X after a while, a hint-box should appear with your choices. Press T to run the current class as a unit test . A disadvantage of using this shortcut is that the class currently in the editor has to be the unit test. This shortcut is best used in combination with the CTRL+F11 shortcut explained later.</p><p><strong>Ctrl+F11 (Run last launch config)<br/></strong><br/>If you run your unit test once using alt+shift+X (something that can and will break your fingers over time) there is no need to press the same combo again. Just use Ctrl+F11 to re-execute your last "run" or "debug" configuration.</p><p><strong>Alt+Shift+Z<br/></strong><br/>The nifty surround with functionality, also the home of the automatic collection iterator shortcut.</p><p><strong>Alt+Shift+S (source)<br/></strong><br/>Here you'll find shortcuts to all the nifty things like implement/override methods, generate getters/setters etc.</p><p><strong>Ctrl+F8<br/></strong><br/>Working with perspectives is important in eclipse. The whole editor changes it's window layout when working in debug mode. The Ctri+F8 shortcut enables you to switch back to java view (where I usually work) after a debugging session.</p><p><strong>Ctrl + T<br/></strong><br/>View Implementation/type hierarchy. If your editor is showing an interface, and you want to know all available implementations, this shortcut is handy. It also works if your cursor is located over an interface declaration.</p>]]></description><wfw:commentRss>http://glennbech.com/java-en/rss-comments-entry-9450075.xml</wfw:commentRss></item></channel></rss>
