<?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>Eclipse &#8211; Wiebe Elsinga</title>
	<atom:link href="http://wiebe-elsinga.com/blog/tag/eclipse/feed/" rel="self" type="application/rss+xml" />
	<link>http://wiebe-elsinga.com/blog</link>
	<description>Blog</description>
	<lastBuildDate>Fri, 21 Oct 2011 04:20:40 +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>Developing for Samsung Galaxy Tab</title>
		<link>http://wiebe-elsinga.com/blog/developing-for-samsung-galaxy-tab/</link>
					<comments>http://wiebe-elsinga.com/blog/developing-for-samsung-galaxy-tab/#comments</comments>
		
		<dc:creator><![CDATA[W.Elsinga]]></dc:creator>
		<pubDate>Thu, 21 Oct 2010 23:03:04 +0000</pubDate>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Galaxy Tab]]></category>
		<guid isPermaLink="false">http://wiebe-elsinga.com/blog/?p=431</guid>

					<description><![CDATA[So you are developing Android applications and you want to run your android application on a Samsung Galaxy Tab. Just create an AVD. Run AVD Manager and select Available Packages in the left panel Click Add ADD-on Site and enter the URL http://innovator.samsungmobile.com/android/repository/srepository.xml Detailed guide and development tips is here.]]></description>
										<content:encoded><![CDATA[<p>So you are developing Android applications and you want to run your android application on a Samsung Galaxy Tab. Just create an AVD.</p>
<ul>
<li>Run AVD Manager and select Available Packages in the left panel</li>
<li>Click <strong>Add ADD-on Site</strong> and enter the URL <a href="http://innovator.samsungmobile.com/android/repository/srepository.xml">http://innovator.samsungmobile.com/android/repository/srepository.xml</a></li>
</ul>
<p>Detailed guide and development tips is <a href="http://innovator.samsungmobile.com/galaxyTab.do">here</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://wiebe-elsinga.com/blog/developing-for-samsung-galaxy-tab/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>How-To: Automatic testing for Android Applications</title>
		<link>http://wiebe-elsinga.com/blog/automatic-testing-for-android-applications/</link>
					<comments>http://wiebe-elsinga.com/blog/automatic-testing-for-android-applications/#comments</comments>
		
		<dc:creator><![CDATA[W.Elsinga]]></dc:creator>
		<pubDate>Tue, 03 Aug 2010 03:30:50 +0000</pubDate>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Robotium]]></category>
		<category><![CDATA[Selenium]]></category>
		<guid isPermaLink="false">http://wiebe-elsinga.com/blog/?p=300</guid>

					<description><![CDATA[After setting up your Android development environment, and Developing an Android Application it’s time to set-up a automatic Android Test environment. The steps to achieve this are: Choose a test technique. Creating a test project. Make the test. Run the test. I will use the Android application which was developed inside my previous post. [Update 15-03-2011] Updated to Android 2.3.3. [Update 15-03-2011] Updated to Robotium 2.2. Choose a test technique There are different techniques you can use to test Android applications. The most commonly known is by way of JUnit. JUnit is used to test the technical quality of applications. But what about the testing the functional use of a application, like you would do it with Selenium for web application. For Android applications there is a similar tool for testing called Robotium. It is a UI testing tool which simulates touching, clicks, typing, and other users&#8217; actions relevant for Android applications. In this example I will be using Robotium. Creating a test project From within Eclipse select File menu, New and Other. Choose Android Test Project inside the Android folder. Provide the information about the Android Test project and click Next. Press Finish. You should see the following directory structure Because I will be creating a Robotium test, I must provide the robotium-solo-2.2.jar as library. Make the test From within Eclipse select File menu, New and JUnit Test Case. Provide the information about the Junit Test Case and click Finish. Change MainTest.java to the following package com.my; import java.util.ArrayList; import com.jayway.android.robotium.solo.Solo; import android.app.Activity; import android.test.ActivityInstrumentationTestCase2; import android.widget.TextView; public class MainTest extends ActivityInstrumentationTestCase2 &#123; private Solo solo; private Activity activity; public MainTest&#40;&#41; &#123; super&#40;&#34;com.my&#34;, Main.class&#41;; &#125; @Override protected void setUp&#40;&#41; throws Exception &#123; super.setUp&#40;&#41;; this.activity = this.getActivity&#40;&#41;; this.solo = new Solo&#40;getInstrumentation&#40;&#41;, this.activity&#41;; &#125; @Override public void tearDown&#40;&#41; throws Exception &#123; try &#123; this.solo.finalize&#40;&#41;; &#125; catch &#40;Throwable e&#41; &#123; e.printStackTrace&#40;&#41;; &#125; this.activity.finish&#40;&#41;; super.tearDown&#40;&#41;; &#125; /** * @throws Exception Exception */ public void testDisplay&#40;&#41; throws Exception &#123; String text = &#34;Congratulations&#34;; //Enter &#34;Congratulations&#34; inside the EditText field. this.solo.enterText&#40;&#40;EditText&#41; this.activity.findViewById&#40;R.id.EditText01&#41;, text&#41;; //Click on the button named &#34;Click&#34;. this.solo.clickOnButton&#40;&#34;Click&#34;&#41;; //Check to see if the given text is displayed. assertTrue&#40;this.solo.searchText&#40;text&#41;&#41;; TextView outputField = &#40;TextView&#41; this.activity.findViewById&#40;R.id.TextView01&#41;; ArrayList currentTextViews = this.solo.getCurrentTextViews&#40;outputField&#41;; assertFalse&#40;currentTextViews.isEmpty&#40;&#41;&#41;; TextView output = currentTextViews.get&#40;0&#41;; assertEquals&#40;text, output.getText&#40;&#41;.toString&#40;&#41;&#41;; &#125; &#125; Run the test Al that is left is running the test. Right click MyAndroidAppTestProject. Select Android Junit Test within the Run-As option. Be patient, the emulator starts up very slow. You should get the following result Appendix Download source code Android.zip [16kB] and AndroidTest.zip [16kB]]]></description>
										<content:encoded><![CDATA[<p>After setting up your <a href="http://wiebe-elsinga.com/blog/?p=259">Android development environment</a>, and <a href="http://wiebe-elsinga.com/blog/?p=275">Developing an Android Application</a> it’s time to set-up a automatic Android Test environment. The steps to achieve this are:</p>
<ul>
<li>Choose a test technique.</li>
<li>Creating a test project.</li>
<li>Make the test.</li>
<li>Run the test.</li>
</ul>
<p>I will use the Android application which was developed inside my <a href="http://wiebe-elsinga.com/blog/?p=275">previous post</a>.</p>
<p><strong>[Update 15-03-2011]</strong> Updated to Android 2.3.3.<br />
<strong>[Update 15-03-2011]</strong> Updated to Robotium 2.2.<br />
<span id="more-300"></span></p>
<h2>Choose a test technique</h2>
<p>There are different techniques you can use to test Android applications. The most commonly known is by way of JUnit. JUnit is used to test the technical quality of applications. But what about the testing the functional use of  a application, like you would do it with Selenium for web application. For Android applications there is a similar tool for testing called <a href="http://code.google.com/p/robotium/">Robotium</a>. It is a UI testing tool which simulates touching, clicks, typing, and other users&#8217; actions relevant for Android applications. In this example I will be using <a href="http://code.google.com/p/robotium/">Robotium</a>.</p>
<h2>Creating a test project<a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2011/03/testProject.gif" rel="lightbox[300]" title="testProject"><img loading="lazy" class="alignright size-thumbnail wp-image-301" title="testProject" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2011/03/testProject-150x150.gif" alt="" width="150" height="150" /></a></h2>
<ol>
<li>From within Eclipse select <strong>File</strong> menu, <strong>New</strong> and <strong>Other</strong>.</li>
<li>Choose <strong>Android Test Project</strong> inside the <strong>Android</strong> folder.</li>
<li>Provide the information about the Android Test project and click <strong>Next</strong>.</li>
<li>Press <strong>Finish</strong>. You should see the following directory structure</li>
</ol>
<p><a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2011/03/testFiles.gif" rel="lightbox[300]" title="testFiles"><img loading="lazy" class="alignnone size-thumbnail wp-image-302" title="testFiles" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2011/03/testFiles-150x150.gif" alt="" width="150" height="150" /></a></p>
<p>Because I will be creating a Robotium test, I must provide the <a href="http://code.google.com/p/robotium/downloads/detail?name=robotium-solo-2.2.jar&amp;can=2&amp;q=">robotium-solo-2.2.jar</a> as library.</p>
<h2>Make the test<a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/08/TestCase.gif" rel="lightbox[300]" title="TestCase"><img loading="lazy" class="alignright size-thumbnail wp-image-304" title="TestCase" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/08/TestCase-150x150.gif" alt="" width="150" height="150" /></a></h2>
<ol>
<li>From within Eclipse select <strong>File</strong> menu, <strong>New</strong> and <strong>JUnit Test Case</strong>.</li>
<li>Provide the information about the Junit Test Case and click <strong>Finish</strong>.</li>
<li>Change <em>MainTest.java</em> to the following</li>
</ol>
<p></p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:100%;"><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;">package</span> <span style="color: #006699;">com.my</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ArrayList</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.jayway.android.robotium.solo.Solo</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.Activity</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.test.ActivityInstrumentationTestCase2</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.TextView</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MainTest <span style="color: #000000; font-weight: bold;">extends</span> ActivityInstrumentationTestCase2 <span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">private</span> Solo solo<span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">private</span> Activity activity<span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> MainTest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;com.my&quot;</span>, Main.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
@Override<br />
<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> setUp<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+exception"><span style="color: #003399;">Exception</span></a> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">setUp</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">activity</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">getActivity</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">solo</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Solo<span style="color: #009900;">&#40;</span>getInstrumentation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">activity</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
@Override<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> tearDown<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+exception"><span style="color: #003399;">Exception</span></a> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">solo</span>.<span style="color: #006633;">finalize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+throwable"><span style="color: #003399;">Throwable</span></a> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">activity</span>.<span style="color: #006633;">finish</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">tearDown</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #008000; font-style: italic; font-weight: bold;">/**<br />
* @throws Exception Exception<br />
*/</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testDisplay<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+exception"><span style="color: #003399;">Exception</span></a> <span style="color: #009900;">&#123;</span><br />
<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+string"><span style="color: #003399;">String</span></a> text <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Congratulations&quot;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//Enter &quot;Congratulations&quot; inside the EditText field.</span><br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">solo</span>.<span style="color: #006633;">enterText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>EditText<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">activity</span>.<span style="color: #006633;">findViewById</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">EditText01</span><span style="color: #009900;">&#41;</span>, text<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//Click on the button named &quot;Click&quot;.</span><br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">solo</span>.<span style="color: #006633;">clickOnButton</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Click&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//Check to see if the given text is displayed.</span><br />
assertTrue<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">solo</span>.<span style="color: #006633;">searchText</span><span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
TextView outputField <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TextView<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">activity</span>.<span style="color: #006633;">findViewById</span><span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">TextView01</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+arraylist"><span style="color: #003399;">ArrayList</span></a> currentTextViews <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">solo</span>.<span style="color: #006633;">getCurrentTextViews</span><span style="color: #009900;">&#40;</span>outputField<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
assertFalse<span style="color: #009900;">&#40;</span>currentTextViews.<span style="color: #006633;">isEmpty</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 />
<br />
TextView output <span style="color: #339933;">=</span> currentTextViews.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
assertEquals<span style="color: #009900;">&#40;</span>text, output.<span style="color: #006633;">getText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</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 />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></div>
<h2>Run the test</h2>
<p>Al that is left is running the test.</p>
<ol>
<li>Right click <em>MyAndroidAppTestProject</em>.</li>
<li>Select <strong>Android Junit Test</strong> within the <strong>Run-As</strong> option.</li>
<li>Be patient, the emulator starts up very slow. You should get the following result</li>
</ol>
<p><a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/08/testResult.gif" rel="lightbox[300]" title="testResult"><img loading="lazy" class="alignnone size-full wp-image-306" title="testResult" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/08/testResult.gif" alt="" width="348" height="236" srcset="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/08/testResult.gif 348w, http://wiebe-elsinga.com/blog/wp-content/uploads/2010/08/testResult-300x203.gif 300w, http://wiebe-elsinga.com/blog/wp-content/uploads/2010/08/testResult-160x110.gif 160w" sizes="(max-width: 348px) 100vw, 348px" /></a></p>
<h2>Appendix</h2>
<p>Download source code <a href='http://wiebe-elsinga.com/blog/wp-content/uploads/2011/03/Android.zip'>Android.zip</a> [16kB] and <a href='http://wiebe-elsinga.com/blog/wp-content/uploads/2011/03/AndroidTest.zip'>AndroidTest.zip</a> [16kB] </p>
]]></content:encoded>
					
					<wfw:commentRss>http://wiebe-elsinga.com/blog/automatic-testing-for-android-applications/feed/</wfw:commentRss>
			<slash:comments>36</slash:comments>
		
		
			</item>
		<item>
		<title>How-To: Developing an Android Application</title>
		<link>http://wiebe-elsinga.com/blog/developing-a-android-application/</link>
					<comments>http://wiebe-elsinga.com/blog/developing-a-android-application/#comments</comments>
		
		<dc:creator><![CDATA[W.Elsinga]]></dc:creator>
		<pubDate>Mon, 02 Aug 2010 02:13:28 +0000</pubDate>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<guid isPermaLink="false">http://wiebe-elsinga.com/blog/?p=275</guid>

					<description><![CDATA[After setting up your Android development environment, it’s time you implement your first (simple) Android application. The steps to achieve this are: Creating a project. Create your user interface. Code the application. Run the application. I will make an Android application which will provide a field where a user can type in a word and, after clicking on a button, will display that word. [Update 15-03-2011] Updated to Android 2.3.3. Creating a project Before creating a project, you have to decide what the version of your Android Platform your application will be running on. You can view the current most used Android Platform on http://developer.android.com/resources/dashboard/platform-versions.html. In this example I will be using Android 2.3.3. From within Eclipse select File menu, New and Android Project. Provide the information about the Android project and click Next. You can optional create a test project, which I will not do. Press Finish. You should see the following directory structure. So what do I see?. The project name is MyAndroidAppProject. It is displayed under the Package Explorer on the left of the window. src: This contains the .java source files for your project. In this example, there are two files: Main.java and R.java. The Main.java file is the source file for your activity. The R.java file is a compiler-generated file that references all the resources found in your project. You should not modify this file. Android Library: Contains all the class libraries needed for an Android application. res: Contains all the resources used in your application. It contains three other sub-folders: drawable, layout, and values. You will see the use of the files contained in each sub folders shortly. AndroidManifest.xml: Is the manifest file for your Android application. You will specify the permissions needed by your application as well as other features needed by your application (such as intent-filters, receivers, etc). Create your user interface The Andoid SDK allows two ways of building the user interface: via a rich editor and XML files. The XML method is preferred as it allows you to declaratively define the UI of an application without needing to write lots of code. In addition, it allows a clean separation of logic and UI. Double-click on main.xml located under the res/layout folder. Add three UI elements (EditText, Button and TextView). Select the EditText element and change the property Layout Width to fill_parent. Select the Button element and also change the property Layout Width to fill_parent. Select the TextView element and also change the property Layout Width to fill_parent. The main.xml should look as follows: &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;LinearLayout xmlns:android=&#34;http://schemas.android.com/apk/res/android&#34; android:orientation=&#34;vertical&#34; android:layout_width=&#34;fill_parent&#34; android:layout_height=&#34;fill_parent&#34; &#62; &#60;TextView android:layout_width=&#34;fill_parent&#34; android:layout_height=&#34;wrap_content&#34; android:text=&#34;@string/hello&#34; /&#62; &#60;EditText android:id=&#34;@+id/EditText01&#34; android:layout_height=&#34;wrap_content&#34; android:layout_width=&#34;fill_parent&#34; android:inputType=&#34;text&#34; /&#62; &#60;Button android:text=&#34;@+id/Button01&#34; android:id=&#34;@+id/Button01&#34; android:layout_height=&#34;wrap_content&#34; android:layout_width=&#34;fill_parent&#34; /&#62; &#60;TextView android:id=&#34;@+id/TextView01&#34; android:layout_height=&#34;wrap_content&#34; android:layout_width=&#34;fill_parent&#34; /&#62; &#60;/LinearLayout&#62; Notice that in the element, the value of the android:text attribute is @string/hello. @string refers to the strings.xml. Double-click on strings.xml located under the res/values folder. Change the file as follows: &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;resources&#62; &#60;string name=&#34;hello&#34;&#62;Welcome to My Android App&#60;/string&#62; &#60;string name=&#34;app_name&#34;&#62;MyAndroidApp&#60;/string&#62; &#60;string name=&#34;btntxt&#34;&#62;Click&#60;/string&#62; &#60;/resources&#62; Finally assign the btntxt string attribute to the button property of the main.xml. The main.xml should look as follows: &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;LinearLayout xmlns:android=&#34;http://schemas.android.com/apk/res/android&#34; android:orientation=&#34;vertical&#34; android:layout_width=&#34;fill_parent&#34; android:layout_height=&#34;fill_parent&#34; &#62; &#60;TextView android:layout_width=&#34;fill_parent&#34; android:layout_height=&#34;wrap_content&#34; android:text=&#34;@string/hello&#34; /&#62; &#60;EditText android:id=&#34;@+id/EditText01&#34; android:layout_height=&#34;wrap_content&#34; android:layout_width=&#34;fill_parent&#34; android:inputType=&#34;text&#34; /&#62; &#60;Button android:text=&#34;@string/btntxt&#34; android:id=&#34;@+id/Button01&#34; android:layout_height=&#34;wrap_content&#34; android:layout_width=&#34;fill_parent&#34; /&#62; &#60;TextView android:id=&#34;@+id/TextView01&#34; android:layout_height=&#34;wrap_content&#34; android:layout_width=&#34;fill_parent&#34; /&#62; &#60;/LinearLayout&#62; Code the application Change Main.java to the following: package com.my; import android.app.Activity; import android.os.Bundle; import android.text.Editable; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class Main extends Activity &#123; EditText input; TextView output; Button buttonClick; / ** Called when the activity is first created. */ @Override public void onCreate&#40;Bundle savedInstanceState&#41; &#123; super.onCreate&#40;savedInstanceState&#41;; setContentView&#40;R.layout.main&#41;; input = &#40;EditText&#41; findViewById&#40;R.id.EditText01&#41;; output = &#40;TextView&#41; findViewById&#40;R.id.TextView01&#41;; buttonClick = &#40;Button&#41; findViewById&#40;R.id.Button01&#41;; buttonClick.setOnClickListener&#40;new View.OnClickListener&#40;&#41; &#123; public void onClick&#40;View v&#41; &#123; display&#40;input.getText&#40;&#41;&#41;; &#125; &#125;&#41;; &#125; protected void display&#40;Editable text&#41; &#123; output.setText&#40;text&#41;; &#125; &#125; Run the application Al that is left is running the application. Right click MyAndroidAppProject. Select Android Application within the Run-As option. Be patient, the emulator starts up very slow. You should get the following result: Selecting MyAndroidApp. Enter some text and press on Click… Appendix Download source code Android.zip [16kB]]]></description>
										<content:encoded><![CDATA[<p><a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/05/android.jpg" rel="lightbox[275]" title="android"><img loading="lazy" class="alignleft size-thumbnail wp-image-170" style="padding-right: 10px;" title="android" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/05/android-150x150.jpg" alt="" width="150" height="150" srcset="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/05/android-150x150.jpg 150w, http://wiebe-elsinga.com/blog/wp-content/uploads/2010/05/android-300x300.jpg 300w, http://wiebe-elsinga.com/blog/wp-content/uploads/2010/05/android-200x200-cropped.jpg 200w, http://wiebe-elsinga.com/blog/wp-content/uploads/2010/05/android.jpg 500w" sizes="(max-width: 150px) 100vw, 150px" /></a>After setting up your <a href="http://wiebe-elsinga.com/blog/?p=259">Android development environment</a>, it’s time you implement your first (simple) Android application. The steps to achieve this are:</p>
<ul>
<li>Creating a project.</li>
<li>Create your user interface.</li>
<li>Code the application.</li>
<li>Run the application.</li>
</ul>
<p>I will make an Android application which will provide a field where a user can type in a word and, after clicking on a button, will display that word.</p>
<p><strong>[Update 15-03-2011]</strong> Updated to Android 2.3.3.</p>
<p><span id="more-275"></span></p>
<h2>Creating a project</h2>
<p>Before creating a project, you have to decide what the version of your Android Platform your application will be running on.  You can view the current most used Android Platform on <a href="http://developer.android.com/resources/dashboard/platform-versions.html">http://developer.android.com/resources/dashboard/platform-versions.html</a>. In this example I will be using Android 2.3.3.</p>
<ol>
<li>From within Eclipse select <strong>File</strong> menu, <strong>New</strong> and <strong>Android Project</strong>.<a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2011/03/NewProject.gif" rel="lightbox[275]" title="NewProject"><img loading="lazy" class="alignright size-thumbnail wp-image-279" title="NewProject" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2011/03/NewProject-150x150.gif" alt="" width="128" height="128" /></a></li>
<li>Provide the information about the Android project and click <strong>Next</strong>.</li>
<li>You can optional create a test project, which I will not do.</li>
<li>Press <strong>Finish</strong>. You should see the following directory structure.</li>
</ol>
<p><a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2011/03/Structure.gif" rel="lightbox[275]" title="Structure"><img loading="lazy" class="size-thumbnail wp-image-280" title="Structure" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2011/03/Structure-150x150.gif" alt="" width="191" height="191" /></a></p>
<p>So what do I see?. The project name is <em>MyAndroidAppProject</em>. It is displayed under the Package Explorer on the left of the window.</p>
<blockquote>
<ul>
<li><em>src</em>: This contains the .java source files for your project. In this example, there are two files: <em>Main.java</em> and <em>R.java</em>. The <em>Main.java</em> file is the source file for your activity. The <em>R.java</em> file is a compiler-generated file that references all the resources found in your project. You should not modify this file.</li>
<li><em>Android Library</em>: Contains all the class libraries needed for an Android application.</li>
<li><em>res</em>: Contains all the resources used in your application. It contains three other sub-folders: <em>drawable</em>, <em>layout</em>, and <em>values</em>. You will see the use of the files contained in each sub folders shortly.</li>
<li><em>AndroidManifest.xml</em>: Is the manifest file for your Android application. You will specify the permissions needed by your application as well as other features needed by your application (such as intent-filters, receivers, etc).</li>
</ul>
</blockquote>
<h2>Create your user interface</h2>
<p>The Andoid SDK allows two ways of building the user interface: via a rich editor and XML files. The XML method is preferred as it allows you to declaratively define the UI of an application without needing to write lots of code. In addition, it allows a clean separation of logic and UI.</p>
<ol>
<li>Double-click on <em>main.xml</em> located under the res/layout folder.</li>
<li>Add three UI elements (EditText, Button and TextView).</li>
<li>Select the EditText element and change the property <em>Layout Width</em> to <em>fill_parent</em>.</li>
<li>Select the Button element and also change the property <em>Layout Width</em> to <em>fill_parent</em>.</li>
<li>Select the TextView element and also change the property <em>Layout Width</em> to <em>fill_parent</em>.</li>
</ol>
<p>The <em>main.xml</em> should look as follows:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:100%;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;LinearLayout</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:orientation</span>=<span style="color: #ff0000;">&quot;vertical&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/hello&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;EditText</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/EditText01&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:inputType</span>=<span style="color: #ff0000;">&quot;text&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Button</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@+id/Button01&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/Button01&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;TextView</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/TextView01&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/LinearLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>Notice that in the element, the value of the android:text attribute is @string/hello. @string refers to the <em>strings.xml</em>.</p>
<ol>
<li>Double-click on <em>strings.xml</em> located under the res/values folder.</li>
<li>Change the file as follows:</li>
</ol>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span><br />
<span style="color: #000000; font-weight: bold;">&lt;resources<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<span style="color: #000000; font-weight: bold;">&lt;string</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;hello&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>Welcome to My Android App<span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<span style="color: #000000; font-weight: bold;">&lt;string</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;app_name&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>MyAndroidApp<span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<span style="color: #000000; font-weight: bold;">&lt;string</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;btntxt&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>Click<span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<span style="color: #000000; font-weight: bold;">&lt;/resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></div></div>
<p>Finally assign the btntxt string attribute to the button property of the <em>main.xml</em>. The <em>main.xml</em> should look as follows:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:100%;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span><br />
<span style="color: #000000; font-weight: bold;">&lt;LinearLayout</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span><br />
<span style="color: #000066;">android:orientation</span>=<span style="color: #ff0000;">&quot;vertical&quot;</span><br />
<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span><br />
<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span><br />
<span style="color: #000000; font-weight: bold;">&gt;</span><br />
<span style="color: #000000; font-weight: bold;">&lt;TextView</span><br />
<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span><br />
<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span><br />
<span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/hello&quot;</span><br />
<span style="color: #000000; font-weight: bold;">/&gt;</span><br />
<span style="color: #000000; font-weight: bold;">&lt;EditText</span><br />
<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/EditText01&quot;</span><br />
<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span><br />
<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span><br />
<span style="color: #000066;">android:inputType</span>=<span style="color: #ff0000;">&quot;text&quot;</span><br />
<span style="color: #000000; font-weight: bold;">/&gt;</span><br />
<span style="color: #000000; font-weight: bold;">&lt;Button</span><br />
<span style="color: #000066;">android:text</span>=<span style="color: #ff0000;">&quot;@string/btntxt&quot;</span><br />
<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/Button01&quot;</span><br />
<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span><br />
<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span><br />
<span style="color: #000000; font-weight: bold;">/&gt;</span><br />
<span style="color: #000000; font-weight: bold;">&lt;TextView</span><br />
<span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@+id/TextView01&quot;</span><br />
<span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;wrap_content&quot;</span><br />
<span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span><br />
<span style="color: #000000; font-weight: bold;">/&gt;</span><br />
<span style="color: #000000; font-weight: bold;">&lt;/LinearLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></div></div>
<h2>Code the application</h2>
<p>Change <em>Main.java </em>to the following:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:100%;"><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;">package</span> <span style="color: #006699;">com.my</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.Activity</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.text.Editable</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.Button</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.EditText</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.TextView</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #000000; font-weight: bold;">extends</span> Activity <span style="color: #009900;">&#123;</span><br />
<br />
EditText input<span style="color: #339933;">;</span><br />
TextView output<span style="color: #339933;">;</span><br />
<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+button"><span style="color: #003399;">Button</span></a> buttonClick<span style="color: #339933;">;</span><br />
<br />
<span style="color: #339933;">/</span> <span style="color: #339933;">**</span> Called when the activity is first created. <span style="color: #339933;">*/</span><br />
@Override<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onCreate<span style="color: #009900;">&#40;</span>Bundle savedInstanceState<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span>savedInstanceState<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
setContentView<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">main</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
input <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>EditText<span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">EditText01</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
output <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>TextView<span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">TextView01</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
buttonClick <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+button"><span style="color: #003399;">Button</span></a><span style="color: #009900;">&#41;</span> findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">Button01</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
buttonClick.<span style="color: #006633;">setOnClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+view"><span style="color: #003399;">View</span></a>.<span style="color: #006633;">OnClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onClick<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Adocs.oracle.com+javase+docs+api+view"><span style="color: #003399;">View</span></a> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
display<span style="color: #009900;">&#40;</span>input.<span style="color: #006633;">getText</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 />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> display<span style="color: #009900;">&#40;</span>Editable text<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
output.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<h2>Run the application</h2>
<p>Al that is left is running the application.</p>
<ol>
<li>Right click <em>MyAndroidAppProject</em>.</li>
<li>Select <strong>Android Application</strong> within the <strong>Run-As</strong> option.</li>
<li>Be patient, the emulator starts up very slow. You should get the following result:</li>
</ol>
<p><a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/07/Emulator.gif" rel="lightbox[275]" title="Emulator"><img loading="lazy" class="alignnone size-thumbnail wp-image-269" title="Emulator" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/07/Emulator-150x150.gif" alt="" width="150" height="150" /></a></p>
<p>Selecting <em>MyAndroidApp.</em></p>
<p><a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/08/select.gif" rel="lightbox[275]" title="select"><img loading="lazy" class="alignnone size-thumbnail wp-image-281" title="select" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/08/select-150x150.gif" alt="" width="150" height="150" /></a></p>
<p><em> </em>Enter some text and press on <strong>Click</strong>…</p>
<p><a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/08/myFirstApp.gif" rel="lightbox[275]" title="myFirstApp"><img loading="lazy" class="alignnone size-thumbnail wp-image-294" title="myFirstApp" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/08/myFirstApp-150x150.gif" alt="" width="150" height="150" /></a></p>
<h2>Appendix</h2>
<p>Download source code <a href='http://wiebe-elsinga.com/blog/wp-content/uploads/2011/03/Android.zip'>Android.zip</a> [16kB]</p>
]]></content:encoded>
					
					<wfw:commentRss>http://wiebe-elsinga.com/blog/developing-a-android-application/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
		<item>
		<title>How-To: Android Development Environment</title>
		<link>http://wiebe-elsinga.com/blog/android-developement-environment/</link>
					<comments>http://wiebe-elsinga.com/blog/android-developement-environment/#comments</comments>
		
		<dc:creator><![CDATA[W.Elsinga]]></dc:creator>
		<pubDate>Fri, 30 Jul 2010 04:17:07 +0000</pubDate>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Eclipse]]></category>
		<guid isPermaLink="false">http://wiebe-elsinga.com/blog/?p=259</guid>

					<description><![CDATA[Several of my colleges asked me how you must set-up a Android development environment. So because after multiple requests I will explain how. Basically it is a matter of Check if your development environment meets the requirements. Download and install the Android SDK Install the Android Development Tools (ADT) within Eclipse. Set-up a device. Check development environment Before making your environment Android development ready, please check your current environment. Go to http://developer.android.com/sdk/requirements.html and ensure that your environment is Android ready. If you need the JDK (the JRE is not sufficient), download the latest from http://java.sun.com/javase/downloads/index.jsp and install it. Install Android SDK So we are ready to install the Android SDK. Go to http://developer.android.com/index.html and click on the upper right image named Download Click the appropriate link to download the SDK for your host platform. Unzip the downloaded file to a directory (in my case c:\dev) You do not need to setup the SDK because we will use Eclipse to complete the set-up. Install Android Development Tools Now we are ready to configure Eclipse with de ADT plug-in. From within Eclipse select Install New Software from the Help menu. Click on the Add button and enter the following URL into the Location field and click OK.https://dl-ssl.google.com/android/eclipse/ Click the checkbox as shown in image, and then click Next. Complete the installation and restart Eclipse. Once Eclipse has restarted, you have one last task to perform: you need to tell Eclipse where the Android SDK is located. From within Eclipse select Preferences from the Window menu. Select Android and provide the location of the Android SDK (in my case C:\dev\android-sdk-windows) and click OK. Now select Android SDK and AVD Manager from the Window menu. Select available packages and select the latest version of the SDK. Click Installed selected and complete the installation, preferably by restarting Eclipse. Set-up a device The only thing left is to set-up a Android device. Of course you can use your own Android device, but a emulator is just as easy. Press the Device Manager button and click on New. Create the device and click Create AVD. Finally run the freshly created Device by selecting the device and click Start and Launch. (please be patient it’s not that fast) Hope this helps.]]></description>
										<content:encoded><![CDATA[<p><a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/05/android.jpg" rel="lightbox[259]" title="android"><img loading="lazy" class="alignleft size-thumbnail wp-image-170" style="padding-right: 10px;" title="android" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/05/android-150x150.jpg" alt="" width="150" height="150" srcset="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/05/android-150x150.jpg 150w, http://wiebe-elsinga.com/blog/wp-content/uploads/2010/05/android-300x300.jpg 300w, http://wiebe-elsinga.com/blog/wp-content/uploads/2010/05/android-200x200-cropped.jpg 200w, http://wiebe-elsinga.com/blog/wp-content/uploads/2010/05/android.jpg 500w" sizes="(max-width: 150px) 100vw, 150px" /></a>Several of my colleges asked me how you must set-up a Android development environment. So because after multiple requests I will explain how. Basically it is a matter of</p>
<ul>
<li>Check if your development environment meets the requirements.</li>
<li>Download and install the Android SDK</li>
<li>Install the Android Development Tools (ADT) within Eclipse.</li>
<li>Set-up a device.</li>
</ul>
<p><span id="more-259"></span></p>
<h2>Check development environment</h2>
<p>Before making your environment Android development ready, please check your current environment.<br />
<a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/07/SysReq.gif" rel="lightbox[259]" title="SysReq"><img loading="lazy" class="alignright size-thumbnail wp-image-262" title="SysReq" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/07/SysReq-150x150.gif" alt="" width="128" height="128" /></a></p>
<ol>
<li>Go to <a href="http://developer.android.com/sdk/requirements.html">http://developer.android.com/sdk/requirements.html</a> and ensure that your environment is Android ready.</li>
<li>If you need the JDK (the JRE is not sufficient), download the latest from <a href="http://java.sun.com/javase/downloads/index.jsp">http://java.sun.com/javase/downloads/index.jsp</a> and install it.</li>
</ol>
<h2>Install Android SDK</h2>
<p><a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/07/ADT.gif" rel="lightbox[259]" title="ADT"><img loading="lazy" class="alignright size-thumbnail wp-image-264" title="ADT" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/07/ADT-150x150.gif" alt="" width="128" height="128" /></a>So we are ready to install the Android SDK.</p>
<ol>
<li>Go to <a href="http://developer.android.com/index.html">http://developer.android.com/index.html</a> and click on the upper right image named <strong>Download</strong></li>
<li>Click the appropriate link to download the SDK for your host platform.</li>
<li>Unzip the downloaded file to a directory (in my case <em>c:\dev</em>)</li>
<li>You do not need to setup the SDK because we will use Eclipse to complete the set-up.</li>
</ol>
<h2>Install Android Development Tools<a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/07/Pref.gif" rel="lightbox[259]" title="Pref"><img loading="lazy" class="alignright size-thumbnail wp-image-265" title="Pref" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/07/Pref-150x150.gif" alt="" width="128" height="128" /></a></h2>
<p>Now we are ready to configure Eclipse with de ADT plug-in.</p>
<ol>
<li>From within Eclipse select <strong>Install New Software</strong> from the <strong>Help menu</strong>.</li>
<li>Click on the <strong>Add</strong> button and enter the following URL into the <em>Location</em> field and click <strong>OK</strong>.https://dl-ssl.google.com/android/eclipse/</li>
<li>Click the checkbox as shown in image, and then click <strong>Next</strong>.</li>
<li>Complete the installation and restart Eclipse.<a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/07/AvPack.gif" rel="lightbox[259]" title="AvPack"><img loading="lazy" class="alignright size-thumbnail wp-image-266" title="AvPack" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/07/AvPack-150x150.gif" alt="" width="128" height="128" /></a></li>
<li>Once Eclipse has restarted, you have one last task to perform: you need to tell Eclipse where the Android SDK is located.</li>
<li>From within Eclipse select <strong>Preferences</strong> from the <strong>Window</strong> menu.</li>
<li>Select Android and provide the location of the Android SDK (in my case <em>C:\dev\android-sdk-windows</em>) and click <strong>OK</strong>.</li>
<li>Now select <strong>Android SDK and AVD Manager</strong> from the <strong>Window</strong> menu.</li>
<li>Select available packages and select the latest version of the SDK.</li>
<li>Click <strong>Installed selected</strong> and complete the installation, preferably by restarting Eclipse.</li>
</ol>
<h2>Set-up a device</h2>
<p>The only thing left is to set-up a Android device. Of course you can use your own Android device, but a emulator is just as easy.<a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/07/Icon.gif" rel="lightbox[259]" title="Icon"><img loading="lazy" class="alignright size-thumbnail wp-image-267" title="Icon" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/07/Icon-150x81.gif" alt="" width="126" height="68" /></a></p>
<ol>
<li>Press the Device Manager button and click on <strong>New</strong>.</li>
<li>Create the device and click <strong>Create AVD</strong>.</li>
<li>Finally run the freshly created Device by selecting the device and click <strong>Start</strong> and <strong>Launch</strong>. (please be patient it’s not that fast)</li>
</ol>
<p><a href="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/07/DevIn.gif" rel="lightbox[259]" title="DevIn"><img loading="lazy" class="size-medium wp-image-268" title="DevIn" src="http://wiebe-elsinga.com/blog/wp-content/uploads/2010/07/DevIn-232x300.gif" alt="" width="128" height="148" /></a></p>
<p>Hope this helps.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://wiebe-elsinga.com/blog/android-developement-environment/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
	</channel>
</rss>
