<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Java Programming Forums - The Java Community - Blogs - ChristopherLowe</title>
		<link>http://www.javaprogrammingforums.com/blogs/christopherlowe/</link>
		<description>The Java Programming Forums are a community of Java programmers from all around the World. Join us now to solve all your Java problems!</description>
		<language>en</language>
		<lastBuildDate>Sat, 25 May 2013 18:30:45 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.javaprogrammingforums.com/images/misc/rss.jpg</url>
			<title>Java Programming Forums - The Java Community - Blogs - ChristopherLowe</title>
			<link>http://www.javaprogrammingforums.com/blogs/christopherlowe/</link>
		</image>
		<item>
			<title>A few Android tips</title>
			<link>http://www.javaprogrammingforums.com/blogs/christopherlowe/32-few-android-tips.html</link>
			<pubDate>Wed, 18 Jan 2012 11:09:33 GMT</pubDate>
			<description>Well I have been working with Android for a few weeks now and I am absolutely loving it.  Here are a few little tips I have discovered along the way...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Well I have been working with Android for a few weeks now and I am absolutely loving it.  Here are a few little tips I have discovered along the way to make life easier.<br />
<br />
<ul><li style=""> Do not fight with Android.  Everybody knows that robots are bigger and stronger than flesh and blood. If you find yourself fighting against the system you are doing something wrong.</li><li style=""> Do not hard code strings - use the strings.xml resource and come up with a naming convention that works for you. There is no namespace with the strings resource so be verbose and consistent with your ID's.</li><li style=""> As a java developer you are spoiled with a very informative stack trace. The error messages for XML are not so great. Keep the XML files very tight and correct at all times. If you don't, it will claim there is a problem with the Java source and you can spend a long time tracking down problems in the wrong place.</li><li style=""> You do not use dashes '-' or spaces ' ' or capital letters in your resource names. The reason? Android automatically collates resources into a single .dex file and you access it via a pointer in the autogenerated <b>R</b> class. If you tried to name something <br />
<i><b>I</b>con.png</i> instead of <i>icon.png</i> it could mistake this for the object Icon.</li><li style=""> Log everything.  Personally, I prefer to use break points to aid in debugging but in Android dev logging is absolutely essential.</li><li style=""> Do not use AbsoluteLayout. You are programming for thousands of different devices with different sizes so AbsoluteLayout makes absolutely no sense.</li><li style=""> Do not use the UI builder in eclipse or tools like DroidBuilder. They are OK for quick and nasty mockups but start to fail once you get past HelloWorld.</li><li style=""> Do not bother with the AppBuilder. It doesn't really do anything useful and you cannot upload them to the market.</li><li style=""> Never, ever, ever import Android.R.  It takes precedence over your own R file and is responsible for the three most frustrating hours of my life.</li><li style=""> Avoid the little red 'X' at the top right of the emulator.</li><li style=""> Garbage collection is expensive. Try to reuse objects rather than recreating them.</li><li style=""> Get familiar with the <a href="http://developer.android.com/reference/android/app/Activity.html" target="_blank">Activity</a> workflow diagram and make use of onPause() and onResume() to handle the state transitions.</li><li style=""> Use the 'filter by API level' in the <a href="http://developer.android.com/reference/packages.html" target="_blank">API reference</a>.</li><li style=""> Get the Android source for your reference.</li><li style=""> Go through the samples provided in the SDK. They will answer most of your questions.</li><li style=""> Become familiar with the tools provided in the SDK.</li><li style=""> Use eclipse. It's supported by the people who created Android and the other IDE's are chasing it's tail.</li><li style=""> Don't rely on eclipse. Know how to use the command line to perform the basic operations.</li><li style=""> Save constantly and make sure 'Auto compile' is on. Eclipse updates it's intelli-sense with the contents of your resource files but only after the changes are saved.</li><li style=""> Every feature your app uses need to be included in the manifest. The market automatically filters out apps that cannot run on your phone.</li><li style=""> Android does a lot of magic behind the scenes. Just run with it.</li><li style=""> You will come across situations where there is both a Java and an Android class that seem to do the same thing. Always go for the Android class - it is optimized for mobile development.</li><li style=""> Surprisingly, the biggest concern with mobile development is not efficiency but battery consumption. Unfortunately, there is no good way of gauging how much battery your app consumes. As a general guide, anything that does something uses battery. The more you do, the more you drain. For example, a background service that constantly polls the GPS will make you a lot of enemies.</li><li style=""> You only have 5 seconds between a user action and a result before you get an ANR (force close). If you have even the vaguest suspicion results could take longer, put it in it's own thread. Don't just block the parent thread; implement a Handler.</li><li style=""> Follow the <a href="http://developer.android.com/guide/practices/ui_guidelines/index.html" target="_blank">UI guidelines</a>. Trying to break the users expectations about how their phone should behave will be met with poor reception.</li><li style=""> It seems there is a group of individuals who steal your apps and re-publish them for their own profit. There is nothing you can do about this and the market is simply too large to expect Google to moderate this activity.</li></ul><br />
<br />
Some must watch videos:<br />
<ul><li style=""><a href="http://www.google.com/events/io/2011/sessions.html" target="_blank">Google IO conference 2011 videos</a></li><li style=""><a href="http://www.youtube.com/watch?v=XFRS5j3BOkw&amp;feature=relmfu" target="_blank">AnDevCon: Android for Java Developers - Marko Gargenta, Pt. 1</a></li></ul><br />
<br />
The only link you will ever need:<br />
<ul><li style=""><a href="http://developer.android.com/index.html" target="_blank">Android Developers</a></li></ul><br />
<br />
Some other peoples tips and tricks:<br />
<ul><li style=""><a href="http://stackoverflow.com/questions/2961049/effective-android-programming-techniques" target="_blank">StackOverflow -&gt; Effective android programming techniques.</a></li><li style=""><a href="http://stackoverflow.com/questions/2992754/ui-design-tips-and-tutorials-for-android" target="_blank">StackOverflow -&gt; UI Design tips for android</a></li></ul></blockquote>

]]></content:encoded>
			<dc:creator>ChristopherLowe</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/blogs/christopherlowe/32-few-android-tips.html</guid>
		</item>
		<item>
			<title>Playing sound in andoird</title>
			<link>http://www.javaprogrammingforums.com/blogs/christopherlowe/28-playing-sound-andoird.html</link>
			<pubDate>Sat, 07 Jan 2012 06:04:52 GMT</pubDate>
			<description>Adding sound and music to your app is extremely easy. Place your sound file in a new directory *res/raw*.   
 
 
import android.media.MediaPlayer; 
...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Adding sound and music to your app is extremely easy. Place your sound file in a new directory <b>res/raw</b>.  <br />
<br />
<div class="bbcode_container">
                
<div class="bbcode_description" style="height:24px; background-image: url('http://www.javaprogrammingforums.com/images/javacode2.png'); background-repeat: no-repeat; margin-bottom:0px"></div>

<div class="bbcode_code" style="height:36px;"><div class="java" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #7F0055; font-weight: bold;">import</span> <span style="color: #006699;">android.media.MediaPlayer</span><span style="color: #000000;">;</span></pre></div></div>

</div> <br />
and then where you want the music to play:<br />
<br />
<div class="bbcode_container">
                
<div class="bbcode_description" style="height:24px; background-image: url('http://www.javaprogrammingforums.com/images/javacode2.png'); background-repeat: no-repeat; margin-bottom:0px"></div>

<div class="bbcode_code" style="height:48px;"><div class="java" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">MediaPlayer myMusic <span style="color: #000000;">=</span> MediaPlayer.<span style="color: #000000;">create</span><span style="color: #000000;">&#40;</span><span style="color: #7F0055; font-weight: bold;">this</span>, R.<span style="color: #000000;">raw</span>.<span style="color: #000000;">splashsound</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
myMusic.<span style="color: #000000;">start</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span></pre></div></div>

</div> <br />
where <b>splashsound</b> is the sound file's name without the extension.<br />
<br />
That's it!</blockquote>

]]></content:encoded>
			<dc:creator>ChristopherLowe</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/blogs/christopherlowe/28-playing-sound-andoird.html</guid>
		</item>
		<item>
			<title>Programmatically adding buttons in Android</title>
			<link>http://www.javaprogrammingforums.com/blogs/christopherlowe/27-programmatically-adding-buttons-android.html</link>
			<pubDate>Sat, 07 Jan 2012 05:59:04 GMT</pubDate>
			<description>Well I have had a frustrating few hours working out how to add buttons dynamically.  Here is how I did it. Firstly, you need to give the layout an ID...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Well I have had a frustrating few hours working out how to add buttons dynamically.  Here is how I did it. Firstly, you need to give the layout an ID in the xml file.<br />
<br />
<div class="bbcode_container">
                
<div class="bbcode_description" style="height:24px; background-image: url('http://www.javaprogrammingforums.com/images/javacode2.png'); background-repeat: no-repeat; margin-bottom:0px"></div>

<div class="bbcode_code" style="height:96px;"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:id=&quot;@+id/buttonlayout&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_height=&quot;match_parent&quot;
    android:orientation=&quot;vertical&quot; &gt;   
&lt;/LinearLayout&gt;</pre></div></div>

</div> <br />
Note the id: <b>buttonlayout</b>.  Now you need to access the layout in onCreate and create some layout parameters.<br />
<br />
<div class="bbcode_container">
                
<div class="bbcode_description" style="height:24px; background-image: url('http://www.javaprogrammingforums.com/images/javacode2.png'); background-repeat: no-repeat; margin-bottom:0px"></div>

<div class="bbcode_code" style="height:180px;"><div class="java" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">@Override
<span style="color: #7F0055; font-weight: bold;">protected</span> <span style="color: #7F0055; font-weight: bold;">void</span> onCreate<span style="color: #000000;">&#40;</span>Bundle savedInstanceState<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #7F0055; font-weight: bold;">super</span>.<span style="color: #000000;">onCreate</span><span style="color: #000000;">&#40;</span>savedInstanceState<span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
    setContentView<span style="color: #000000;">&#40;</span>R.<span style="color: #000000;">layout</span>.<span style="color: #000000;">main</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
&nbsp;
    <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abutton+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Button</span></a> myButton <span style="color: #000000;">=</span> <span style="color: #7F0055; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abutton+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Button</span></a><span style="color: #000000;">&#40;</span><span style="color: #7F0055; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
    myButton.<span style="color: #000000;">setText</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">&quot;Push Me&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
&nbsp;
    LinearLayout ll <span style="color: #000000;">=</span> <span style="color: #000000;">&#40;</span>LinearLayout<span style="color: #000000;">&#41;</span>findViewById<span style="color: #000000;">&#40;</span>R.<span style="color: #000000;">id</span>.<span style="color: #000000;">buttonlayout</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
    LayoutParams lp <span style="color: #000000;">=</span> <span style="color: #7F0055; font-weight: bold;">new</span> LayoutParams<span style="color: #000000;">&#40;</span>LayoutParams.<span style="color: #000000;">MATCH_PARENT</span>, LayoutParams.<span style="color: #000000;">WRAP_CONTENT</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
    ll.<span style="color: #000000;">addView</span><span style="color: #000000;">&#40;</span>myButton, lp<span style="color: #000000;">&#41;</span><span style="color: #000000;">;</span>
&nbsp;
<span style="color: #000000;">&#125;</span></pre></div></div>

</div> <br />
<br />
The reason I was having such a crappy time with this is because I foolishly placed <b>setContentView(R.layout.main)</b> at the bottom. You are not able to access the ID of a view with <b>findViewById(R.id.buttonlayout)</b> until you have set the content view.  I was getting a null pointer exception which causes a Force close.</blockquote>

]]></content:encoded>
			<dc:creator>ChristopherLowe</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/blogs/christopherlowe/27-programmatically-adding-buttons-android.html</guid>
		</item>
		<item>
			<title>Setting up a workstation for Android development (without an IDE)</title>
			<link>http://www.javaprogrammingforums.com/blogs/christopherlowe/26-setting-up-workstation-android-development-without-ide.html</link>
			<pubDate>Thu, 05 Jan 2012 06:39:42 GMT</pubDate>
			<description>*Introductions* 
Hi!  My name is Chris and I love to program.  This is the first of what I hope will be many blog entries on Android development.  At...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore"><b>Introductions</b><br />
Hi!  My name is Chris and I love to program.  This is the first of what I hope will be many blog entries on Android development.  At times, the content may appear scattered like I have A.D.D. or something.  That is because I will be adding things as I work; links, snippets, etc  (who am I kidding, I just smoke too much pot). This is not a tutorial, I will not hold your hand and lead you towards enlightenment. Think of this more like breadcrumbs I leave along the path to becoming a brilliant Android developer (*suddenly the floor cracks open and yet another over confident programmer gets sucked into the void*).<br />
<br />
<br />
<b>Let's get started</b><br />
Firstly, we need to download a few things and get our workstations speaking the same language.  At the time of writing (January 2012) the latest JDK is 7_u2 and the Andoird SDK is r16. I am using Windows XP 32 bit.<br />
<br />
<ul><li style=""><a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u2-download-1377129.html" target="_blank">Java Software Development Kit</a></li><li style=""><a href="http://developer.android.com/sdk/index.html" target="_blank">Android Software Development Kit</a></li></ul><br />
<br />
<br />
In addition to this, we will also need a Webserver (I am familiar with Apache, but it doesn't matter what you use). It is also a good idea to get the latest version of ANT and some kind of version control software (I like GIT, but again it doesn't really matter). The windows installer for GIT comes with MingW, but I also installed CygWin. Also, because I am brave I use VIM for my text editor.<br />
<br />
<ul><li style=""><a href="http://www.apache.org/dyn/closer.cgi" target="_blank">Apache web server</a></li><li style=""><a href="http://git-scm.com/" target="_blank">GIT</a></li><li style=""><a href="http://ant.apache.org/bindownload.cgi" target="_blank">ANT</a></li><li style=""><a href="http://cygwin.com/install.html" target="_blank">CygWin</a></li><li style=""><a href="http://www.vim.org/download.php" target="_blank">Vim</a></li></ul><br />
<br />
As you are installing the SDK's, bear in mind that at some point you are going to have to pay attention to your systems PATH.  Past experience has taught me that using the default install locations ie <i>C:\Program Files\jdk1.7.0_02</i> is a *really* bad idea. The reason is that the windows command prompt sucks. It hasn't changed much in the last <b>20 YEARS!!</b>.  Back in the old DOS days you couldn't use spaces in filenames or directories. At some point they realized people did not like this and added the functionality for spaces in filenames but they only bodged up the command prompt with a quick fix (since by now we had Windows 3.1 and they figured nobody would use it any more) so it is pretty hard to work with.  If you followed my advice on GIT you will now have a MingW console  (which is much better) and Cygwin is even better. But you still need to play nicely with the ancient command prompt.  For this reason; here is where I install my SDK's:<br />
<br />
<ul><li style=""><i>E:\jdk1.7.0_02</i></li><li style=""><i>E:\android-sdk</i></li><li style="">Yours may be different, just avoid spaces and make note of where things live</li></ul><br />
<br />
Grab yourself a cup of coffee and then take a gander at the readme files. Browse around the directories to get a feel for things. <br />
<br />
Now later on we need to set up a few environmental variables to make life easier. For now, just make a note of where the home directories are.<br />
<br />
<ul><li style="">JAVA_HOME   E:\jdk1.7.0_02</li><li style="">ANT_HOME  E:\apache-ant-1.8.2</li><li style="">ANDROID_HOME  E:\android-sdk</li><li style="">GIT_HOME  E:\Git</li><li style="">VIM_HOME  E:\Vim\Vim73</li><li style="">CYGWIN_HOME  E:\cygwin</li><li style="">HT_DOCS  E:\Apache\Apache2\htdocs</li></ul><br />
(<a href="http://localhost" target="_blank">http://localhost</a> points to the contents of this htcos  folder when apache is running.  So does my phone through wifi by using my workstations ip address <a href="http://192.168.0.4" target="_blank">http://192.168.0.4</a>  - cool huh)<br />
<br />
Actually, now I have gone and done it; mentioned the phone. I have a HTC Desire running Android 2.2.  You don't technically <i>need</i> a phone for android development but in a lot of ways you will be running around in the dark without one. At the least, you will be running around in slow motion because as you will see, the emulator can be very slow. While the phones can be expensive, but I consider them to be an invenstment in my hobby as a programmer because they are a powerful and flexible computer in their own right....  Dammit am I rambling again?<br />
<br />
Crank up the Android SDK manager and take a look at <a href="http://developer.android.com/resources/dashboard/platform-versions.html" target="_blank">this pie chart</a> illustrating which versions people are using.  It's a balancing act here between giving your program the latest features while targeting the most number of people who can actually use your program. I am targeting 2.2. So go ahead and download all the items under 2.2 plus the core ones. At the time of writing this cuts a 1/8th wedge of users out of the pie ... hmmm pie.<br />
<br />
Would you shut about pie already and run this in the command prompt.<br />
<div class="bbcode_container">
                
<div class="bbcode_description" style="height:24px; background-image: url('http://www.javaprogrammingforums.com/images/javacode2.png'); background-repeat: no-repeat; margin-bottom:0px"></div>

<div class="bbcode_code" style="height:48px;"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">echo %PATH%
blah blahs ablhalhs blah blahs blahs</pre></div></div>

</div> <br />
It will return a heap of crap directories. That's what all the blah blahs are.  It's probably rubbish right now because we haven't fixed it. Before we do, it's worth making a copy incase we mess it up.... Yep that's right, ctrl-c won't work. You gotta right click the prompt, click mark, drag a square over the output, then press ENTER for some reason and finally, manually delete all the newlines in a text editor (*finishes bashing head against keyboard for a while*).  I did mention that command prompt sucks didn't I. <br />
<br />
<b>Setting it up</b><br />
At this point I was less than enthusiatic about arguing with the command prompt about how I wanted to set up the environment but luckily for me, cygwin finished installing.<br />
<br />
Go to your home directory in cygwin: <i>E:\cygwin\home\Chris</i> and open up the file <i>.bashrc</i>.  This is the configuration file that gets run every time cygwin runs. You set up your environmental variables like so:<br />
<div class="bbcode_container">
                
<div class="bbcode_description" style="height:24px; background-image: url('http://www.javaprogrammingforums.com/images/javacode2.png'); background-repeat: no-repeat; margin-bottom:0px"></div>

<div class="bbcode_code" style="height:276px;"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;
export VIM_HOME=&quot;/cygdrive/e/vim/vim73&quot;
export JAVA_HOME=&quot;/cygdrive/e/jdk1.7.0_02&quot;
export ANDROID_HOME=&quot;/cygdrive/e/android-sdk&quot;
export GIT_HOME=&quot;/cygdrive/e/Git&quot;
export ANT_HOME=&quot;/cygdrive/e/apache-ant-1.8.2&quot;
export HT_DOCS=&quot;/cygdrive/e/Apache/Apache2/htdocs&quot;
&nbsp;
export PATH=&quot;/usr/local/bin&quot;
export PATH=&quot;/usr/bin:$PATH&quot;
export PATH=&quot;$VIM_HOME:$PATH&quot;
export PATH=&quot;$JAVA_HOME/bin:$PATH&quot;
export PATH=&quot;$JAVA_HOME/jre/bin:$PATH&quot;
export PATH=&quot;$ANDROID_HOME/tools:$PATH&quot;
export PATH=&quot;$ANDROID_HOME/platform-tools:$PATH&quot;
export PATH=&quot;$ANT_HOME/bin:$PATH&quot;
export PATH=&quot;${HOME}/bin:${PATH}&quot;
export PATH=&quot;$PATH:.&quot;
&nbsp;
export CLASSPATH=&quot;$JAVA_HOME/lib&quot;
export CLASSPATH=&quot;.:$CLASSPATH&quot;</pre></div></div>

</div> <br />
Check that everything is accessable:<br />
<div class="bbcode_container">
                
<div class="bbcode_description" style="height:24px; background-image: url('http://www.javaprogrammingforums.com/images/javacode2.png'); background-repeat: no-repeat; margin-bottom:0px"></div>

<div class="bbcode_code" style="height:228px;"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Chris@chris ~
$ javac -version
javac 1.7.0_02
&nbsp;
Chris@chris ~
$ java -version
java version &quot;1.7.0_02&quot;
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) Client VM (build 22.0-b10, mixed mode, sharing)
&nbsp;
Chris@chris ~
$ ant -version
Apache Ant(TM) version 1.8.2 compiled on December 20 2010
&nbsp;
Chris@chris ~
$ git --version
git version 1.7.5.1</pre></div></div>

</div> <br />
Now for the fun stuff:<br />
<div class="bbcode_container">
                
<div class="bbcode_description" style="height:24px; background-image: url('http://www.javaprogrammingforums.com/images/javacode2.png'); background-repeat: no-repeat; margin-bottom:0px"></div>

<div class="bbcode_code" style="height:168px;"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Chris@chris ~
$ android.bat list targets
Available Android targets:
----------
id: 1 or &quot;android-8&quot;
     Name: Android 2.2
     Type: Platform
     API level: 8
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WVGA800 (default), WVGA854
     ABIs : armeabi
----------</pre></div></div>

</div> <br />
Time to create a new project called <b>MyFirstAndroidApp</b> using 'android-8' as the target.<br />
<div class="bbcode_container">
                
<div class="bbcode_description" style="height:24px; background-image: url('http://www.javaprogrammingforums.com/images/javacode2.png'); background-repeat: no-repeat; margin-bottom:0px"></div>

<div class="bbcode_code" style="height:120px;"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Chris@chris ~
$ mkdir MyFirstAndroidApp
&nbsp;
Chris@chris ~
$ cd MyFirstAndroidApp/
&nbsp;
Chris@chris ~/MyFirstAndroidApp
$ android.bat create project --target &quot;android-8&quot; --name MyFirstAndroidApp --path ./MyFirstAndroidApp --activity MyFirstAndroidApp --package com.lowware.myfirstandroidapp</pre></div></div>

</div> <br />
That last code creates the project structure and a heap of files.  Now build the project like so:<br />
<div class="bbcode_container">
                
<div class="bbcode_description" style="height:24px; background-image: url('http://www.javaprogrammingforums.com/images/javacode2.png'); background-repeat: no-repeat; margin-bottom:0px"></div>

<div class="bbcode_code" style="height:48px;"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Chris@chris ~/MyFirstAndroidApp/MyFirstAndroidApp
$ ant debug</pre></div></div>

</div>  <br />
Now we need to create a virtual android device for our emulator. Open up the Android virtual device manager and create a new device.  I like to be really specific with the name of the device since later on I may need to test my apps of a variety of configurations (a good programmer looks after their users).  I called my device <i>android22_hvga_480x800_32mb</i>.<br />
<br />
Now lets crank up the emulator:<br />
<div class="bbcode_container">
                
<div class="bbcode_description" style="height:24px; background-image: url('http://www.javaprogrammingforums.com/images/javacode2.png'); background-repeat: no-repeat; margin-bottom:0px"></div>

<div class="bbcode_code" style="height:72px;"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Chris@chris ~/MyFirstAndroidApp/MyFirstAndroidApp
$ emulator.exe -cpu-delay 0 -no-boot-anim -avd android22_hvga_480x800_32mb -sca
le 150dpi &amp;
&#91;1&#93; 4684</pre></div></div>

</div> <br />
The apersand at the end makes it run in the background. Just remember not to close the prompt or it will be killed. All those extra flags reduce the loading time but the emulator can be very slow at times. Give it a few mintues if it doesn't seem to be doing much.<br />
<br />
Now, with the emulator running you can install your <i>MyFirstAndroidApp</i> to the emulator. <br />
<br />
<div class="bbcode_container">
                
<div class="bbcode_description" style="height:24px; background-image: url('http://www.javaprogrammingforums.com/images/javacode2.png'); background-repeat: no-repeat; margin-bottom:0px"></div>

<div class="bbcode_code" style="height:36px;"><div class="" style="font-family:monospace;"><pre style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">ant debug install</pre></div></div>

</div> <br />
Click the middle button at the bottom of the emulator and run the program.  Those brilliant googlers even put the 'Hello World' part in for you!  Open up the bin directory of the project and find the .apk file.  Copy this file to your htdocs, browse to your workstations ip address with the phone and open the file. It will install the apk and you can now access your MyFirstAndoirdApp as you do any other app.<br />
<br />
Pretty cool huh!</blockquote>

]]></content:encoded>
			<dc:creator>ChristopherLowe</dc:creator>
			<guid isPermaLink="true">http://www.javaprogrammingforums.com/blogs/christopherlowe/26-setting-up-workstation-android-development-without-ide.html</guid>
		</item>
	</channel>
</rss>
