<?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>best practices &#8211; Wiebe Elsinga</title>
	<atom:link href="http://wiebe-elsinga.com/blog/tag/best-practices/feed/" rel="self" type="application/rss+xml" />
	<link>http://wiebe-elsinga.com/blog</link>
	<description>Blog</description>
	<lastBuildDate>Wed, 16 Nov 2011 05:53:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.1</generator>
	<item>
		<title>Android Best Practices: MAT</title>
		<link>http://wiebe-elsinga.com/blog/android-best-practices-mat/</link>
					<comments>http://wiebe-elsinga.com/blog/android-best-practices-mat/#respond</comments>
		
		<dc:creator><![CDATA[W.Elsinga]]></dc:creator>
		<pubDate>Mon, 31 Oct 2011 23:14:11 +0000</pubDate>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[MAT]]></category>
		<guid isPermaLink="false">http://wiebe-elsinga.com/blog/?p=880</guid>

					<description><![CDATA[When you want to improve an Android application performance, you need to do profiling. Welcome MAT! What is MAT? It&#8217;s a Java heap analyzer tool introduced by Eclipse that helps you find memory leaks. How-To First you need to extract a hprof file from the Android device. When running the device select the Dump HPROF file option as shown here Convert the .hprof file from the Dalvik format to the J2SE HPROF format. You can do this using the hprof-conv tool provided in the Android SDK. hprof-conv dump.hprof converted-dump.hprof Import the converted hprof file into MAT, and start anaylzing]]></description>
										<content:encoded><![CDATA[<p>When you want to improve an Android application performance, you need to do profiling. Welcome MAT!</p>
<h3>What is MAT?</h3>
<p>It&#8217;s a Java heap analyzer tool introduced by Eclipse that helps you find memory leaks.</p>
<h3>How-To</h3>
<p>First you need to extract a hprof file from the Android device. When running the device select the <em>Dump HPROF file</em> option as shown here</p>
<p><img loading="lazy" class="aligncenter size-full wp-image-886" title="get dump" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2011/10/get-dump.png" alt="" width="258" height="26" /></p>
<p>Convert the <em>.hprof</em> file from the Dalvik format to the J2SE HPROF format. You can do this using the hprof-conv tool provided in the Android SDK.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">hprof-conv dump.hprof converted-dump.hprof</div></div>
<p>Import the converted <em>hprof</em> file into MAT, and start anaylzing</p>
<p><a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2011/10/example-MAT.png" rel="lightbox[880]" title="example MAT"><img loading="lazy" class="aligncenter size-medium wp-image-890" title="example MAT" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2011/10/example-MAT-300x236.png" alt="" width="300" height="236" srcset="http://wiebe-elsinga.com/blog/wp-content/uploads/2011/10/example-MAT-300x237.png 300w, http://wiebe-elsinga.com/blog/wp-content/uploads/2011/10/example-MAT-800x632.png 800w, http://wiebe-elsinga.com/blog/wp-content/uploads/2011/10/example-MAT.png 847w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
]]></content:encoded>
					
					<wfw:commentRss>http://wiebe-elsinga.com/blog/android-best-practices-mat/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Android Best Practices: StrictMode</title>
		<link>http://wiebe-elsinga.com/blog/869/</link>
					<comments>http://wiebe-elsinga.com/blog/869/#respond</comments>
		
		<dc:creator><![CDATA[W.Elsinga]]></dc:creator>
		<pubDate>Wed, 26 Oct 2011 23:05:37 +0000</pubDate>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[StrictMode]]></category>
		<guid isPermaLink="false">http://wiebe-elsinga.com/blog/?p=869</guid>

					<description><![CDATA[When developing Android applications that uses network and database access, you need to do performance tuning. This is where StrictMode comes in handy StrictMode? StrictMode is used to detect memory leaks. It&#8217;s has introduced in Gingerbread and can be used as a development tool. The configuration below was the proposed in the reference documentation: public void onCreate&#40;&#41; &#123; &#160; &#160; &#160;if &#40;DEVELOPER_MODE&#41; &#123; &#160; &#160; &#160; &#160; &#160;StrictMode.setThreadPolicy&#40;new StrictMode.ThreadPolicy.Builder&#40;&#41; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;.detectDiskReads&#40;&#41; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;.detectDiskWrites&#40;&#41; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;.detectNetwork&#40;&#41; &#160; // or .detectAll() for all detectable problems &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;.penaltyLog&#40;&#41; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;.build&#40;&#41;&#41;; &#160; &#160; &#160; &#160; &#160;StrictMode.setVmPolicy&#40;new StrictMode.VmPolicy.Builder&#40;&#41; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;.detectLeakedSqlLiteObjects&#40;&#41; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;.detectLeakedClosableObjects&#40;&#41; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;.penaltyLog&#40;&#41; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;.penaltyDeath&#40;&#41; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;.build&#40;&#41;&#41;; &#160; &#160; &#160;&#125; &#160; &#160; &#160;super.onCreate&#40;&#41;; &#160;&#125; Update If you&#8217;re looking on how to get StrictMode working for all Android platform versions, have a look at this article.]]></description>
										<content:encoded><![CDATA[<p>When developing Android applications that uses network and database access, you need to do performance tuning. This is where StrictMode comes in handy</p>
<h3>StrictMode?</h3>
<p>StrictMode is used to detect memory leaks. It&#8217;s has introduced in Gingerbread and can be used as a development tool.</p>
<p>The configuration below was the proposed in the <a href="http://developer.android.com/reference/android/os/StrictMode.html" target="_blank">reference</a> documentation:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><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><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>DEVELOPER_MODE<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;StrictMode.<span style="color: #006633;">setThreadPolicy</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> StrictMode.<span style="color: #006633;">ThreadPolicy</span>.<span style="color: #006633;">Builder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.<span style="color: #006633;">detectDiskReads</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.<span style="color: #006633;">detectDiskWrites</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.<span style="color: #006633;">detectNetwork</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> &nbsp; <span style="color: #666666; font-style: italic;">// or .detectAll() for all detectable problems</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.<span style="color: #006633;">penaltyLog</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.<span style="color: #006633;">build</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;StrictMode.<span style="color: #006633;">setVmPolicy</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> StrictMode.<span style="color: #006633;">VmPolicy</span>.<span style="color: #006633;">Builder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.<span style="color: #006633;">detectLeakedSqlLiteObjects</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.<span style="color: #006633;">detectLeakedClosableObjects</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.<span style="color: #006633;">penaltyLog</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.<span style="color: #006633;">penaltyDeath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.<span style="color: #006633;">build</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #009900;">&#125;</span></div></div>
<p><strong>Update</strong> If you&#8217;re looking on how to get StrictMode working for all Android platform versions, have a look at <a href="http://www.simpligility.com/2011/01/android-strictmode-for-all-platform-versions/" target="_blank">this</a> article.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://wiebe-elsinga.com/blog/869/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
