[Java for Android App Development] tim91700:
Hello,

sftp is a checkbox, here is my code:

public void interceptionLienFTP()
{
hote.addTextChangedListener(new TextWatcher() {

public void afterTextChanged(Editable s)
{
//String ftp = "ftps://arthur:@ftp.example.com:990";
String lienFTP = s.toString();
if ((lienFTP.subSequence(0, 1)).equals("s"))
{
sftp.setChecked(true);
}
else
sftp.setChecked(false);
}

public void beforeTextChanged(CharSequence s, int start,
int count, int after) {
}

public void onTextChanged(CharSequence s, int start,
int before, int count) {

}
});
}

The logcat :

6-03 09:01:16.131: E/AndroidRuntime(2163): FATAL EXCEPTION: main
06-03 09:01:16.131: E/AndroidRuntime(2163): java.lang.StringIndexOutOfBoundsException: length=0; regionStart=0; regionLength=1
06-03 09:01:16.131: E/AndroidRuntime(2163):	at java.lang.String.startEndAndLength(String.java:583)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at java.lang.String.substring(String.java:1464)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at java.lang.String.subSequence(String.java:1851)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at com.example.ynovandroid.activity.InfoFTPActivity$1.afterTextChanged(InfoFTPActivity.java:120)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.widget.TextView.sendAfterTextChanged(TextView.java:7334)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:9087)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.text.SpannableStringBuilder.sendAfterTextChanged(SpannableStringBuilder.java:970)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:497)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:212)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:30)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.text.method.BaseKeyListener.backspaceOrForwardDelete(BaseKeyListener.java:94)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.text.method.BaseKeyListener.backspace(BaseKeyListener.java:49)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.text.method.BaseKeyListener.onKeyDown(BaseKeyListener.java:155)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.text.method.QwertyKeyListener.onKeyDown(QwertyKeyListener.java:357)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.text.method.TextKeyListener.onKeyDown(TextKeyListener.java:136)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.widget.TextView.doKeyDown(TextView.java:5464)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.widget.TextView.onKeyDown(TextView.java:5283)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.KeyEvent.dispatch(KeyEvent.java:2623)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.View.dispatchKeyEvent(View.java:7343)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1393)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1393)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1393)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1393)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1393)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1393)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1933)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1408)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.app.Activity.dispatchKeyEvent(Activity.java:2384)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1860)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:3791)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3774)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3483)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3540)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3516)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:3666)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:1982)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:1698)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:1689)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:1959)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
06-03 09:01:16.131: E/AndroidRuntime(2163):	at android.os

How I can uncheck it ?

I'll apply the same code for all textview.