SetHint updates TextEdit only after OnClickListener (after clicking on button) In my case, when user type some text in TextEdit, and activates toggle, Hint will change only after he/she submit button was pressed. If I for example will press on Toggle, hint will be the same as original.
I want to make SetHint work just after toggle set on or off. Want to change Hint in TextEdit to "Custom Text" just after I pressed toggle. Otherwise I want TextEdit stay with original hint text. Not sure if I need change it in else, since I use same hint text in layout.
public class MainActivity extends Activity {
private Button button;
private TextEdit text;
private ToggleButton toggle;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout);
text = (TextEdit) findViewById(R.id.myid);
toggle = (ToggleButton) findViewById(R.id.myid2);
if (toggle.isChecked()) {
text.setHint("Custom Text");
} else {
text.setHint("Text");
}
button.setOnClickListener(new View.OnClickListener() {
...