<?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>Der Gleisarbeiter</title>
	<atom:link href="http://www.gleisarbeiter.de/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gleisarbeiter.de</link>
	<description></description>
	<lastBuildDate>Wed, 19 Oct 2011 14:38:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>My new company: racoonapps.de</title>
		<link>http://www.gleisarbeiter.de/2011/10/19/my-new-company-racoonapps-de/</link>
		<comments>http://www.gleisarbeiter.de/2011/10/19/my-new-company-racoonapps-de/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 14:32:42 +0000</pubDate>
		<dc:creator>gleisarbeiter</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[jquery mobile]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[racoonapps]]></category>
		<category><![CDATA[sencha touch]]></category>
		<category><![CDATA[titanium]]></category>

		<guid isPermaLink="false">http://www.gleisarbeiter.de/?p=178</guid>
		<description><![CDATA[Hi everyone, I am happy to inform you about my new company I just founded. I am now offering professional app development for Android and iOS, including cross-platform development using Titanium Mobile and HTML5 techniques and frameworks like Sencha Touch and jQuery mobile. By the way, I am still offering my RubyOnRails experiences for backend [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.racoonapps.de"><img class="alignright" src="http://www.racoonapps.de/wp-content/themes/concisetheme/images/logo.png" alt="" /></a></p>
<p>Hi everyone,</p>
<p>I am happy to inform you about my new company I just founded.</p>
<p>I am now offering professional app development for Android and iOS, including cross-platform development using Titanium Mobile and HTML5 techniques and frameworks like Sencha Touch and jQuery mobile. By the way, I am still offering my RubyOnRails experiences for backend programming, etc.</p>
<p>So if you need support in some of these fields feel free to contact me on my website: <a title="racoon apps - mobile development" href="http://www.racoonapps.de">www.racoonapps.de</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gleisarbeiter.de/2011/10/19/my-new-company-racoonapps-de/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Struggling with RSA &amp; Bouncycastle on Android</title>
		<link>http://www.gleisarbeiter.de/2011/05/16/struggling-with-rsa-bouncycastle-on-android/</link>
		<comments>http://www.gleisarbeiter.de/2011/05/16/struggling-with-rsa-bouncycastle-on-android/#comments</comments>
		<pubDate>Mon, 16 May 2011 13:33:52 +0000</pubDate>
		<dc:creator>gleisarbeiter</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Bouncycastle]]></category>
		<category><![CDATA[Crypto]]></category>
		<category><![CDATA[Javax]]></category>

		<guid isPermaLink="false">http://www.gleisarbeiter.de/?p=173</guid>
		<description><![CDATA[Hi everyone, today I had some time taking problems with the RSA implementation on Android. I was trying to do the following: Encrypt a log file on my Android device with a RSA public key, copy the device to the server and on the server decrypt the log file with my RSA private key using [...]]]></description>
			<content:encoded><![CDATA[<p>Hi everyone,</p>
<p>today I had some time taking problems with the RSA implementation on Android. I was trying to do the following:</p>
<p>Encrypt a log file on my Android device with a RSA public key, copy the device to the server and on the server decrypt the log file with my RSA private key using a small Java-App.</p>
<p>So for testing I first encrypted and decrypted on my Android device using the generated key pair, then I encrypted and decrypted a String in my Java App using the same key pair. Worked nicely.<br />
Then I tried to copy the encrypted file from the Android device and decrypt in on the server. Didn&#8217;t work. But why? I used the same key pair all the time, but always got an Exception:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">javax.<span style="color: #006633;">crypto</span>.<span style="color: #006633;">BadPaddingException</span><span style="color: #339933;">:</span> Blocktype mismatch<span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span></pre></div></div>

<p>Solution:</p>
<p>Afters some hours of trying, confirming that the key pairs are the same, using different options of saving the public key in the Android filesystem, etc. I finally found a post stating that Android is using the Bouncycastle Security provider. Bouncycastle&#8217;s default RSA implementation is: &#8220;RSA/None/NoPadding&#8221;, whereas Sun&#8217;s default security provider implementation is &#8220;RSA/None/PKCS1Padding&#8221;. So, no decryption possible when just using</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">Cipher.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;RSA&quot;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>because of the different paddings used.</p>
<p>So for a solution I downloaded the bouncycastle Jar, added bounycastle as a Security provider to my Java App, and now use</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">Cipher.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;RSA&quot;</span>, <span style="color: #0000ff;">&quot;BC&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>It works fine now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gleisarbeiter.de/2011/05/16/struggling-with-rsa-bouncycastle-on-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Offline Maps using Mobile Atlas Creator and usage on Android</title>
		<link>http://www.gleisarbeiter.de/2011/03/18/offline-maps-using-mobile-atlas-creator-and-usage-on-android/</link>
		<comments>http://www.gleisarbeiter.de/2011/03/18/offline-maps-using-mobile-atlas-creator-and-usage-on-android/#comments</comments>
		<pubDate>Fri, 18 Mar 2011 17:43:56 +0000</pubDate>
		<dc:creator>gleisarbeiter</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[OpenStreetMaps]]></category>
		<category><![CDATA[Mobile Atlas Creator]]></category>
		<category><![CDATA[offline maps]]></category>
		<category><![CDATA[osmdroid]]></category>

		<guid isPermaLink="false">http://www.gleisarbeiter.de/?p=163</guid>
		<description><![CDATA[In part 2 of my tutorial (here is part 1) I&#8217;ll show you how to create offline maps using Mobile Atlas Creator and how to define min and max-zoom-levels in your app. Mobile Atlas Creator is a cool open-source project, that allows you to use different map providers (OpenStreetMap, Google Maps, Bing Maps, Yahoo Maps, [...]]]></description>
			<content:encoded><![CDATA[<p>In part 2 of my tutorial (here is <a href="http://www.gleisarbeiter.de/2011/03/17/using-openstreetmaps-with-osmdroid-on-android/">part 1</a>) I&#8217;ll show you how to create offline maps using Mobile Atlas Creator and how to define min and max-zoom-levels in your app.</p>
<p>Mobile Atlas Creator is a cool open-source project, that allows you to use different map providers (OpenStreetMap, Google Maps, Bing Maps, Yahoo Maps, &#8230;), donwload these maps and export to different atlas formats. Have a look at their website (<a href="http://mobac.dnsalias.org/">http://mobac.dnsalias.org/</a>) and download the latest stable version.</p>
<p><span id="more-163"></span><br />
Just unzip, start the .jar-file and you will be presented a world map.<br />
On the left side you can choose which map provider to use, i.e. OpenStreet Mapnik, Yahoo, &#8230;<br />
Choose OpenStret Mapnik for now.</p>
<p>Now navigate and zoom in to your preferred area, I took Hamburg, Germany using the arrow keys on your keyboard and the zoom selector in the upper left corner of the map.</p>
<p>Now make a selection of the parts you want to have as an offline map.</p>
<p><a href="http://www.gleisarbeiter.de/wp-content/uploads/2011/03/ma1.jpg"><img src="http://www.gleisarbeiter.de/wp-content/uploads/2011/03/ma1-300x170.jpg" alt="" title="Mobile Atlas Creator 1" width="300" height="170" class="alignnone size-medium wp-image-164" /></a></p>
<p>In the left panel you may now select which zoom levels to include in your offline map. Just select the numbers you want where 18 is highest detail level and 0 is lowest. The higher detail you want, the more tiles you have to download, the higher the final size of the offline map will be.<br />
<a href="http://www.gleisarbeiter.de/wp-content/uploads/2011/03/mobileatlas3.jpg"><img src="http://www.gleisarbeiter.de/wp-content/uploads/2011/03/mobileatlas3.jpg" alt="" title="mobileatlas3" width="300" height="185" class="alignnone size-full wp-image-165" /></a></p>
<p>When you&#8217;re happy with your selection on the map, click &#8220;Add Selection&#8221; in the &#8220;Atlas Content&#8221; area, and for &#8220;Atlas settings&#8221; select Osmdroid ZIP.<br />
<a href="http://www.gleisarbeiter.de/wp-content/uploads/2011/03/mobileatlas4.jpg"><img src="http://www.gleisarbeiter.de/wp-content/uploads/2011/03/mobileatlas4-150x150.jpg" alt="" title="mobileatlas4" width="150" height="150" class="alignleft size-thumbnail wp-image-166" /></a> <a href="http://www.gleisarbeiter.de/wp-content/uploads/2011/03/mobileatlas5.jpg"><img src="http://www.gleisarbeiter.de/wp-content/uploads/2011/03/mobileatlas5-150x150.jpg" alt="" title="mobileatlas5" width="150" height="150" class="alignleft size-thumbnail wp-image-167" /></a></p>
<p>Now start atlas creation by clicking on the &#8220;Create Atlas&#8221; button. Now the selected parts of the map will be downloaded and bundled into a Osmdroid ZIP map. After some time, depending on your internet connection and the number of tiles you want to download, creation of the offline map is ready. You can now close Mobile Atlas Creator and have a look at the Mobile Atlas Creator folder. You&#8217;ll now find a subfolder &#8220;atlases&#8221; and inside the subfolder a .zip-file containing all the map tiles (you can confirm that by unzipping the file).</p>
<p>Now let&#8217;s use this map in our app. Open the app we created in the last part.<br />
We want to make sure we&#8217;re not using any data connection to download the map tiles, so just set</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">mapView.<span style="color: #006633;">setUseDataConnection</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>somewhere after the mapView instantiation and before setContentView(mapView).</p>
<p>Let&#8217;s also delete the map cache in case you followed the last tutorial. You can find a folder &#8220;osmdroid&#8221; on your android&#8217;s sdcard, just delete everything in that folder and instead put the zip-file we created inside.</p>
<p>Now adjust the zoom level and the latitude/longitude in your app to point to a place in the map you created and start your app.</p>
<p>You should now see a map, but that map wasn&#8217;t downloaded on-the-fly, now it&#8217;s using the map tiles in the zipped-atlas you created! You can confirm that by moving outside of the area you zipped and you will just see grey map tiles.</p>
<p>Problem is: you still can zoom out of the zoom levels you downloaded or zoom closer than you wanted the user to (you provided no maps for that zoom level). That&#8217;s ugly because the user only sees grey maps and may get lost.</p>
<p>Let&#8217;s discuss how to solve that problem in the next part of the tutorial.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gleisarbeiter.de/2011/03/18/offline-maps-using-mobile-atlas-creator-and-usage-on-android/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Using OpenStreetMaps with osmdroid on Android</title>
		<link>http://www.gleisarbeiter.de/2011/03/17/using-openstreetmaps-with-osmdroid-on-android/</link>
		<comments>http://www.gleisarbeiter.de/2011/03/17/using-openstreetmaps-with-osmdroid-on-android/#comments</comments>
		<pubDate>Thu, 17 Mar 2011 17:58:01 +0000</pubDate>
		<dc:creator>gleisarbeiter</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[OpenStreetMaps]]></category>
		<category><![CDATA[Maps]]></category>
		<category><![CDATA[offline]]></category>
		<category><![CDATA[osmdroid]]></category>

		<guid isPermaLink="false">http://www.gleisarbeiter.de/?p=150</guid>
		<description><![CDATA[In this and the following tutorials I will show you how to include a OpenStreetMap in your activity, create offline maps for OpenStreetMaps and how to define minimum and maximum Zoom Levels (because you surely don&#8217;t want to provide all zoom levels for offline mode). 1. Get the needed osmdroid&#8217;s library, I used the osmdroid-android-3.0.2.jar [...]]]></description>
			<content:encoded><![CDATA[<p>In this and the following tutorials I will show you how to include a OpenStreetMap in your activity, create offline maps for OpenStreetMaps and how to define minimum and maximum Zoom Levels (because you surely don&#8217;t want to provide all zoom levels for offline mode).</p>
<p><span id="more-150"></span></p>
<p>1. Get the needed osmdroid&#8217;s library, I used the osmdroid-android-3.0.2.jar<br />
<a href="http://code.google.com/p/osmdroid/downloads/list">here</a></p>
<p>2. Lets create a new simple Android project (you know how that is done)</p>
<p>3. Add the osmdroid-library to your Android project.<br />
Depends on the IDE you use, in IntelliJ right-click on your project and select Open Module Settings. Goto &#8220;Libraries&#8221;, create a new library and attach the osmdroid-jar to it.</p>
<p>4. Now the fun begins:</p>
<p>In our AndroidManifest.xml define the permissions needed:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-permission</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.permission.ACCESS_FINE_LOCATION&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-permission</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.permission.ACCESS_COARSE_LOCATION&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-permission</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.permission.ACCESS_WIFI_STATE&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-permission</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.permission.ACCESS_NETWORK_STATE&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-permission</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.permission.INTERNET&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-feature</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.hardware.location.network&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-feature</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.hardware.location.gps&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-feature</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.hardware.wifi&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>Let&#8217;s create the easiest MapView.<br />
In the Activity&#8217;s onCreate-method create a new Object of Type MapView (exactly: org.osmdroid.views.MapView) like this:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">MapView mapView <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MapView<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #cc66cc;">256</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>That uses the context as the first parameter, and the tile size of 256px (needed later).<br />
We want to be able to zoom in and out, so let&#8217;s define that:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">mapView.<span style="color: #006633;">setClickable</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
mapView.<span style="color: #006633;">setBuiltInZoomControls</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>And let&#8217;s set the ContentView:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">setContentView<span style="color: #009900;">&#40;</span>mapView<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>So that was our onCreate-method. You may now start in the emulator or on your device and you should see the OpenStreetMap of the whole world. By clicking the MapView the standard zoom-in/zoom-out buttons appear and that should work, too, given you have an internet connection.</p>
<p>5. Play around with the options<br />
Let&#8217;s set the zoom level (the standard one is funny, but not really helpful). Thats done via an instance of the MapController, you can easily grab the MapView&#8217;s MapController by calling</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">mapView.<span style="color: #006633;">getController</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setZoom</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Play around with the numbers, to see how close to earth you can get <img src='http://www.gleisarbeiter.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>But maybe you also want to set a specific point as the map&#8217;s center. That&#8217;s also done via the MapController:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">mapView.<span style="color: #006633;">getController</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setCenter</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> GeoPoint<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">53.550657</span>, <span style="color: #cc66cc;">9.995499</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Use a GeoPoint to specify the coordinates (first param is latitude, second longitude) and use this as paramter for setCenter(). Start the app again and look where I directed you: the most beautiful city in the world <img src='http://www.gleisarbeiter.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>6. Have fun playing with coordinates and zoom levels.</p>
<p>7. BUT! What if you want offline maps?<br />
Let&#8217;s say you&#8217;re on holiday in the US, Germany, England, India, China, (insert your favorite country) and need a map on your mobile device, but you don&#8217;t want to pay thousands of €/$/¥/(insert your favorite currency) just for displaying a map?<br />
Also, how do we set set minimum and maximum zoom levels?</p>
<p>Next time&#8230; <img src='http://www.gleisarbeiter.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>This is the complete onCreate method:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #008000; font-style: italic; font-weight: bold;">/** Called when the activity is first created. */</span>
    @Override
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onCreate<span style="color: #009900;">&#40;</span>Bundle savedInstanceState<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span>savedInstanceState<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        mapView <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MapView<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #cc66cc;">256</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        mapView.<span style="color: #006633;">setClickable</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        mapView.<span style="color: #006633;">setBuiltInZoomControls</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        mapView.<span style="color: #006633;">getController</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setZoom</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        mapView.<span style="color: #006633;">getController</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setCenter</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> GeoPoint<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">39.461078</span>, <span style="color: #cc66cc;">2.856445</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        setContentView<span style="color: #009900;">&#40;</span>mapView<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.gleisarbeiter.de/2011/03/17/using-openstreetmaps-with-osmdroid-on-android/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Rails-Entwickler gesucht bei MEDLINQ in Hamburg</title>
		<link>http://www.gleisarbeiter.de/2011/03/16/rails-entwickler-gesucht-bei-medlinq-in-hamburg/</link>
		<comments>http://www.gleisarbeiter.de/2011/03/16/rails-entwickler-gesucht-bei-medlinq-in-hamburg/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 12:01:48 +0000</pubDate>
		<dc:creator>gleisarbeiter</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby/Rails]]></category>

		<guid isPermaLink="false">http://www.gleisarbeiter.de/?p=147</guid>
		<description><![CDATA[Nachdem schon lange nichts mehr von mir zu hören war, hier endlich mal wieder ein Update. Die Firma MEDLINQ GmbH in Hamburg-Bergedorf sucht einen Ruby &#038; Rails-Entwickler für verschiedenste, interessante Projekte. Bei Interesse könnt ihr euch gerne auf unserer Website www.medlinq.com -> Jobs (untere Anzeige) informieren und bewerben. Viel Erfolg!]]></description>
			<content:encoded><![CDATA[<p>Nachdem schon lange nichts mehr von mir zu hören war, hier endlich mal wieder ein Update.</p>
<p>Die Firma MEDLINQ GmbH in Hamburg-Bergedorf sucht einen Ruby &#038; Rails-Entwickler für verschiedenste, interessante Projekte.</p>
<p>Bei Interesse könnt ihr euch gerne auf unserer Website <a href="http://www.medlinq.com/index.php?option=com_content&#038;view=article&#038;id=64&#038;Itemid=74&#038;lang=de">www.medlinq.com -> Jobs</a> (untere Anzeige) informieren und bewerben.</p>
<p>Viel Erfolg!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gleisarbeiter.de/2011/03/16/rails-entwickler-gesucht-bei-medlinq-in-hamburg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problem mit JQuery Autocomplete im IE und Opera</title>
		<link>http://www.gleisarbeiter.de/2009/12/16/problem-mit-jquery-autocomplete-im-ie-und-opera/</link>
		<comments>http://www.gleisarbeiter.de/2009/12/16/problem-mit-jquery-autocomplete-im-ie-und-opera/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 08:52:57 +0000</pubDate>
		<dc:creator>gleisarbeiter</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[autocomplete]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[Scrollbar]]></category>

		<guid isPermaLink="false">http://www.gleisarbeiter.de/?p=139</guid>
		<description><![CDATA[Bei einem Autocomplete Input-Feld mit JQuery (Autocomplete-Plugin von pengoworks.com), bei dem viele Elemente zurückgeliefert wurden, entstand eine Scrollbar in dem Resultate-Div. Das Problem: Ein Klick auf die Scrollbar im IE oder Opera klappte die gesamte Resultate-Liste zu, anscheinend auf Grund eines Javascript-Events blur() auf dem Input-Feld. Durch dieses Event wurde die Resultate-Liste geschlossen. Mein Fix [...]]]></description>
			<content:encoded><![CDATA[<p>Bei einem Autocomplete Input-Feld mit JQuery (Autocomplete-Plugin von <a href="http://www.pengoworks.com/workshop/jquery/autocomplete.htm">pengoworks.com</a>), bei dem viele Elemente zurückgeliefert wurden, entstand eine Scrollbar in dem Resultate-Div. Das Problem: Ein Klick auf die Scrollbar im IE oder Opera klappte die gesamte Resultate-Liste zu, anscheinend auf Grund eines Javascript-Events blur() auf dem Input-Feld. Durch dieses Event wurde die Resultate-Liste geschlossen.</p>
<p>Mein Fix in jquery.autocomplete.js:</p>
<p><span id="more-139"></span></p>
<pre>
<code>
/* Variable um zu speichern, dass der Mouseclick auf dem Resultate-Div geschah */
var mouseDownOnSelect = false;
$jresults.mousedown(function() {
        mouseDownOnSelect = true;
});
/* mouseup funktionierte leider nicht */
$jresults.mouseout(function(){
        mouseDownOnSelect = false;
});
/* Bei einem Klick, prüfe ob der Klick außerhalb der Resultate-Liste geschah, */
/* wenn ja, schließe Fenster */
$j(document).click(function(){
        if(!mouseDownOnSelect){
            hideResultsNow();
        }
});

/* Zusätzlich im blur()-Event des input-Feldes die If-Abfrage eingefügt */
$jinput.blur(function(event) {
            if (!mouseDownOnSelect) { /* <--- */
                hasFocus = false;
                hideResults();
           }                                         /* <--- */
});
</code>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gleisarbeiter.de/2009/12/16/problem-mit-jquery-autocomplete-im-ie-und-opera/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nachmieter für unsere Wohnung gesucht</title>
		<link>http://www.gleisarbeiter.de/2009/09/29/nachmieter-fur-unsere-wohnung-gesucht/</link>
		<comments>http://www.gleisarbeiter.de/2009/09/29/nachmieter-fur-unsere-wohnung-gesucht/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 12:01:33 +0000</pubDate>
		<dc:creator>gleisarbeiter</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Nachmieter]]></category>
		<category><![CDATA[Paderborn]]></category>
		<category><![CDATA[Wewer]]></category>
		<category><![CDATA[Wohnung]]></category>

		<guid isPermaLink="false">http://www.gleisarbeiter.de/?p=136</guid>
		<description><![CDATA[Wir suchen zum 01.11. oder später für unsere schöne Wohnung in Paderborn-Wewer einen Nachmieter. - 3Zi. Dachgeschoß-Wohnung, ca. 70qm, in Sackgasse gelegen - Badezimmer mit Dusche u. Vollbad, Kellerraum, Autostellplatz - großer überdachter Balkon über die ganze Hausbreite - vor gerade 10 Monaten schön renoviert/tapeziert - Laminat im Schlafzimmer/Büro, Parkett im Wohnzimmer, Fliesen in Flur [...]]]></description>
			<content:encoded><![CDATA[<p>Wir suchen zum 01.11. oder später für unsere schöne Wohnung in Paderborn-Wewer einen Nachmieter.<br />
- 3Zi. Dachgeschoß-Wohnung, ca. 70qm, in Sackgasse gelegen<br />
- Badezimmer mit Dusche u. Vollbad, Kellerraum, Autostellplatz<br />
- großer überdachter Balkon über die ganze Hausbreite<br />
- vor gerade 10 Monaten schön renoviert/tapeziert<br />
- Laminat im Schlafzimmer/Büro, Parkett im Wohnzimmer, Fliesen in Flur und Bad</p>
<p>UPDATE:<br />
Die Wohnung ist weg.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gleisarbeiter.de/2009/09/29/nachmieter-fur-unsere-wohnung-gesucht/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problem updating nbandroid for NetBeans to v0.8</title>
		<link>http://www.gleisarbeiter.de/2009/07/28/problem-updating-nbandroid-for-netbeans-to-v0-8/</link>
		<comments>http://www.gleisarbeiter.de/2009/07/28/problem-updating-nbandroid-for-netbeans-to-v0-8/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 20:28:12 +0000</pubDate>
		<dc:creator>gleisarbeiter</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[NetBeans]]></category>

		<guid isPermaLink="false">http://www.gleisarbeiter.de/?p=128</guid>
		<description><![CDATA[I&#8217;ve had a problem after the update of the nbandroid plugin for NetBeans. After updating the debugging mode neither in emulator, nor on real device, doesn&#8217;t work anymore. To fix this, put the following lines in build-impl.xml in the debugging section. Just remove the old part and paste in the new: &#60;target depends=&#34;init,-debug-start-debuggee&#34; if=&#34;netbeans.home&#34; name=&#34;-debug-start-debugger&#34;&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a problem after the update of the nbandroid plugin for NetBeans. After updating the debugging mode neither in emulator, nor on real device, doesn&#8217;t work anymore.</p>
<p>To fix this, put the following lines in build-impl.xml in the debugging section. Just remove the old part and paste in the new:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;init,-debug-start-debuggee&quot;</span> <span style="color: #000066;">if</span>=<span style="color: #ff0000;">&quot;netbeans.home&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;-debug-start-debugger&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;androidproject1:nbjpdaconnect</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;init,compile,-start-emulator,-wait-for-emulator,-install-app&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;-debug-start-debuggee&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;${adb}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;${android.target.device}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;shell&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;am start -D -n ${main.component}/${main.class}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;getdebuggerport</span> <span style="color: #000066;">addressProperty</span>=<span style="color: #ff0000;">&quot;local.debug.port&quot;</span> <span style="color: #000066;">app</span>=<span style="color: #ff0000;">&quot;${main.component}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;init,compile,-debug-start-debuggee,-debug-start-debugger&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Debug project in IDE.&quot;</span> <span style="color: #000066;">if</span>=<span style="color: #ff0000;">&quot;netbeans.home&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;debug&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;init&quot;</span> <span style="color: #000066;">if</span>=<span style="color: #ff0000;">&quot;netbeans.home&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;-debug-start-debugger-stepinto&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;androidproject1:nbjpdastart</span> <span style="color: #000066;">stopclassname</span>=<span style="color: #ff0000;">&quot;${main.class}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee&quot;</span> <span style="color: #000066;">if</span>=<span style="color: #ff0000;">&quot;netbeans.home&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;debug-stepinto&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.gleisarbeiter.de/2009/07/28/problem-updating-nbandroid-for-netbeans-to-v0-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Galaxy Lander &#8211; Widget der Woche in Portugal</title>
		<link>http://www.gleisarbeiter.de/2009/07/16/galaxy-lander-widget-der-woche-in-portugal/</link>
		<comments>http://www.gleisarbeiter.de/2009/07/16/galaxy-lander-widget-der-woche-in-portugal/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 06:40:13 +0000</pubDate>
		<dc:creator>gleisarbeiter</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Vodafone]]></category>
		<category><![CDATA[Widgets]]></category>

		<guid isPermaLink="false">http://www.gleisarbeiter.de/?p=125</guid>
		<description><![CDATA[Unter den neuen Widgets die ich für die Vodafone Widget Runtime programmiert habe ist u.a. &#8220;Galaxy Lander&#8221;. Ein Spiel, das wahrscheinlich viele schon auf programmierbaren Taschenrechnern gespielt haben. Mehr Funktionaliät als damals gibt es auch nicht, nur etwas schönere Grafiken In 3 Levels kann der Spieler Versuchen seine Landefähre auf dem Mond, dem Mars oder [...]]]></description>
			<content:encoded><![CDATA[<p>Unter den neuen Widgets die ich für die Vodafone Widget Runtime programmiert habe ist u.a. &#8220;Galaxy Lander&#8221;. Ein Spiel, das wahrscheinlich viele schon auf programmierbaren Taschenrechnern gespielt haben. Mehr Funktionaliät als damals gibt es auch nicht, nur etwas schönere Grafiken <img src='http://www.gleisarbeiter.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
<p>In 3 Levels kann der Spieler Versuchen seine Landefähre auf dem Mond, dem Mars oder dem Jupiter zu landen. Natürlich ist der Jupiter das schwerste Level, aber es ist möglich heile anzukommen! Mit der &#8220;Hoch&#8221;-Taste des Handys kann der Spieler die Raketen zünden und damit den Fall abbremsen, aber Achtung: Man hat keinen unendlichen Kerosinvorrat!<br />
Viel Spaß macht auch der umgekehrte Spielmodus: &#8220;Wer macht den tiefsten Krater?&#8221;. Probiert&#8217;s mal aus!</p>
<p>Also viel Spaß beim Spielen, hier mal der Link auf die deutsche Version:<br />
<a href="http://widget.vodafone.com/de/categories/14-entertainment/widgets/116-galaxy-lander">Galaxy Lander downloaden</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gleisarbeiter.de/2009/07/16/galaxy-lander-widget-der-woche-in-portugal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developing an Android Mobile Game &#8211; Part 2</title>
		<link>http://www.gleisarbeiter.de/2009/06/24/developing-an-android-mobile-game-part-2/</link>
		<comments>http://www.gleisarbeiter.de/2009/06/24/developing-an-android-mobile-game-part-2/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 17:03:43 +0000</pubDate>
		<dc:creator>gleisarbeiter</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Spiele]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Space Janitor]]></category>
		<category><![CDATA[Spiel]]></category>

		<guid isPermaLink="false">http://www.gleisarbeiter.de/?p=102</guid>
		<description><![CDATA[This is part 2 of my Android mobile game series. I want to develop a game just like my Widget game for the Vodafone Widget Runtime: Space Janitor. So, in the last part we created some parts of the UI the user sees when he starts the game. Today we want to create a small [...]]]></description>
			<content:encoded><![CDATA[<p>This is part 2 of my Android mobile game series. I want to develop a game just like my Widget game for the Vodafone Widget Runtime: <a href="http://widget.vodafone.com/de/categories/14-entertainment/widgets/32-space-janitor">Space Janitor</a>.</p>
<p>So, in the last part we created some parts of the UI the user sees when he starts the game.</p>
<p>Today we want to create a small part of the real &#8220;Game View&#8221;!<br />
First, lets change the standard layout of the Android App. The layout file can be found in res/layout/main.xml.<br />
The standard is a simple LinearLayout with a TextView, that currently just displays &#8220;Hello&#8230;&#8221; when you start the game.<br />
Let&#8217;s remove this part and change it to:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;FrameLayout</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:orientation</span>=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;GameView</span></span>
<span style="color: #009900;">    	<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/game&quot;</span></span>
<span style="color: #009900;">    	<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">    	<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;RelativeLayout</span></span>
<span style="color: #009900;">	<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span></span>
<span style="color: #009900;">		<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/text&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/space_janitor_info_text&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">android:visibility</span>=<span style="color: #ff0000;">&quot;visible&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">android:layout_centerInParent</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">android:gravity</span>=<span style="color: #ff0000;">&quot;center_horizontal&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">android:textColor</span>=<span style="color: #ff0000;">&quot;#88ffffff&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">android:textSize</span>=<span style="color: #ff0000;">&quot;24sp&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/RelativeLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/FrameLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>First, we define a Game View that we can use later on to hold the game graphics. Second we defined a RelativeLayout that holds a TextView, we need this to display some infos later on.</p>
<p>Now let&#8217;s extend the code to use this views.</p>
<p>Create a new class called GameView in your App. The GameView extends SurfaceView and has to implement the SufaceHolder.Callback interface. Add the yet unimplemented methods and a constructor to fulfill the interface&#8217;s requirements.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> GameView <span style="color: #000000; font-weight: bold;">extends</span> SurfaceView <span style="color: #000000; font-weight: bold;">implements</span> SurfaceHolder.<span style="color: #006633;">Callback</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> GameView<span style="color: #009900;">&#40;</span><span style="color: #003399;">Context</span> context, <span style="color: #003399;">AttributeSet</span> attrs<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span>context, attrs<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// TODO Auto-generated constructor stub</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> surfaceChanged<span style="color: #009900;">&#40;</span>SurfaceHolder holder, <span style="color: #000066; font-weight: bold;">int</span> format, <span style="color: #000066; font-weight: bold;">int</span> width,
			<span style="color: #000066; font-weight: bold;">int</span> height<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// TODO Auto-generated method stub</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> surfaceCreated<span style="color: #009900;">&#40;</span>SurfaceHolder holder<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// TODO Auto-generated method stub</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> surfaceDestroyed<span style="color: #009900;">&#40;</span>SurfaceHolder holder<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// TODO Auto-generated method stub</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The SurfaceView is designated to hold the game graphics. Via the SurfaceHolder.Callback we are informed about dimension changes, i.e. when the user switches to landscape mode.</p>
<p>In the Main View we now have to code a connection to the Game View, we&#8217;ll do this via an instance variable of GameView. Add a variable of the type &#8220;GameView&#8221; to your Activity.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SpaceJanitor <span style="color: #000000; font-weight: bold;">extends</span> Activity <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> MENU_START <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> GameView myGameView<span style="color: #339933;">;</span>
        ...
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In our &#8220;onCreate&#8221;-method we have to initialize this variable and we would like to give the GameView the ability to display some info in the TextView we recently defined in our layout file, like &#8220;Game Over&#8221;, etc. So:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onCreate<span style="color: #009900;">&#40;</span>Bundle savedInstanceState<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span>savedInstanceState<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   requestWindowFeature<span style="color: #009900;">&#40;</span><span style="color: #003399;">Window</span>.<span style="color: #006633;">FEATURE_NO_TITLE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   setContentView<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">main</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   myGameView <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>GameView<span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">game</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   myGameView.<span style="color: #006633;">setTextView</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TextView<span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This implies that we have to add a method &#8220;setTextView&#8221; in the GameView class to save a reference on this TextView locally.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setTextView<span style="color: #009900;">&#40;</span>TextView findViewById<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// TODO Auto-generated method stub	</span>
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In the next part we will add a thread to handle graphic updates, user actions, etc. etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gleisarbeiter.de/2009/06/24/developing-an-android-mobile-game-part-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

