<?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>DevmilDevmil</title>
	<atom:link href="http://www.devmil.de/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.devmil.de</link>
	<description>Braindumps of a developer</description>
	<lastBuildDate>Tue, 18 Jun 2013 17:38:25 +0000</lastBuildDate>
	<language>de-DE</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Silverlight / WPF, MVVM and Dependencies</title>
		<link>http://www.devmil.de/?p=156</link>
		<comments>http://www.devmil.de/?p=156#comments</comments>
		<pubDate>Mon, 28 May 2012 20:36:37 +0000</pubDate>
		<dc:creator>devmil</dc:creator>
				<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[Dependencies]]></category>
		<category><![CDATA[PropertyChanged]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://www.devmil.de/?p=156</guid>
		<description><![CDATA[As promised I will write some technical Windows Phone related things. I will start off with a MVVM specific framework I have developed during some projects. I like MVVM. The whole Idea of separating the view logic from the view is awesome and really fits into the Silverlight / WPF (I will refer to them [...]]]></description>
				<content:encoded><![CDATA[<p>As promised I will write some technical Windows Phone related things. I will start off with a MVVM specific framework I have developed during some projects.</p>
<p>I like MVVM. The whole Idea of separating the view logic from the view is awesome and really fits into the Silverlight / WPF (I will refer to them as XAML from now on) world. As with every technology there are ups and downs and so has XAML its own downs. Two of them I want to explain here and show solutions for them.</p>
<h3>String parameter passing for PropertyChanged events.</h3>
<p>This problem will be gone with the next .NET version. The problem is that the compiler doesn&#8217;t check string contents <img src='http://www.devmil.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Lets assume you have the following class:</p>
<pre class="wp-code-highlight prettyprint">public class ContactViewModelTraditional : INotifyPropertyChanged
{
	private string _Name;
	public string Name
	{
		get
		{
			return _Name;
		}
		set
		{
			bool changed = value != _Name;
			_Name = value;
			if (changed)
				OnPropertyChanged(&quot;Name&quot;);
		}
	}

	public event PropertyChangedEventHandler PropertyChanged;

	private void OnPropertyChanged(string propertyName)
	{
		if (PropertyChanged != null)
			PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
	}
}</pre>
<p>If you now want to change the property name &#8220;Name&#8221; to something else you have to think of the string parameter for the OnPropertyChanged method. If you forget to rename this string the compiler will not complain. You can see your error only at runtime (if you are lucky).</p>
<p>To solve this issue Microsoft has introduced the [CallerMemberName] attribute to make the parameter generated automatically.<br />
For now, as we don&#8217;t have such a feature, I have chosen to (mis)use Lambda expressions to pass the property name. This way costs performance but ensures that the property name is correct or the compiler will detect it.</p>
<p>The class from above would look like this using my approach (I will explain the function call to &#8220;SetPropertyValue&#8221; later):</p>
<pre class="wp-code-highlight prettyprint">public class ContactViewModelTraditional : INotifyPropertyChanged
{
	private string _Name;

	public string Name
	{
		get
		{
			return _Name;
		}
		set
		{
			this.SetPropertyValue(p =&amp;gt; p.Name, ref _Name, value);
		}
	}

	public event PropertyChangedEventHandler PropertyChanged;

	private void OnPropertyChanged(string propertyName)
	{
		if (PropertyChanged != null)
			PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
	}
}</pre>
<p>The key in this example is the setter of the Name property. Here you can see that the name of the property gets passed as a Lambda expression. The &#8220;SetPropertyValue&#8221; method then has to get the name from the lambda expression and pass it to the &#8220;OnPropertyChanged&#8221; method.</p>
<h3>Property dependencies and raising the correct PropertyChanged events</h3>
<p>Another big problem arises when the ViewModel structure gets more complex and / or if properties are based on other properties and only change implicitly.</p>
<p>So lets assume we have a simple ViewModel and this ViewModel contains a ContactViewModel. We want a property &#8220;CurrentContactNameString&#8221; on the ViewModel that returns the Name of the current contact or the string &#8220;No Contact selected&#8221; if there is no current contact.</p>
<p>The ViewModel would look like this:</p>
<pre class="wp-code-highlight prettyprint">public class MainViewModelTraditional : INotifyPropertyChanged
{
	private ContactViewModelTraditional _CurrentContact;
	public ContactViewModelTraditional CurrentContact
	{
		get
		{
			return _CurrentContact;
		}
		set
		{
			bool changed = _CurrentContact != value;
			if (changed)
			{
				if (_CurrentContact != null)
					_CurrentContact.PropertyChanged -= CurrentContact_PropertyChanged;
				_CurrentContact = value;
				if (_CurrentContact != null)
					_CurrentContact.PropertyChanged += CurrentContact_PropertyChanged;
				OnPropertyChanged(&quot;CurrentContact&quot;);
				OnPropertyChanged(&quot;ContactNameString&quot;);
			}
		}
	}

	void CurrentContact_PropertyChanged(object sender, PropertyChangedEventArgs e)
	{
		if (e.PropertyName == &quot;Name&quot;)
			OnPropertyChanged(&quot;ContactNameString&quot;);
	}

	public string CurrentContactNameString
	{
		get
		{
			if (CurrentContact != null)
				return CurrentContact.Name;
			return &quot;No Contact selected&quot;;
		}
	}

	public event PropertyChangedEventHandler PropertyChanged;

	private void OnPropertyChanged(string propertyName)
	{
		if (PropertyChanged != null)
			PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
	}
}</pre>
<p>You can see many &#8220;problems&#8221; in this little example:</p>
<ol>
<li>Event passing between INotifyPropertyChanged instances<br />
You can clearly see in the setter of the CurrentContact property what has to be done if you rely on data inside a &#8220;foreign&#8221; INotifyPropertyChanged instance.<br />
You have to make sure to listen to the PropertyChanged event of the instance to set and remove the event handler from the instance that leaves.<br />
If you e.g. forget to remove the event handler from the &#8220;old&#8221; instance then you will get too many change-events. It&#8217;s very hard to detect something like this.</li>
<li>The property logic is spread all over the class<br />
To fire the correct PropertyChanged events the source of the event has to know exactly what properties rely on it.<br />
In this example the setter for &#8220;CurrentContact&#8221; and the event handler for the &#8220;Name&#8221; property of the current contact have to know that the property &#8220;CurrentContactNameString&#8221; uses them. In this example the dependencies are relatively simple but if this gets more complex you easily loose the overview.<br />
Every change on the target implies a reorganization of all the PropertyChanged sources to match the used logic again.</li>
</ol>
<h3><em>Results only change if the data used to get it changes</em></h3>
<p>For those two problems I have developed a dependency tracking system. The central idea is that every result only changes whenever any data changes that has been used to get the result.<br />
Sounds simple, right? It is that simple!</p>
<p>So I have developed a tracking mechanism that tracks all data that gets used to get a result (finally for a property getter). Whenever data changes all PropertyChanged events for results that depend on this data get fired.</p>
<p>The ViewModel sample using this approach looks like this:</p>
<pre class="wp-code-highlight prettyprint">public class MainViewModel : IFireNotifyPropertyChanged
{
	private ContactViewModel _CurrentContact;
	public ContactViewModel CurrentContact
	{
		get
		{
			using (this.Track(p =&amp;gt; p.CurrentContact))
				return _CurrentContact;
		}
		set
		{
			this.SetPropertyValue(p =&amp;gt; p.CurrentContact, ref _CurrentContact, value);
		}
	}

	public string CurrentContactNameString
	{
		get
		{
			using (this.Track(p =&amp;gt; p.CurrentContactNameString))
			{
				if (CurrentContact != null)
					return CurrentContact.Name;
				return &quot;No Contact selected&quot;;
			}
		}
	}

	public void FireNotifyPropertyChanged(string propertyName)
	{
		if (PropertyChanged != null)
			PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
	}

	public event PropertyChangedEventHandler PropertyChanged;
}</pre>
<p>As you can see the property &#8220;CurrentContactNameString&#8221; only has to use the &#8220;CurrentContact&#8221; and the &#8220;Name&#8221; property. Whenever one of them changes the PropertyChanged event for &#8220;CurrentContactNameString&#8221; gets fired.</p>
<p>The integration of the framework is relatively simple:</p>
<ol>
<li>every getter (that is relevant) uses a Tracker instance as long as relevant data gets accessed. The creation of this Tracker instance is hidden by a extension method &#8220;Track&#8221; for INotifyPropertyChanged.</li>
<li>setter have to use the SetPropertyValue extension that triggers all the logic to notify dependent properties about this change</li>
<li>(Only Silverlight for now) Instead of INotifyPropertyChanged the classes have to implement IFireNotifyPropertyChanged which extends INotifyPropertyChanged by a method to trigger a PropertyChanged event. This is necessary because Silverlight doesn&#8217;t allow to access private fields through reflection (and this is the only way to trigger an event from outside an instance)</li>
</ol>
<p>The downside of this framework is that it can get slow very fast. Because every change triggers the PropertyChanged event for all dependent properties the amount of triggered events can explode easily. So use it with care <img src='http://www.devmil.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
The real benefit is that you don&#8217;t have to care about dependencies between Properties or INotifyPropertyChanged instances and &#8211; even more important &#8211; don&#8217;t have to think about them during a refactoring!</p>
<p>I will explain the implementation of this framework in the next post after I have reorganized and published it to some Open Source hoster. So stay tuned <img src='http://www.devmil.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Devmil</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devmil.de/?feed=rss2&#038;p=156</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Phone development</title>
		<link>http://www.devmil.de/?p=137</link>
		<comments>http://www.devmil.de/?p=137#comments</comments>
		<pubDate>Fri, 27 Apr 2012 20:25:44 +0000</pubDate>
		<dc:creator>devmil</dc:creator>
				<category><![CDATA[Windows Phone]]></category>

		<guid isPermaLink="false">http://www.devmil.de/?p=137</guid>
		<description><![CDATA[Currently I&#8217;m trying to get my way back to .NET by experimenting with Windows Phone. I have been a .NET guy almost since I started developing software. The beginning: Delphi After finishing high school I started developing in Delphi during my vocational training. In my free time I came across the .NET Framework 1.1 (2003) and fell in [...]]]></description>
				<content:encoded><![CDATA[<p>Currently I&#8217;m trying to get my way back to .NET by experimenting with Windows Phone.</p>
<p>I have been a .NET guy almost since I started developing software.</p>
<h3>The beginning: Delphi</h3>
<p>After finishing high school I started developing in Delphi during my vocational training. In my free time I came across the .NET Framework 1.1 (2003) and fell in love with it. From that very moment on I tried to use .NET and especially C# whenever I had the oportunity to do so. After finishing my vocational training in the end of 2003 I began to study computer sciences. The University of Applied Sciences I have been at had a very strong C and Java focus so C# was limited to my fun projects and my little side business I started to finance my studies.</p>
<h3>My first mobile contact</h3>
<p>At this time I discovered Windows Mobile and was blown away by the possibility to develop applications using C# for my handset. I developed many little applications for my handset and had much fun. One of those fun projects has been <a title="SniffThat" href="http://sniffthat.codeplex.com/" target="_blank">SniffThat</a>.<br />
I also worked as a freelancer for some firms. The most important condition for me to offer my work has been &#8211; you guess it &#8211; .NET. I always had the choice so every time I looked for a job I found one that had .NET involved. And sometimes I have found one that involved .NET and Windows Mobile. I have been a very happy jung man <img src='http://www.devmil.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>After finishing my studies (2007) I hired at a company that &#8211; you already know this &#8211; develops applications using the .NET Framework. Mainly ASP.NET intranet business applications. I had a very good time there, learned very much about clean code, performance optimizations and databases.<br />
But something in my mind told me to try something different. I don&#8217;t know if I have been bored by the business requirements (finance) or if the birth of our first child triggered considerations regarding our long term future. I don&#8217;t know. Propably a mixture.</p>
<p>So 2011 I hired at a company to develop embedded software (user interfaces for home appliances). A complete new world. C++, embedded software, a big company.</p>
<h3>My way to Android</h3>
<p>Around 2008 I had lost my focus on handsets. I had a &#8220;standard&#8221; phone (Sony Ericcsson I think) and did some Silverlight stuff in my free time. At one day my brother showed me his cool new phone: An iPhone. He told me that this phone has Apps, has nice specs and everybody needs one.<br />
I checked the options to develop for this new handset and discovered some things that I didn&#8217;t like on developer side.<br />
The two things that finally hold me off have been</p>
<ol>
<li>It is an Apple product. Come on! I only knew few people using Apple computers at this time. And these few people were so proud of beeing able to spend so much money for their computer that they had to show and tell this to everybody. I really hate that.</li>
<li>Pay 100 bucks a year and buy a Mac only to develop for a phone as a hobby? Err &#8211; no.</li>
</ol>
<p>A year or so later &#8211; after he almost bricked it trying to jailbreak &#8211; he bought another phone. This phone &#8211; so he said &#8211; is based on Linux and much more open than Apples iOS. He showed me his new Motorola Milestone. I liked the progress this techology has made since my Windows Mobile days and decided to get such a phone for my next contract renewal.</p>
<p>This is how I got my Galaxy S. I found out that the development for Android is based on Java (not so good) and is free (very good). I developed some little sample apps and started to rebuild an app called <a title="Clockr" href="https://play.google.com/store/apps/details?id=com.zehro.android.clockr" target="_blank">Clockr</a>. A clock widget that shows the clock as text. After I had replicated Clockr I started to improve it. Added multiple language support, some settings here, some settings there, a layout editor and that is the story of <a title="Minimalistic Text" href="https://play.google.com/store/apps/details?id=de.devmil.minimaltext" target="_blank">Minimalistic Text</a>.</p>
<h3>My current way back</h3>
<p>So, O.K. you may ask. What the heck has this story to do with the title of this post? I will tell you:</p>
<p>Before I bought the Galaxy S I checked what Microsoft will do with their Windows Mobile (that wasn&#8217;t able to compete with iOS or Android). As a C# fanboy I would have taken some drawbacks as a tradeoff to develop apps in C#. I found out that they (Microsoft) are going to use the &#8220;Apple approach&#8221;.<br />
&#8220;If you like to load your own apps onto your own phone please give us 100 bucks a year&#8221;.<br />
&#8220;If you don&#8217;t want me, you don&#8217;t get me&#8221; I thought and ordered the Galaxy S. Man I have been pissed off.</p>
<p>In the beginning of 2012 &#8211; Minimalistic Text is over a year old &#8211; I have a small business again (for the donations that come for Minimalistic Text and some jobs that came alive through Minimalistic Text) the rumors about Windows (Phone) 8 are getting louder and louder so I started to look into the Windows Phone world again. I really turned off all Windows Mobile / Windows Phone related RSS feeds because I have been so damn pissed off. So I didn&#8217;t get any news about Windows Phone. I realized that Windows Phone has progressed (Copy and Paste, some kind of multithreading, &#8230;) and that if Microsoft can get back into the smartphone game then with the help of Windows 8 on PCs, Tablets and Smartphones.</p>
<p>Driven by the never dying love for C# <img src='http://www.devmil.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  I decided to prepare for Windows 8 by playing around with Windows Phone 7 and ordered a Samsung Omnia W.</p>
<p>I have to say that I have been amazed by this phone. I have a Galaxy Nexus right here on the desk but this little Omnia W smokes the Galaxy Nexus regarding smooth animations / transitions and overall response behavior.<br />
Windows has its drawbacks &#8211; no doubt. The biggest one is that googlemail emails can&#8217;t be starred on the phone (sorry if I didn&#8217;t respond to some emails the past 2 months) and that you can&#8217;t access the file system (from your phone and from your computer).<br />
But despite these drawbacks I use my Omnia W since I got it as my daily driver. My Galaxy Nexus is in my backpack as a backup <img src='http://www.devmil.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I simply can no longer ignore this micro stuttering when swiping through the home screen or app drawer.</p>
<p>Today I know that one can earn those 100 bucks in one year with some Marketplace activity so this argument isn&#8217;t that heavy any more. I don&#8217;t like it because I think that many hobbyists are held off developing for Windows Phone, but I can live with it.</p>
<p>So to explain this blog title: I&#8217;m currently developing some fun apps for Windows Phone using C#. So expect some technical C# / Silverlight / Windows Phone posts in the near future.</p>
<p>And if Microsoft does some things right then I will be very glad to provide some apps for the Windows Phone 8 marketplace.</p>
<p>Ah, and don&#8217;t worry: I will continue developing Minimalistic Text. The user base is too big and I am too proud of it to leave it behind <img src='http://www.devmil.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.devmil.de/?feed=rss2&#038;p=137</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scaled images, the Android fragmentation and a solution</title>
		<link>http://www.devmil.de/?p=99</link>
		<comments>http://www.devmil.de/?p=99#comments</comments>
		<pubDate>Tue, 03 Apr 2012 17:48:03 +0000</pubDate>
		<dc:creator>devmil</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Android Development]]></category>
		<category><![CDATA[Default]]></category>
		<category><![CDATA[ContentProvider]]></category>
		<category><![CDATA[ImageView]]></category>
		<category><![CDATA[Scale]]></category>
		<category><![CDATA[Widget]]></category>

		<guid isPermaLink="false">http://www.devmil.de/?p=99</guid>
		<description><![CDATA[Update 1 It seems like this fix doesn&#8217;t work on every device out there. Some users had scaling issues after I published this change. So I made this change optional. /Update Update 2 The issue seems to be not a scaling problem but a image quality problem. I have changed the source code to produce [...]]]></description>
				<content:encoded><![CDATA[<p><strong>Update 1</strong><br />
It seems like this fix doesn&#8217;t work on every device out there. Some users had scaling issues after I published this change. So I made this change optional.<br />
<strong>/Update</strong><br />
<strong>Update 2</strong><br />
The issue seems to be not a scaling problem but a image quality problem. I have changed the source code to produce much better results<br />
<strong>/Update</strong></p>
<p>While developing an app that needs to interact with the operating system, like Minimalistic Text, every Android developer will get to a point where the Android fragmentation hits him. Sometimes a little bit and sometimes hard <img src='http://www.devmil.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Minimalistic Text has such a &#8220;problem&#8221; since the beginning and today I want to explain what the problem is and what I did to resolve this annoying issue.</p>
<h3>Widgets in Android</h3>
<p>Widgets in Android get updated through packages that are sent from the application. The application can&#8217;t control directly what the widget does but it can throw settings into such a package and send it to the widget. The Launcher app then receives this package and applies it to the widget.<br />
Due to the things Minimalistic Text can do (shadows for example) the options that such a package offers aren&#8217;t enough to bring all the settings that a user has set up to the widget.<br />
So Minimalistic Text uses the &#8220;Bitmap approach&#8221;. The content of the widget gets rendered into a bitmap and then the bitmap gets passed to the widget (through the package). The widget itself is only an ImageView.<br />
This approach works really well. At least on most devices. And at least for certain widget sizes&#8230; The story begins.</p>
<h3>The problem</h3>
<p>From the launch of Minimalistic Text until today there are complaints from users that told me that their widget stops updating. After some investigation I have found out that the package size that the app can send to the widget is limited. I think 1 MB is the maximum. If the app sends a package bigger than that limit the update will fail. The really bad thing is that the app doesn&#8217;t notice this. So the update silently fails and Minimalistic Text doesn&#8217;t know of any problem.<br />
I worked around this issue by reducing the available widget sizes. If you want to get this problem then simply create a 4&#215;2 Minimalistic Text widget and fill it with data so that the image that has to be sent to the widget gets as big as possible.<br />
The only way to avoid sending such a big image through a package is to save the image as a file and only send an URI to the widget where to find it. Sounds great, doesn&#8217;t it?<br />
I have tested this approach on my HTC device and it worked great. So I decided to publish my new bugfix into the wild and shortly after that a e-mail flood has arrived my googlemail account. Many users complained about widgets that are scaled down.<br />
After rolling this bugfix back and googleing around a bit I found out that there is a bug in Android. If the Bitmap isn&#8217;t applied directly to a ImageView but through an URI (that gets fed by a ContentProvider) the image gets scaled down by the density of the screen.</p>
<h3>Fragmentation everywhere</h3>
<p>And here comes the fragmentation into play.<br />
If this bug would be on all devices &#8211; not cool but no problem. Minimalistic Text could simply scale the image up so that the bug scales it down again and everything is fine. Well would be is the right term <img src='http://www.devmil.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
It seems like some vendors have fixed this bug (for some of their devices). I have a HTC Sensation that doesn&#8217;t scale anything. My Galaxy Nexus and the Nexus S do. So thanks to the fragmentation I have no clear way without a bug or with a workaround for this bug.<br />
Pissed off by the fact that my fix doesn&#8217;t work on all devices I took this problem as beeing present and limiting the amount of widget sizes that Minimalistic Text can handle.</p>
<h3>And it gets worse</h3>
<p>As the screen resolutions get bigger and bigger the 1 MB limit comes nearer and nearer. The last days some people had the &#8220;widget doesn&#8217;t update any more&#8221; issue on 4&#215;1 widgets.<br />
So I had to find any way to avoid this issue.</p>
<h3>The solution</h3>
<p>After telling this a colleague of mine and complaining about the &#8220;bad bad&#8221; Android fragmentation and how developing for Android is like creating big if cascades to check what device is currently executing the app to activate special workarounds or hacks he asked me if it was possible to get the bytes that are displayed on the widget to check if they were scaled or not.<br />
After coming home and bringing the kids to bed I tried to use my own ContentProvider and then checked if the image that the ImageView got from the ContentProvider has been scaled. And yes, it did. So now I have found a way to measure this bug and scale the images for the widgets the same way up as they get scaled down by the ImageView.</p>
<p>Dead simple.</p>
<p>To give you an idea of how to achieve this I will post some source code here. So if you aren&#8217;t a developer this place can be a good one to stop reading this post <img src='http://www.devmil.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h3>Some code</h3>
<p>The first step is to make your ContentProvider &#8220;Sample&#8221;-aware. Use some kind of special data to signal the ContentProvider that you need a specified sample image.<br />
I have added the following functions to the Minimalistic Text ContentProvider (the source code is not functional as it is only part of a bigger source file):</p>
<pre class="wp-code-highlight prettyprint">public static final Uri CONTENT_URI = Uri.parse(&quot;content://&quot;
        + PROVIDER_NAME + &quot;/widgets&quot;);

private static String getSampleFileName() {
    return &quot;MT_Sample.png&quot;;
}

public static int getSampleRectangleSize()
{
    return 100;
}

public static Uri ensureSampleBitmap(Context context) throws IOException {
    Uri result = Uri.parse(CONTENT_URI.toString() + &quot;/-1/&quot;
            + Long.toString(Calendar.getInstance().getTimeInMillis()));

    File file = new File(context.getFilesDir(), getSampleFileName());
    if (file.exists())
        return result;
    FileOutputStream fOut = context.openFileOutput(getSampleFileName(),
            Context.MODE_WORLD_READABLE);
    Bitmap sampleBitmap = Bitmap
            .createBitmap(1, 1, Bitmap.Config.ARGB_8888);
    sampleBitmap.setPixel(0, 0, Color.WHITE);
    Bitmap scaledBitmap = Bitmap.createScaledBitmap(sampleBitmap, 
                                    getSampleRectangleSize(), 
                                    getSampleRectangleSize(), false);
    scaledBitmap.compress(CompressFormat.PNG, 100, fOut);
    fOut.flush();
    fOut.close();

    sampleBitmap.recycle();
    scaledBitmap.recycle();

    return result;
}</pre>
<p>This methods allow us to create a sample image that has a dimension of 100&#215;100 and get an URI to retrieve the image.<br />
The code for the openFile method of the ContentProvider looks like this:</p>
<pre class="wp-code-highlight prettyprint">@Override
public ParcelFileDescriptor openFile(Uri uri, String mode)
        throws FileNotFoundException {

    try {
        int widgetId = Integer.parseInt(uri.getPathSegments().get(1));

        File file = null;

        //thie widgetId -1 signals &quot;Sample data&quot;
        if (widgetId == -1) {
            file = new File(getContext().getFilesDir(), 
                    getSampleFileName());
        } else {
            file = new File(getContext().getFilesDir(),
                    getFileName(widgetId));
        }

        return ParcelFileDescriptor.open(file,
                ParcelFileDescriptor.MODE_READ_ONLY);
    } catch (Exception e) {
        return null;
    }
}</pre>
<p>Now the app can measure the amount of wrong scaling by instantiating an ImageView and let the ImageView fetch the sample image:</p>
<pre class="wp-code-highlight prettyprint">private float calculateImageContentProviderScale()
{
    try {
        ImageView imgView = new ImageView(this);
        imgView.setImageURI(
            WidgetImageContentProvider.ensureSampleBitmap(this));
        
        imgView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
        
        return (float)WidgetImageContentProvider.getSampleRectangleSize() 
                / (float)imgView.getMeasuredHeight();
    } catch (IOException e) {
        Log.e(TAG, &quot;Error determining the image scale factor&quot;, e);
        e.printStackTrace();
    }
    return 1;
}</pre>
<p>This factor can be stored as a static variable because this value won&#8217;t change during the app lifetime.<br />
Everytime a widget gets updated Minimalistic Text now uses this factor to scale the image up.</p>
<p>ContentProvider-Part:</p>
<pre class="wp-code-highlight prettyprint">public static Uri updateWidget(Context context, Bitmap widgetContent,
        int widgetId, boolean useSalt, float scaleFactor)
        throws IOException {
    String fName = getFileName(widgetId);
    FileOutputStream fOut = context.openFileOutput(fName,
            Context.MODE_WORLD_READABLE);
    
    Log.d(TAG, &quot;Using a scale factor of &quot; + Float.toString(scaleFactor));
    
    if(scaleFactor &gt; 1)
    {
        float scaledHeight = widgetContent.getHeight() * scaleFactor;
        float scaledWidth = widgetContent.getWidth() * scaleFactor;

        Bitmap scaledWidgetContent = Bitmap.createScaledBitmap(
                                                widgetContent, 
                                                (int)scaledWidth, 
                                                (int)scaledHeight, 
                                                true);
        scaledWidgetContent.compress(CompressFormat.PNG, 100, fOut);
        fOut.flush();
        fOut.close();
        scaledWidgetContent.recycle();
    }
    else
    {
        widgetContent.compress(CompressFormat.PNG, 100, fOut);
        fOut.flush();
        fOut.close();            
    }

    return Uri.parse(CONTENT_URI.toString()
            + &quot;/&quot;
            + Integer.toString(widgetId)
            + &quot;/&quot;
            + (useSalt ? Long.toString(Calendar.getInstance()
                    .getTimeInMillis()) : &quot;&quot;));
}</pre>
<p>Client-Part:</p>
<pre class="wp-code-highlight prettyprint">Bitmap textBitmap = createTextBitmap(context, settings,
        demoMode, ss.hasBeenPortrait(), events);

Uri imgUri = WidgetImageContentProvider.updateWidget(
                        context, 
                        textBitmap, 
                        settings.getAppWidgetId(), 
                        true, 
                        ss.getImageScale());
remoteView.setImageViewUri(R.id.imgContent, imgUri);
textBitmap.recycle();
</pre>
<p>I hope this helps any poor developer out there that has been stuck on the same problem as I have been until today!<br />
If you have any further questions, simply write me an email.</p>
<p>Devmil</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devmil.de/?feed=rss2&#038;p=99</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A little change</title>
		<link>http://www.devmil.de/?p=63</link>
		<comments>http://www.devmil.de/?p=63#comments</comments>
		<pubDate>Sun, 18 Sep 2011 09:08:26 +0000</pubDate>
		<dc:creator>devmil</dc:creator>
				<category><![CDATA[Android Development]]></category>
		<category><![CDATA[Default]]></category>

		<guid isPermaLink="false">http://www.devmil.de/?p=63</guid>
		<description><![CDATA[Hi everybody, I will change the way this blog works a bit. I want to blog more into the &#8220;software development&#8221; / &#8220;Android&#8221; direction than about my personal day to day drivers. Also I have the plan to rise the update frequency of this blog and the language changed to English so that users outside [...]]]></description>
				<content:encoded><![CDATA[<p>Hi everybody,</p>
<p>I will change the way this blog works a bit. I want to blog more into the &#8220;software development&#8221; / &#8220;Android&#8221; direction than about my personal day to day drivers. Also I have the plan to rise the update frequency of this blog and the language changed to English so that users outside Germany can read what I write <img src='http://www.devmil.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So let&#8217;s start off with a little Android exercise. Recently I implemented a new language selector for Minimalistic Text. The old one just used the ListPreference in the Android Settings. My main goal has been to add little flags to each language to make this dialog a little more colored.</p>
<p>A short research on the internet showed me that there is no way to get images into a ListPreference. So I had to implement my own Preference that is capable of a list with images.<br />
My first thought was to derive from ListPreference and add the image functionality. But due to the (lack of) design in the ListPreference there is no way to derive a subclass that implements another visual part. The main reason for this is the fact that the ListPreference stores the selected element index into an internal variable (private) that then gets read by the dialog closed event. So a subclass would have to set the index based on its own view to use the ListPreference functionality like propagating the settings change to all listeners.</p>
<p>So the last possibility has been to copy the ListPreference code to my own class and make images in the list possible.</p>
<p>The solution constists of 6 files:</p>
<ul>
<li>ImageListPreference.java</li>
<li>ImagePreferenceArrayAdapter.java</li>
<li>imagelistpreferencelayout.xml</li>
<li>empty_content.xml</li>
<li>orange_content.xml</li>
<li>clickbackground.xml</li>
</ul>
<div>The ImageListPreference is a copy of the ListPreference and adds an array of resource ids for the images. It sets its own ListAdapter to the Dialog (an instance of ImagePreferenceArrayAdapter). The Adapter then creates the views for the items based on the imagelistpreferencelayout and handles the click events (that set the currently selected index). The 3 drawable xml files are needed to give a visual feedback for tapping on an item (the background gets changed from empty to orange based on the selector in clickbackground.xml.)</div>
<div>You can download the sources for the ImageListPreference here: <a href="http://www.devmil.de/?attachment_id=64" rel="attachment wp-att-64">ImageListPreference.zip</a></div>
<div>That&#8217;s how the new language selector looks like:</div>
<div>
<div id="attachment_67" class="wp-caption alignnone" style="width: 277px"><a href="http://www.devmil.de/?attachment_id=67" rel="attachment wp-att-67"><img class="size-full wp-image-67  " title="language select sample" src="http://www.devmil.de/wp-content/uploads/2011/09/language-select.png" alt="Sample of the new Minimalistic Text language selector" width="267" height="470" /></a><p class="wp-caption-text">Language Selector</p></div>
</div>
<div>If you have any questions or feedback for the ImageListPreference then write me an email.</div>
<div>Devmil</div>
]]></content:encoded>
			<wfw:commentRss>http://www.devmil.de/?feed=rss2&#038;p=63</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aktueller Stand / Wiki</title>
		<link>http://www.devmil.de/?p=59</link>
		<comments>http://www.devmil.de/?p=59#comments</comments>
		<pubDate>Mon, 04 Apr 2011 21:03:40 +0000</pubDate>
		<dc:creator>devmil</dc:creator>
				<category><![CDATA[Default]]></category>

		<guid isPermaLink="false">http://www.devmil.de/?p=59</guid>
		<description><![CDATA[Derzeit komme ich nicht sehr oft dazu an Minimalistic Text weiterzuarbeiten. Der neue Layout Editor befindet sich nach wie vor in einem frühen Entwicklungsstadium und die Liste der Todo&#8217;s wird immer länger. So wird mir auf lange Sicht sicherlich nicht langweilig Ich habe für Minimalistic Text ein Wiki eingerichtet. Die Idee ist dass User dort [...]]]></description>
				<content:encoded><![CDATA[<p>Derzeit komme ich nicht sehr oft dazu an Minimalistic Text weiterzuarbeiten.<br />
Der neue Layout Editor befindet sich nach wie vor in einem frühen Entwicklungsstadium und die Liste der Todo&#8217;s wird immer länger. So wird mir auf lange Sicht sicherlich nicht langweilig <img src='http://www.devmil.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Ich habe für Minimalistic Text ein Wiki eingerichtet. Die Idee ist dass User dort ihre Tipps / Anleitungen / Einstellungen verewigen und mit der Community teilen können. Ich bin gespannt, ob das Wiki Anklang findet.</p>
<p>Das Minimalistic Text Wiki ist unter <a href="http://wiki.devmil.de">http://wiki.devmil.de</a> erreichbar.</p>
<p>Devmil</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devmil.de/?feed=rss2&#038;p=59</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open Source Color Picker für Android</title>
		<link>http://www.devmil.de/?p=36</link>
		<comments>http://www.devmil.de/?p=36#comments</comments>
		<pubDate>Sat, 08 Jan 2011 13:49:01 +0000</pubDate>
		<dc:creator>devmil</dc:creator>
				<category><![CDATA[Android Development]]></category>

		<guid isPermaLink="false">http://www.devmil.de/?p=36</guid>
		<description><![CDATA[Nachdem ich für Android keinen umfassenden Color Picker gefunden habe, habe ich mich dazu entschlossen einen eigenen zu bauen. Aus der Minimalistic Text Ecke kamen Anforderungen wie &#8220;RGB-Farbregler&#8221; und &#8220;HEX Code Eingabe&#8221;. Also habe ich alle zusammen in einen Farbauswahldialog gesteckt. Über Tabs kann man sich entscheiden, ob man lieber HSV, RGB oder den HEX [...]]]></description>
				<content:encoded><![CDATA[<p>Nachdem ich für Android keinen umfassenden Color Picker gefunden habe, habe ich mich dazu entschlossen einen eigenen zu bauen. Aus der Minimalistic Text Ecke kamen Anforderungen wie &#8220;RGB-Farbregler&#8221; und &#8220;HEX Code Eingabe&#8221;.</p>
<p>Also habe ich alle zusammen in einen Farbauswahldialog gesteckt. Über Tabs kann man sich entscheiden, ob man lieber HSV, RGB oder den HEX Code als Eingabemöglichkeit vorzieht. So sieht er dann in Aktion aus:</p>

<a href='http://www.devmil.de/?attachment_id=37' title='HSV Eingabe'><img width="90" height="150" src="http://www.devmil.de/wp-content/uploads/2011/01/scrn1.png" class="attachment-thumbnail" alt="HSV Eingabe" /></a>
<a href='http://www.devmil.de/?attachment_id=38' title='RGB Eingabe'><img width="90" height="150" src="http://www.devmil.de/wp-content/uploads/2011/01/scrn2.png" class="attachment-thumbnail" alt="RGB Eingabe" /></a>
<a href='http://www.devmil.de/?attachment_id=39' title='HEX Eingabe'><img width="90" height="150" src="http://www.devmil.de/wp-content/uploads/2011/01/scrn3.png" class="attachment-thumbnail" alt="HEX Eingabe" /></a>

<p>Falls Ihr ihn verwenden oder sogar daran mitentwickeln wollt: Der Source Code ist <a href="http://code.google.com/p/devmil-android-color-picker/" target="_blank">hier</a> zu finden.</p>
<p>Devmil</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devmil.de/?feed=rss2&#038;p=36</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Minimalistic Text hält mich auf Trab</title>
		<link>http://www.devmil.de/?p=28</link>
		<comments>http://www.devmil.de/?p=28#comments</comments>
		<pubDate>Mon, 20 Dec 2010 19:23:13 +0000</pubDate>
		<dc:creator>devmil</dc:creator>
				<category><![CDATA[Android Development]]></category>

		<guid isPermaLink="false">http://www.devmil.de/?p=28</guid>
		<description><![CDATA[So, nach 2,5 Wochen melde ich mich hier auch mal wieder. Minimalistic Text Der Release von Minimalistic Text verlief sehr gut. Inzwischen sind es über 20000 Downloads und fast 10000 aktive Installationen. Die letzten Wochen hat sich auch einiges an Minimalsitic Text getan. Mehrsprachigkeit, Statischer Text, Wetterdaten und viele weitere Verbesserungen sind bereits eingeflossen. Das kleine [...]]]></description>
				<content:encoded><![CDATA[<p><span style="color: #444444;"><span style="font-family: Georgia, 'Bitstream Charter', serif;"><span style="font-size: small;">So, nach 2,5 Wochen melde ich mich hier auch mal wieder.</span></span></span></p>
<h3>Minimalistic Text</h3>
<p><span style="color: #444444;"><span style="font-family: Georgia, 'Bitstream Charter', serif;"><span style="font-size: small;">Der Release von Minimalistic Text verlief sehr gut. Inzwischen sind es über 20000 Downloads und fast 10000 aktive Installationen. Die letzten Wochen hat sich auch einiges an Minimalsitic Text getan. Mehrsprachigkeit, Statischer Text, Wetterdaten und viele weitere Verbesserungen sind bereits eingeflossen.</span></span></span></p>
<p><span style="color: #444444;"><span style="font-family: Georgia, 'Bitstream Charter', serif;"><span style="font-size: small;">Das kleine Spaßprojekt ist schon fast zur Feierabend-Arbeit mutiert und nimmt momentan fast jede Minute ein, die ich am Rechner verbringe. Es wollen E-Mails mit Fragen beantwortet, Forenbeiträge geschrieben und Erweiterungen entwickelt werden. Nichtsdestotrotz macht es mir nach wie vor Spaß die App weiterzubringen.</span></span></span></p>
<p><span style="color: #444444;"><span style="font-family: Georgia, 'Bitstream Charter', serif;"><span style="font-size: small;">Ich konnte dank der App bereits sehr viel über die Android Entwicklung lernen und wie in anderen Programmiersprachen / auf anderen Plattformen auch, lernt man nie aus und ständig was Neues.</span></span></span></p>
<h3>Wen man Annahmen über die API hinaus trifft&#8230;</h3>
<p><span style="color: #444444;"><span style="font-family: Georgia, 'Bitstream Charter', serif;"><span style="font-size: small;">Vor ein paar Tagen gab es Probleme mit Minimalistic Text auf bestimmten, neueren JPU-Roms für das Samsung Galaxy S I9000. Minimalistic Text hat einfach den Start verweigert, bzw. kein Widget mehr als &#8220;existent&#8221; betrachtet.</span></span></span></p>
<p><span style="color: #444444;"><span style="font-family: Georgia, 'Bitstream Charter', serif;"><span style="font-size: small;">Nach einigem Hin und Her und einer E-Mail Konversation mit einem betroffenen konnte ich dem Problem auf den Grund gehen:</span></span></span></p>
<p><span style="color: #444444;"><span style="font-family: Georgia, 'Bitstream Charter', serif;"><span style="font-size: small;">Hintergrund ist die Tatsache, dass man in Android zwar Einstellungsdateien (Shared Preferences) anlegen, aber nicht mehr löschen kann. Jedes Widget in Minimalistic Text besitzt eine eigene Einstellungsdatei, so dass &#8220;Datenmüll&#8221; übrig bleibt, wenn man ein Widget löscht. Minimalistic Text &#8220;weiß&#8221; wo diese Einstellungsdateien liegen und löscht diese, wenn ein Widget vom Homescreen entfernt wird.</span></span></span></p>
<p><span style="color: #444444;"><span style="font-family: Georgia, 'Bitstream Charter', serif;"><span style="font-size: small;">Außerdem hatte ich temporär das Phänomen, dass Widget-Ids zwar noch vorhanden waren, die zugehörigen Widgets aber schon längst vom Homescreen entfernt wurden. Um unnötiges Aktualisieren von nicht mehr sichtbaren Widgets zu verhindern prüft Minimalistic Text, ob ein Widget noch da ist, indem es prüft, ob es noch eine Einstellungsdatei dazu gibt.</span></span></span></p>
<p><span style="color: #444444;"><span style="font-family: Georgia, 'Bitstream Charter', serif;"><span style="font-size: small;">Diese beiden &#8220;Features&#8221; basieren darauf, dass die Einstellungsdateien unter <em>&#8220;/data/data/de.devmil.miniamaltext/shared_prefs&#8221;</em> liegen.<br />
Tun sie auch, bei (fast) allen mir bekannten Geräten. Nur eben nicht in den neuen Samsung ROMs.</span></span></span></p>
<p><span style="color: #444444;"><span style="font-family: Georgia, 'Bitstream Charter', serif;"><span style="font-size: small;">Ist ja auch nichts verwerfliches. Die API der Shared Preferences oder des Contexts gibt auch keinen Pfad zu diesen Einstellungsdateien, so dass die Annahme des Speicherplatzes schon etwas gewagt war, wenn man bedenkt wie viele unterschiedliche Android Geräte es gibt.</span></span></span></p>
<p><span style="color: #444444;"><span style="font-family: Georgia, 'Bitstream Charter', serif;"><span style="font-size: small;">Auf jeden Fall prüft Minimalistic Text jetzt, ob es das vermutete Verzeichnis überhaupt gibt. Wenn nicht, dann wird in den &#8220;mir doch egal&#8221;-Modus gegangen und jede WidgetId als vorhanden angenommen und die Einstellungsdatei nur geleert, nicht aber gelöscht.</span></span></span></p>
<p><span style="color: #444444;"><span style="font-family: Georgia, 'Bitstream Charter', serif;"><span style="font-size: small;">Für das Samsung ROM habe ich inzwischen herausgefunden wo die Einstellungsdateien liegen, da ich jetzt auf die Version JPX (ebenfalls Android 2.2.1) gegangen bin und die das gleiche Verhalten zeigt.</span></span></span></p>
<p><span style="color: #444444;"><span style="font-family: Georgia, 'Bitstream Charter', serif;"><span style="font-size: small;">Anscheinend hat Samsung aus Performance-gründen die Shared Preferences von <em>&#8220;/data/data/&lt;Package&gt;/shared_prefs&#8221;</em> nach <em>&#8220;/dbdata/databases/&lt;Package&gt;/shared_prefs&#8221;</em> umgezogen.</span></span></span></p>
<p><span style="color: #444444;"><span style="font-family: Georgia, 'Bitstream Charter', serif;"><span style="font-size: small;">Die nächste Minimalistic Text Version wird dieses Verzeichnis auch in Betracht ziehen.</span></span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devmil.de/?feed=rss2&#038;p=28</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Die erste App</title>
		<link>http://www.devmil.de/?p=21</link>
		<comments>http://www.devmil.de/?p=21#comments</comments>
		<pubDate>Fri, 03 Dec 2010 23:57:01 +0000</pubDate>
		<dc:creator>devmil</dc:creator>
				<category><![CDATA[Android Development]]></category>

		<guid isPermaLink="false">http://www.devmil.de/?p=21</guid>
		<description><![CDATA[Ich habe heute meine erste Android App veröffentlicht. Sie befindet sich noch in Entwicklung, läuft aber stabil genug so dass ich jetzt auf konstruktive Rückmeldungen  hoffe, um die Wünsche der User so früh wie möglich in die Anwendung zu bringen. Minimalistic Text heißt sie und versteht sich als Meta-Widget zur Darstellung von Information auf eine minimalistische [...]]]></description>
				<content:encoded><![CDATA[<p>Ich habe heute meine erste Android App veröffentlicht.<br />
Sie befindet sich noch in Entwicklung, läuft aber stabil genug so dass ich jetzt auf konstruktive Rückmeldungen  hoffe, um die Wünsche der User so früh wie möglich in die Anwendung zu bringen.</p>
<p>Minimalistic Text heißt sie und versteht sich als Meta-Widget zur Darstellung von Information auf eine minimalistische Art und Weise. Derzeit werden Zeit-, Datums und Akkuinformationen verarbeitet und dem User in Form von Variablen zur Verfügung gestellt.</p>
<p>Der User kann sich mit Hilfe des Layout Editors die Variablen so zurechtlegen, wie er es gerne hätte. Pro Widget lassen sich dann noch die Styles der Schriften anpassen und schon hat man ein individuelles Widget.</p>
<p>Für die Zukunft ist, neben vielen anderen Erweiterungen, geplant, noch mehr Informationsquellen einzubinden (Wetter z.B.). Außerdem wird es die Möglichkeit geben die Sprache pro Widget einzustellen (derzeit fest Englisch).</p>
<p>So sieht das Werbe Bild aus<span style="font-size: 13px; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px;"><img class="alignnone size-full wp-image-23" title="ScreenBrokenGlass_Bars_Small" src="http://www.devmil.de/wp-content/uploads/2010/12/ScreenBrokenGlass_Bars_Small.png" alt="" width="600" height="471" /></span></p>
<p><a title="XDA Forumsbeitrag" href="http://forum.xda-developers.com/showthread.php?p=9570807#post9570807" target="_blank">XDA-Forumsbeitrag (von mir)</a><br />
<a title="AppBrain" href="http://www.appbrain.com/app/minimalistic-text/de.devmil.minimaltext#" target="_blank">AppBrain-Link</a><br />
<a title="Markt Link" href="market://search?q=pname:de.devmil.minimaltext" target="_blank">Markt-Link (funktioniert nur vom Android Handy aus) </a><br />
<a href="market://search?q=pname:de.devmil.minimaltext"><img class="alignnone size-full wp-image-25" title="MinimalisticTextQR" src="http://www.devmil.de/wp-content/uploads/2010/12/MinimalisticTextQR.png" alt="" width="175" height="175" /></a></p>
<p><a title="Hilfe" href="http://devmil.de/MinimalisticTextDocs/MiniGuide.html" target="_blank">Hier gibt es eine sehr knappe Hilfe zu Minimalistic Text (auf Englisch)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devmil.de/?feed=rss2&#038;p=21</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Android und die Fragmentierung</title>
		<link>http://www.devmil.de/?p=15</link>
		<comments>http://www.devmil.de/?p=15#comments</comments>
		<pubDate>Sat, 27 Nov 2010 23:07:12 +0000</pubDate>
		<dc:creator>devmil</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.devmil.de/?p=15</guid>
		<description><![CDATA[Es gibt immer wieder Momente an denen wird mir sonnenklar warum Android in der jetzigen Form mehr auf Power User ausgelegt ist. Ich habe meinen Androiden (Samsung Galaxy S I9000) jetzt seit ca. einem Monat und arbeite mich Tag für Tag tiefer in die Materie &#8220;Android&#8221; ein. Anfang des Monats stand für das Galaxy S [...]]]></description>
				<content:encoded><![CDATA[<p>Es gibt immer wieder Momente an denen wird mir sonnenklar warum Android in der jetzigen Form mehr auf Power User ausgelegt ist.</p>
<p>Ich habe meinen Androiden (Samsung Galaxy S I9000) jetzt seit ca. einem Monat und arbeite mich Tag für Tag tiefer in die Materie &#8220;Android&#8221; ein.<br />
Anfang des Monats stand für das Galaxy S ein Update auf FroYo (Android 2.2) an. Zu Glück noch bevor bevor die Version 2.3 (Gingerbread) erschienen ist <img src='http://www.devmil.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Dadurch habe ich die Update Thematik hautnah miterlebt.</p>
<p>Android ist kein Eigentum von Google, sondern offiziell eine Art Zusammenarbeit verschiedener Hersteller. Der Quellcode ist offen und kann von jedermann eingesehen werden. Die einzelnen Hersteller nehmen diesen Source Code als Basis und stricken eine mehr oder weniger dicke, eigene Schicht darüber (z.B. Hardwaretreiber, spezielle Apps, &#8230;). Dann sind da noch die Netzbetreiber die das Android vom Hersteller bekommen und wiederum ihre Besonderheiten einbauen (Werbe-Apps, Theme, Mobilfunkeinstellungen, &#8230;).</p>
<p>Man sieht schon: Der Weg ist lang. Aber da hört das Problem noch nicht auf. Die Hersteller arbeiten (verständlicher Weise) gewinnorientiert. Wenn jetzt so ein Handy in die Jahre (oder Monate, <a href="http://www.heise.de/mobil/meldung/Keine-Android-Updates-fuer-Milestone-XT720-1141659.html" target="_blank">wie bei Motorola</a>) kommt, dann wird irgendwann der Support eingestellt. Da nützt es herzlich wenig dass von Google vorangetrieben eine neue Version von Android bereit steht. Wenn der Hersteller keine Treiber dafür anpasst, dann gibt es eben kein Update.<br />
Das Problem heutzutage ist, dass die Systeme (auch auf den Smartphones) viel zu komplex sind als dass sie mit sehr wenigen oder sogar gar keinen Updates auskommen würden. Jeder der auf seinem Rechner Windows, Linux oder MacOS installiert hat, der wird sicher feststellen dass da das ein oder andere Mal Updates zur Verfügung stehen. Diese Updates machen die Betriebssystemhersteller nicht zum Spaß, sondern meistens um Fehler oder gar Sicherheitslücken auszumerzen.<br />
Was macht nun also so ein Motorola Android Besitzer, für den Motorola keine Updates mehr bereit stellt? Dia Apps kann er noch aktualisieren, aber alles was zum Betriebssystem gehört bleibt (normalerweise) so, wie es ist.<br />
Stellt sich also heraus, dass der Android Browser eine <a href="http://www.heise.de/security/meldung/Android-Luecke-ermoeglicht-Datenklau-1140932.html" target="_blank">Sicherheitslücke</a> hat, dann wird diese Lücke bleiben. Für immer.</p>
<p>An dieser Stelle bleibt dem Android-Besitzer, dessen Support eingestellt wurde, nur der Gang zu diversen einschlägigen Seiten (die bekannteste davon ist wohl <a href="XDA-developers.com" target="_blank">XDA-developers.com</a>) in der Hoffnung, dass dort ein paar schlaue Entwickler sitzen die genau das gleiche Handy haben (oder eine Herausforderung brauchen) und das neue Android für das Gerät anpassen.</p>
<p>Erkläre das mal deinem Opa (Ausnahmen bestätigen natürlich die Regel <img src='http://www.devmil.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ).</p>
<p>Derzeit kann man also nur sagen: Android &#8211; ja, ohne Zweifel, wenn du ein Power User bist oder werden willst und &#8211; nein, auf keinen Fall, wenn du einfach nur ein Handy brauchst, mit dem du telefonieren und ab und an mal E-Mails checken willst.</p>
<p>Devmil</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devmil.de/?feed=rss2&#038;p=15</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ein neuer Blog</title>
		<link>http://www.devmil.de/?p=10</link>
		<comments>http://www.devmil.de/?p=10#comments</comments>
		<pubDate>Wed, 17 Nov 2010 12:41:08 +0000</pubDate>
		<dc:creator>devmil</dc:creator>
				<category><![CDATA[Default]]></category>

		<guid isPermaLink="false">http://www.devmil.de/?p=10</guid>
		<description><![CDATA[Hallo zusammen, in diesem Blog wird es um meine Erfahrungen / Meinungen rund um das Thema Softwareentwicklung und im speziellen um Programmierung auf mobilen Endgeräten gehen. Der Blog hat kein streng abgegrenztes Thema wie &#8220;.NET Entwicklung&#8221; oder &#8220;Android Entwicklung&#8221; sondern beschäftigt sich mit den Themen, mit denen ich mich gerade beschäftige. Und das kann je [...]]]></description>
				<content:encoded><![CDATA[<p>Hallo zusammen,</p>
<p>in diesem Blog wird es um meine Erfahrungen / Meinungen rund um das Thema Softwareentwicklung und im speziellen um Programmierung auf mobilen Endgeräten gehen.<br />
Der Blog hat kein streng abgegrenztes Thema wie &#8220;.NET Entwicklung&#8221; oder &#8220;Android Entwicklung&#8221; sondern beschäftigt sich mit den Themen, mit denen ich mich gerade beschäftige. Und das kann je nach Lust, Laune und Gegebenheit auch mal wechseln.</p>
<p>Erst neulich ist so eine Kehrtwende passiert.<br />
Die letzten Jahre hat sich sowohl in der Arbeit als auch privat alles, was programmieren anbelangt, um .NET und C# gedreht. Auch die Auswahl meiner Handys war ohne Debatte auf Windows Mobile festgelegt, da ich dafür mit .NET relativ einfach programme schreiben konnte.<br />
Vor ein paar Monaten hat sich in mir eine Neugierde nach etwas anderem entwickelt, die immer ausgeprägter wurde. Diese Neugierde zusammen mit einem anstehenden Jobwechsel und zu guter letzt die Details, die über Windows Phone 7 bekannt geworden sind, haben mich dazu gebracht meinen Blick von .NET und C# zu lösen und mein mobiles Gerät unabhängig der benötigten Programmiersprache, sondern abhängig von dem Mehrwert / Nutzen den es mir bringt und den Möglichkeiten die ich damit habe, auszuwählen.<br />
Am Ende ist es dann ein Android Handy geworden. Genauer: Ein Samsung Galaxy S I9000<br />
Meine Entscheidung hat ihre Ursachen sowohl aus der Sicht eines Entwicklers als auch als der Sicht eines Power Users:</p>
<p>Entwicklersicht:</p>
<ul>
<li>Für Android muss der Entwickler kein Geld bezahlen, um ein selbstgeschriebenes Programm auf sein Gerät zu bringen. Kein Witz! Kein Geld! <img src='http://www.devmil.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Hintergrund dieser Aussage: Apple und Microsoft verlangen von Entwicklern, die doch tatsächlich ihr Programm auf dem Handy ausführen wollen, dass sie registrierte Entwickler werden. Das kostet dann so 100$ / Jahr. Für Google muss man erst bezahlen (und auch nur moderate 25€, einmalig) wenn man seine Anwendung im Google Market anbieten will.</li>
<li>Anwendungen haben in Android mehr Möglichkeiten. Ein Programm kann ohne groß Aufwand zu betreiben, einen Hintergrunddienst starten um z.B. irgendetwas zu aktualisieren, GPS zu tracken, &#8230; Sowas geht (zumindest so einfach) bei Microsoft und Apple nicht. Kann auch Vorteile haben, dazu später mehr in der Nutzersicht.</li>
</ul>
<p>Nutzersicht:</p>
<ul>
<li>klar ist es ein Vorteil, wenn die Plattform an sich schon eine sehr große Sicherheit bietet um sicherzustellen dass sich Anwendungen korrekt verhalten und nicht unnötig Akku verschwenden oder private Daten ins Internet senden. Die interessante Frage an dieser Stelle ist der Preis dafür.<br />
Die Gefahr, dass sich Anwendungen &#8220;nicht korrekt&#8221; verhalten sehe ich auf Android schon etwas höher, da keine Instanz die Anwendung prüft. Auf der anderen Seite gibt es auch keine Instanz die Anwendungen auf Grund irgendwelcher firmenpolitischer Entscheidungen verhindert / aufhält (Flash + iPhone z.B.).</li>
<li>Falls mal irgendwo ein Fehler enthalten ist (was ja in der Softwareentwicklung ab und an mal vorkommen soll) ist man mit Android &#8220;freier&#8221; im Sinne von &#8220;dann suche ich mir halt eine andere App, die den gleichen Job erledigt&#8221;. Dabei ist Android nicht auf die oberflächlichen Apps beschränkt, sondern dann wird halt schon mal der Home Screen oder die Gallerie getauscht. Erfordert mehr Auseinandersetzung mit dem Gerät, eröffnet aber auch deutlich mehr Möglichkeiten (aber: auch was falsch zu machen)</li>
</ul>
<p>Im Endeffekt wird jeder für sich selbst entscheiden müssen, auf welche Aspekte er/sie mehr Wert legt. Ich für meinen Teil kann nur sagen, dass ich mich für Android entschieden habe.</p>
<p>Was ich eigentlich damit ausdrücken wollte: Dieser Blog kann innerhalb von Monaten eine Kehrtwende machen und sich in eine andere Richtung bewegen. Wie mein &#8220;Brain&#8221; halt auch.</p>
<p>Devmil</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devmil.de/?feed=rss2&#038;p=10</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
