Index: trunk/07.RadioButtonTest/default.properties =================================================================== --- trunk/07.RadioButtonTest/default.properties (revision 19) +++ trunk/07.RadioButtonTest/default.properties (revision 19) @@ -0,0 +1,13 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system use, +# "build.properties", and override values to adapt the script to your +# project structure. + +# Indicates whether an apk should be generated for each density. +split.density=false +# Project target. +target=android-7 Index: trunk/07.RadioButtonTest/.classpath =================================================================== --- trunk/07.RadioButtonTest/.classpath (revision 19) +++ trunk/07.RadioButtonTest/.classpath (revision 19) @@ -0,0 +1,7 @@ + + + + + + + Index: trunk/07.RadioButtonTest/.project =================================================================== --- trunk/07.RadioButtonTest/.project (revision 19) +++ trunk/07.RadioButtonTest/.project (revision 19) @@ -0,0 +1,33 @@ + + + 07.RadioButtonTest + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + Index: trunk/07.RadioButtonTest/AndroidManifest.xml =================================================================== --- trunk/07.RadioButtonTest/AndroidManifest.xml (revision 19) +++ trunk/07.RadioButtonTest/AndroidManifest.xml (revision 19) @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + Index: trunk/07.RadioButtonTest/src/soo/ui/simple/RadioButtonTest.java =================================================================== --- trunk/07.RadioButtonTest/src/soo/ui/simple/RadioButtonTest.java (revision 19) +++ trunk/07.RadioButtonTest/src/soo/ui/simple/RadioButtonTest.java (revision 19) @@ -0,0 +1,92 @@ +package soo.ui.simple; + +import android.app.Activity; +import android.graphics.Color; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.EditText; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.RadioGroup.OnCheckedChangeListener; + +public class RadioButtonTest extends Activity { + /** Called when the activity is first created. */ + + RadioButton bt01=null; + RadioButton bt02=null; + RadioButton bt03=null; + RadioButton bt04=null; + RadioButton bt05=null; + + RadioGroup rg1=null; + RadioGroup rg2=null; + EditText et=null; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + + rg1 = (RadioGroup)findViewById(R.id.radioGroup01); + rg2 = (RadioGroup)findViewById(R.id.radioGroup02); + et = (EditText)findViewById(R.id.et); + + + rg1.setOnCheckedChangeListener(new A()); + rg2.setOnCheckedChangeListener(new A()); + /* + rg1.setOnCheckedChangeListener(new OnCheckedChangeListener() { + + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + // TODO Auto-generated method stub + if(group == rg1){ + et.setText(new Integer(checkedId).toString()); + et.setTextColor(Color.BLUE); + }else{ + et.setText(new Integer(checkedId).toString()); + et.setTextColor(Color.RED); + } + } + }); + */ + /* + bt01 = (RadioButton)findViewById(R.id.radioButton01); + bt02 = (RadioButton)findViewById(R.id.radioButton02); + bt03 = (RadioButton)findViewById(R.id.radioButton03); + bt04 = (RadioButton)findViewById(R.id.radioButton04); + bt05 = (RadioButton)findViewById(R.id.radioButton05); + + bt01.setOnClickListener(new A()); + bt02.setOnClickListener(new A()); + bt03.setOnClickListener(new A()); + bt04.setOnClickListener(new A()); + bt05.setOnClickListener(new A()); + */ + } + /* + class A implements OnClickListener{ + @Override + public void onClick(View v) { + // TODO Auto-generated method stub + Log.d("radioTest", v.toString()); + } + } + */ + + class A implements OnCheckedChangeListener{ + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + // TODO Auto-generated method stub + RadioButton rb = (RadioButton)findViewById(checkedId); + et.setText(rb.getText()); + if(group == rg1){ + et.setTextColor(Color.BLUE); + }else{ + et.setTextColor(Color.RED); + } + } + } +} Index: trunk/07.RadioButtonTest/res/values/strings.xml =================================================================== --- trunk/07.RadioButtonTest/res/values/strings.xml (revision 19) +++ trunk/07.RadioButtonTest/res/values/strings.xml (revision 19) @@ -0,0 +1,5 @@ + + + Hello World, RadioButtonTest! + RadioButtonTest + Index: trunk/07.RadioButtonTest/res/layout/main.xml =================================================================== --- trunk/07.RadioButtonTest/res/layout/main.xml (revision 19) +++ trunk/07.RadioButtonTest/res/layout/main.xml (revision 19) @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + +