<?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>Code Library &#187; formstuff</title>
	<atom:link href="http://www.ucosoft.com/tag/formstuff/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ucosoft.com</link>
	<description>Free Source Code and Program Tips</description>
	<lastBuildDate>Thu, 22 Jul 2010 05:17:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Eclipse developed Android, Hello FormStuff (study 9)</title>
		<link>http://www.ucosoft.com/eclipse-developed-android-formstuff-study-2.html</link>
		<comments>http://www.ucosoft.com/eclipse-developed-android-formstuff-study-2.html#comments</comments>
		<pubDate>Thu, 17 Dec 2009 15:57:10 +0000</pubDate>
		<dc:creator>support</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[developed]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[formstuff]]></category>
		<category><![CDATA[study]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/uncategorized/eclipse-developed-android-formstuff-study-2.html</guid>
		<description><![CDATA[1 HelloFormStuff. Java code is as follows 1 package com.example.test; import android.app.Activity; import android.os.Bundle; import android.view.KeyEvent; import android.view.View; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageButton; import android.widget.RadioButton; import android.widget.Toast; import android.widget.ToggleButton; public class HelloFormStuff extends Activity &#40;/ ** Called when the activity is first created. * / @ Override public void onCreate &#40;Bundle savedInstanceState&#41; &#40;super.onCreate &#40;savedInstanceState&#41;; [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">  HelloFormStuff. <span style="color: #006633;">Java</span> code is as follows</pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.example.test</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.Activity</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.KeyEvent</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.CheckBox</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.EditText</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.ImageButton</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.RadioButton</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.Toast</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.ToggleButton</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> HelloFormStuff <span style="color: #000000; font-weight: bold;">extends</span> Activity <span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span> <span style="color: #339933;">**</span> Called when the activity is first created. <span style="color: #339933;">*</span> <span style="color: #339933;">/</span> @ Override <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;">&#40;</span><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> 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> <span style="color: #000000; font-weight: bold;">final</span> ImageButton button <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>ImageButton<span style="color: #009900;">&#41;</span> findViewById <span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">android_button</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> button.<span style="color: #006633;">setOnClickListener</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">View</span>.<span style="color: #006633;">OnClickListener</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><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><span style="color: #003399;">View</span> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span> <span style="color: #339933;">/</span> Perform action on clicks Toast.<span style="color: #006633;">makeText</span> <span style="color: #009900;">&#40;</span>HelloFormStuff.<span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>Beep Bop<span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>. <span style="color: #006633;">show</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">final</span> EditText edittext <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;">edittext</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> edittext.<span style="color: #006633;">setOnKeyListener</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">View</span>.<span style="color: #006633;">OnKeyListener</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> onKey <span style="color: #009900;">&#40;</span><span style="color: #003399;">View</span> v, <span style="color: #000066; font-weight: bold;">int</span> keyCode, <span style="color: #003399;">KeyEvent</span> event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">getAction</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #003399;">KeyEvent</span>.<span style="color: #006633;">ACTION_DOWN</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #009900;">&#40;</span>keyCode <span style="color: #339933;">==</span> <span style="color: #003399;">KeyEvent</span> . <span style="color: #006633;">KEYCODE_ENTER</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span> <span style="color: #339933;">/</span> Perform action on key press Toast.<span style="color: #006633;">makeText</span> <span style="color: #009900;">&#40;</span>HelloFormStuff.<span style="color: #000000; font-weight: bold;">this</span>, edittext.<span style="color: #006633;">getText</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>. <span style="color: #006633;">show</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">final</span> CheckBox checkbox <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>CheckBox<span style="color: #009900;">&#41;</span> findViewById <span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">checkbox</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> checkbox.<span style="color: #006633;">setOnClickListener</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">View</span>.<span style="color: #006633;">OnClickListener</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><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><span style="color: #003399;">View</span> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span> <span style="color: #339933;">/</span> Perform action on clicks <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>checkbox.<span style="color: #006633;">isChecked</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span>Toast.<span style="color: #006633;">makeText</span> <span style="color: #009900;">&#40;</span> HelloFormStuff.<span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>Selected<span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>. <span style="color: #006633;">show</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#40;</span>Toast.<span style="color: #006633;">makeText</span> <span style="color: #009900;">&#40;</span>HelloFormStuff.<span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>Not selected<span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>. <span style="color: #006633;">show</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #003399;">View</span>.<span style="color: #006633;">OnClickListener</span> radio_listener <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">View</span>.<span style="color: #006633;">OnClickListener</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><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><span style="color: #003399;">View</span> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span> <span style="color: #339933;">/</span> Perform action on clicks RadioButton rb <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>RadioButton<span style="color: #009900;">&#41;</span> v<span style="color: #339933;">;</span> Toast.<span style="color: #006633;">makeText</span> <span style="color: #009900;">&#40;</span>HelloFormStuff.<span style="color: #000000; font-weight: bold;">this</span>, rb.<span style="color: #006633;">getText</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>. <span style="color: #006633;">show</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">final</span> RadioButton radio_red <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>RadioButton<span style="color: #009900;">&#41;</span> findViewById <span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">radio_red</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">final</span> RadioButton radio_blue <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>RadioButton<span style="color: #009900;">&#41;</span> findViewById <span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">radio_blue</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> radio_red.<span style="color: #006633;">setOnClickListener</span> <span style="color: #009900;">&#40;</span>radio_listener<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> radio_blue.<span style="color: #006633;">setOnClickListener</span> <span style="color: #009900;">&#40;</span> radio_listener<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">final</span> ToggleButton togglebutton <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>ToggleButton<span style="color: #009900;">&#41;</span> findViewById <span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">togglebutton</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> togglebutton.<span style="color: #006633;">setOnClickListener</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">View</span>.<span style="color: #006633;">OnClickListener</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><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><span style="color: #003399;">View</span> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span> <span style="color: #339933;">/</span> Perform action on clicks <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>togglebutton.<span style="color: #006633;">isChecked</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span>Toast.<span style="color: #006633;">makeText</span> <span style="color: #009900;">&#40;</span>HelloFormStuff.<span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>ON<span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>. <span style="color: #006633;">show</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#40;</span>Toast.<span style="color: #006633;">makeText</span> <span style="color: #009900;">&#40;</span>HelloFormStuff.<span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>OFF<span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>. <span style="color: #006633;">show</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

</p>
<p>  layout-&gt; main.xml </p>
</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;?</span> xml version <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span><span style="color: #cc66cc;">1.0</span><span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span> encoding <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>utf<span style="color: #339933;">-</span><span style="color: #cc66cc;">8</span><span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;?&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>LinearLayout xmlns<span style="color: #339933;">:</span> android <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//schemas.android.com/apk/res/android&amp;quot; android: orientation = &amp;quot;vertical&amp;quot; android: layout_width = &amp;quot;fill_parent&amp;quot; android: layout_height = &amp;quot;fill_parent&amp;quot;&amp;gt; &amp;lt;ImageButton android: id = &amp;quot;@ + id / android_button&amp;quot; android: layout_width = &amp;quot;100dip&amp;quot; android: layout_height = &amp;quot;wrap_content&amp;quot; android: src = &amp;quot;@ drawable / android&amp;quot; / &amp;gt; &amp;lt;EditText android:id=&amp;quot;@+id/edittext&amp;quot; android:layout_width=&amp;quot;fill_parent&amp;quot; android:layout_height=&amp;quot;wrap_content&amp;quot;/&amp;gt; &amp;lt;CheckBox android: id = &amp;quot;@ + id / checkbox&amp;quot; android: layout_width = &amp;quot;wrap_content&amp;quot; android: layout_height = &amp;quot;wrap_content&amp;quot; android: text = &amp;quot;check it out&amp;quot; /&amp;gt; &amp;lt;RadioGroup android:layout_width=&amp;quot;fill_parent&amp;quot; android:layout_height=&amp;quot;wrap_content&amp;quot; android:orientation=&amp;quot;vertical&amp;quot;&amp;gt; &amp;lt;RadioButton android: id = &amp;quot;@ + id / radio_red &amp;quot;android: layout_width =&amp;quot; wrap_content &amp;quot;android: layout_height =&amp;quot; wrap_content &amp;quot;android: text =&amp;quot; Red &amp;quot;/&amp;gt; &amp;lt;RadioButton android: id =&amp;quot; @ + id / radio_blue &amp;quot;android: layout_width =&amp;quot; wrap_content &amp;quot;android: layout_height = &amp;quot;wrap_content&amp;quot; android: text = &amp;quot;Blue&amp;quot; /&amp;gt; &amp;lt;/ RadioGroup&amp;gt; &amp;lt;ToggleButton android:id=&amp;quot;@+id/togglebutton&amp;quot; android:layout_width=&amp;quot;wrap_content&amp;quot; android:layout_height=&amp;quot;wrap_content&amp;quot; /&amp;gt; &amp;lt;/ LinearLayout &amp;quot;</span></pre></td></tr></table></div>

</p>
<p>  run it as follows: </p>
<p><img src="/images/17560203d400e504d9308ef0bd1da114.png" alt="" /></p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/android" title="android" rel="tag">android</a>, <a href="http://www.ucosoft.com/tag/developed" title="developed" rel="tag">developed</a>, <a href="http://www.ucosoft.com/tag/eclipse" title="eclipse" rel="tag">eclipse</a>, <a href="http://www.ucosoft.com/tag/formstuff" title="formstuff" rel="tag">formstuff</a>, <a href="http://www.ucosoft.com/tag/study" title="study" rel="tag">study</a></strong><br />
]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/eclipse-developed-android-formstuff-study-2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse developed Android, Hello FormStuff (study 9)</title>
		<link>http://www.ucosoft.com/eclipse-developed-android-formstuff-study.html</link>
		<comments>http://www.ucosoft.com/eclipse-developed-android-formstuff-study.html#comments</comments>
		<pubDate>Wed, 09 Dec 2009 14:38:30 +0000</pubDate>
		<dc:creator>support</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[developed]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[formstuff]]></category>
		<category><![CDATA[study]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/uncategorized/eclipse-developed-android-formstuff-study.html</guid>
		<description><![CDATA[1 HelloFormStuff. Java code is as follows 1 package com.example.test; import android.app.Activity; import android.os.Bundle; import android.view.KeyEvent; import android.view.View; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageButton; import android.widget.RadioButton; import android.widget.Toast; import android.widget.ToggleButton; public class HelloFormStuff extends Activity &#40;/ ** Called when the activity is first created. * / @ Override public void onCreate &#40;Bundle savedInstanceState&#41; &#40;super.onCreate &#40;savedInstanceState&#41;; [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">  HelloFormStuff. <span style="color: #006633;">Java</span> code is as follows</pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.example.test</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.Activity</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.KeyEvent</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.CheckBox</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.EditText</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.ImageButton</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.RadioButton</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.Toast</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.ToggleButton</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> HelloFormStuff <span style="color: #000000; font-weight: bold;">extends</span> Activity <span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span> <span style="color: #339933;">**</span> Called when the activity is first created. <span style="color: #339933;">*</span> <span style="color: #339933;">/</span> @ Override <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;">&#40;</span><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> 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> <span style="color: #000000; font-weight: bold;">final</span> ImageButton button <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>ImageButton<span style="color: #009900;">&#41;</span> findViewById <span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">android_button</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> button.<span style="color: #006633;">setOnClickListener</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">View</span>.<span style="color: #006633;">OnClickListener</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><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><span style="color: #003399;">View</span> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span> <span style="color: #339933;">/</span> Perform action on clicks Toast.<span style="color: #006633;">makeText</span> <span style="color: #009900;">&#40;</span>HelloFormStuff.<span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>Beep Bop<span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>. <span style="color: #006633;">show</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">final</span> EditText edittext <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;">edittext</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> edittext.<span style="color: #006633;">setOnKeyListener</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">View</span>.<span style="color: #006633;">OnKeyListener</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> onKey <span style="color: #009900;">&#40;</span><span style="color: #003399;">View</span> v, <span style="color: #000066; font-weight: bold;">int</span> keyCode, <span style="color: #003399;">KeyEvent</span> event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">getAction</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #003399;">KeyEvent</span>.<span style="color: #006633;">ACTION_DOWN</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #009900;">&#40;</span>keyCode <span style="color: #339933;">==</span> <span style="color: #003399;">KeyEvent</span> . <span style="color: #006633;">KEYCODE_ENTER</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span> <span style="color: #339933;">/</span> Perform action on key press Toast.<span style="color: #006633;">makeText</span> <span style="color: #009900;">&#40;</span>HelloFormStuff.<span style="color: #000000; font-weight: bold;">this</span>, edittext.<span style="color: #006633;">getText</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>. <span style="color: #006633;">show</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">final</span> CheckBox checkbox <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>CheckBox<span style="color: #009900;">&#41;</span> findViewById <span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">checkbox</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> checkbox.<span style="color: #006633;">setOnClickListener</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">View</span>.<span style="color: #006633;">OnClickListener</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><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><span style="color: #003399;">View</span> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span> <span style="color: #339933;">/</span> Perform action on clicks <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>checkbox.<span style="color: #006633;">isChecked</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span>Toast.<span style="color: #006633;">makeText</span> <span style="color: #009900;">&#40;</span> HelloFormStuff.<span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>Selected<span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>. <span style="color: #006633;">show</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#40;</span>Toast.<span style="color: #006633;">makeText</span> <span style="color: #009900;">&#40;</span>HelloFormStuff.<span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>Not selected<span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>. <span style="color: #006633;">show</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #003399;">View</span>.<span style="color: #006633;">OnClickListener</span> radio_listener <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">View</span>.<span style="color: #006633;">OnClickListener</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><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><span style="color: #003399;">View</span> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span> <span style="color: #339933;">/</span> Perform action on clicks RadioButton rb <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>RadioButton<span style="color: #009900;">&#41;</span> v<span style="color: #339933;">;</span> Toast.<span style="color: #006633;">makeText</span> <span style="color: #009900;">&#40;</span>HelloFormStuff.<span style="color: #000000; font-weight: bold;">this</span>, rb.<span style="color: #006633;">getText</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>. <span style="color: #006633;">show</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">final</span> RadioButton radio_red <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>RadioButton<span style="color: #009900;">&#41;</span> findViewById <span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">radio_red</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">final</span> RadioButton radio_blue <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>RadioButton<span style="color: #009900;">&#41;</span> findViewById <span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">radio_blue</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> radio_red.<span style="color: #006633;">setOnClickListener</span> <span style="color: #009900;">&#40;</span>radio_listener<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> radio_blue.<span style="color: #006633;">setOnClickListener</span> <span style="color: #009900;">&#40;</span> radio_listener<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">final</span> ToggleButton togglebutton <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>ToggleButton<span style="color: #009900;">&#41;</span> findViewById <span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">id</span>.<span style="color: #006633;">togglebutton</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> togglebutton.<span style="color: #006633;">setOnClickListener</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">View</span>.<span style="color: #006633;">OnClickListener</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><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><span style="color: #003399;">View</span> v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span> <span style="color: #339933;">/</span> Perform action on clicks <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>togglebutton.<span style="color: #006633;">isChecked</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span>Toast.<span style="color: #006633;">makeText</span> <span style="color: #009900;">&#40;</span>HelloFormStuff.<span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>ON<span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>. <span style="color: #006633;">show</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#40;</span>Toast.<span style="color: #006633;">makeText</span> <span style="color: #009900;">&#40;</span>HelloFormStuff.<span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>OFF<span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>. <span style="color: #006633;">show</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

</p>
<p>  layout-&gt; main.xml </p>
</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;?</span> xml version <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span><span style="color: #cc66cc;">1.0</span><span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span> encoding <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>utf<span style="color: #339933;">-</span><span style="color: #cc66cc;">8</span><span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;?&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span>LinearLayout xmlns<span style="color: #339933;">:</span> android <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span>quot<span style="color: #339933;">;</span>http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//schemas.android.com/apk/res/android&amp;quot; android: orientation = &amp;quot;vertical&amp;quot; android: layout_width = &amp;quot;fill_parent&amp;quot; android: layout_height = &amp;quot;fill_parent&amp;quot;&amp;gt; &amp;lt;ImageButton android: id = &amp;quot;@ + id / android_button&amp;quot; android: layout_width = &amp;quot;100dip&amp;quot; android: layout_height = &amp;quot;wrap_content&amp;quot; android: src = &amp;quot;@ drawable / android&amp;quot; / &amp;gt; &amp;lt;EditText android:id=&amp;quot;@+id/edittext&amp;quot; android:layout_width=&amp;quot;fill_parent&amp;quot; android:layout_height=&amp;quot;wrap_content&amp;quot;/&amp;gt; &amp;lt;CheckBox android: id = &amp;quot;@ + id / checkbox&amp;quot; android: layout_width = &amp;quot;wrap_content&amp;quot; android: layout_height = &amp;quot;wrap_content&amp;quot; android: text = &amp;quot;check it out&amp;quot; /&amp;gt; &amp;lt;RadioGroup android:layout_width=&amp;quot;fill_parent&amp;quot; android:layout_height=&amp;quot;wrap_content&amp;quot; android:orientation=&amp;quot;vertical&amp;quot;&amp;gt; &amp;lt;RadioButton android: id = &amp;quot;@ + id / radio_red &amp;quot;android: layout_width =&amp;quot; wrap_content &amp;quot;android: layout_height =&amp;quot; wrap_content &amp;quot;android: text =&amp;quot; Red &amp;quot;/&amp;gt; &amp;lt;RadioButton android: id =&amp;quot; @ + id / radio_blue &amp;quot;android: layout_width =&amp;quot; wrap_content &amp;quot;android: layout_height = &amp;quot;wrap_content&amp;quot; android: text = &amp;quot;Blue&amp;quot; /&amp;gt; &amp;lt;/ RadioGroup&amp;gt; &amp;lt;ToggleButton android:id=&amp;quot;@+id/togglebutton&amp;quot; android:layout_width=&amp;quot;wrap_content&amp;quot; android:layout_height=&amp;quot;wrap_content&amp;quot; /&amp;gt; &amp;lt;/ LinearLayout &amp;quot;</span></pre></td></tr></table></div>

</p>
<p>  run it as follows: </p>
<p><img src="/images/17560203d400e504d9308ef0bd1da114.png" alt="" /></p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/android" title="android" rel="tag">android</a>, <a href="http://www.ucosoft.com/tag/developed" title="developed" rel="tag">developed</a>, <a href="http://www.ucosoft.com/tag/eclipse" title="eclipse" rel="tag">eclipse</a>, <a href="http://www.ucosoft.com/tag/formstuff" title="formstuff" rel="tag">formstuff</a>, <a href="http://www.ucosoft.com/tag/study" title="study" rel="tag">study</a></strong><br />
]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/eclipse-developed-android-formstuff-study.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

