<?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>Android Programmer</title>
	<atom:link href="http://www.android-programmer.co.uk/feed" rel="self" type="application/rss+xml" />
	<link>http://www.android-programmer.co.uk</link>
	<description>Android Programmer Resources</description>
	<lastBuildDate>Fri, 06 Jan 2012 10:29:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Special Directories</title>
		<link>http://www.android-programmer.co.uk/java/file-io/special-directories</link>
		<comments>http://www.android-programmer.co.uk/java/file-io/special-directories#comments</comments>
		<pubDate>Tue, 14 Jun 2011 16:08:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[File IO]]></category>

		<guid isPermaLink="false">http://www.electronic-technology-consultant.com/?p=53</guid>
		<description><![CDATA[Get exe directory String exePath = new File(getClass().getResource("").getPath()).getParentFile().getParent(); //Gives: // "file:C:Program Files (x86)My App DirectoryMy App Name 2.2.4libmymodulename.jar!comname" int index = exePath.lastIndexOf("\lib\mymodulename.jar!\com\name"); if (index > 0) exePath = exePath.substring(0, index);]]></description>
			<content:encoded><![CDATA[<h4>Get exe directory</h4>
<pre><code>
	String exePath = new File(getClass().getResource("").getPath()).getParentFile().getParent();
	//Gives:
	//	"file:C:Program Files (x86)My App DirectoryMy App Name 2.2.4libmymodulename.jar!comname"

	int index = exePath.lastIndexOf("\lib\mymodulename.jar!\com\name");
	if (index > 0)
		exePath = exePath.substring(0, index);
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.android-programmer.co.uk/java/file-io/special-directories/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with files</title>
		<link>http://www.android-programmer.co.uk/java/file-io/working-with-files</link>
		<comments>http://www.android-programmer.co.uk/java/file-io/working-with-files#comments</comments>
		<pubDate>Tue, 14 Jun 2011 15:38:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[File IO]]></category>

		<guid isPermaLink="false">http://www.electronic-technology-consultant.com/?p=50</guid>
		<description><![CDATA[Delete File And Parent Directories If Now Empty //Delete file boolean success = (new File(outputPath)).delete(); if (success) { //Delete empty parent directories int index; File file; while(true) { index = outputPath.lastIndexOf("/"); if (index &#60; 1) break; outputPath = outputPath.substring(0, index); if (outputPath.length() == 0) break; file = new File(outputPath); if (!file.isDirectory()) break; if (file.list().length &#62; [...]]]></description>
			<content:encoded><![CDATA[<h4>Delete File And Parent Directories If Now Empty</h4>
<pre><code>
	//Delete file
	boolean success = (new File(outputPath)).delete();
	if (success)
	{
		//Delete empty parent directories
		int index;
		File file;
		while(true)
		{
			index = outputPath.lastIndexOf("/");
			if (index &lt; 1) 				break; 			outputPath = outputPath.substring(0, index); 								 			if (outputPath.length() == 0) 				break; 			 			file = new File(outputPath); 			if (!file.isDirectory()) 				break; 			 			if (file.list().length &gt; 0)
			{
				break;					//There are files - all done
			}

<span id="more-50"></span>

			report += "[Deleting directory: " + outputPath + "]";

			success = (new File(outputPath)).delete();
			if (!success)
				break;					//Deletion failed (not empty)
			Thread.sleep(100);			//Wait for deletion to complete (otherwise directory will still be there when we check the next directory up for empty)
		}
	}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.android-programmer.co.uk/java/file-io/working-with-files/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sleep</title>
		<link>http://www.android-programmer.co.uk/java/sleep/sleep</link>
		<comments>http://www.android-programmer.co.uk/java/sleep/sleep#comments</comments>
		<pubDate>Tue, 14 Jun 2011 15:35:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Sleep]]></category>

		<guid isPermaLink="false">http://www.electronic-technology-consultant.com/?p=48</guid>
		<description><![CDATA[Thread.sleep(100); //mS]]></description>
			<content:encoded><![CDATA[<pre><code>
	Thread.sleep(100);		//mS
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.android-programmer.co.uk/java/sleep/sleep/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working With Directories</title>
		<link>http://www.android-programmer.co.uk/java/file-io/working-with-directories</link>
		<comments>http://www.android-programmer.co.uk/java/file-io/working-with-directories#comments</comments>
		<pubDate>Tue, 14 Jun 2011 14:41:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[File IO]]></category>

		<guid isPermaLink="false">http://www.electronic-technology-consultant.com/?p=46</guid>
		<description><![CDATA[Create Directory boolean exists = (new File("C:/downloads/mydir")).exists(); if (!exists) new File("C:/downloads/mydir").mkdirs();]]></description>
			<content:encoded><![CDATA[<h4>Create Directory</h4>
<pre><code>
	boolean exists = (new File("C:/downloads/mydir")).exists();
	if (!exists)
		new File("C:/downloads/mydir").mkdirs();
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.android-programmer.co.uk/java/file-io/working-with-directories/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strings General</title>
		<link>http://www.android-programmer.co.uk/java/strings-java/strings-general-2</link>
		<comments>http://www.android-programmer.co.uk/java/strings-java/strings-general-2#comments</comments>
		<pubDate>Tue, 14 Jun 2011 14:38:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Strings]]></category>

		<guid isPermaLink="false">http://www.electronic-technology-consultant.com/?p=44</guid>
		<description><![CDATA[Creating Strings String MyString = ""; Compare Strings if (MyString.equalsIgnoreCase("abcd")) Remove Trailing Characters int index = exePath.lastIndexOf("/"); if (index &#62; 0) exePath = exePath.substring(0, index);]]></description>
			<content:encoded><![CDATA[<h4>Creating Strings</h4>
<pre><code>
	String MyString = "";
</code></pre>
<h4>Compare Strings</h4>
<pre><code>
	if (MyString.equalsIgnoreCase("abcd"))
</code></pre>
<p><span id="more-44"></span></p>
<h4>Remove Trailing Characters</h4>
<pre><code>
	int index = exePath.lastIndexOf("/");
	if (index &gt; 0)
		exePath = exePath.substring(0, index);
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.android-programmer.co.uk/java/strings-java/strings-general-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

