package zhang.example;
import android.app.Activity;
import android.os.Bundle;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.CompoundButton.OnCheckedChangeListener;
public class seefm extends Activity {
private EditText ed;
private CheckBox cb;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ed=(EditText)findViewById(R.id.editText1);
cb=(CheckBox)findViewById(R.id.checkBox1);
cb.setChecked(false);
cb.setOnCheckedChangeListener(new OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
// TODO Auto-generated method stub
if(cb.isChecked())
ed.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
else
ed.setTransformationMethod(PasswordTransformationMethod.getInstance());
}});
}
}
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>