SpannableStringBuilder: indexOutOfBoundsException setSpan ends beyond length 0

后端 未结 4 2003
夕颜
夕颜 2021-01-11 22:40

I am working in android. i have a problem. my application crashes when i click on my text box second time.

this is my Logcat message:

java.lang.Index         


        
4条回答
  •  旧巷少年郎
    2021-01-11 23:32

    You haven't explained about your code. So it's difficult to get through your problem.

    Check this blog. It may help you. This blog says about a time picker issue. The same applies for EditText & TextView also.

    setSaveFromParentEnabled(false) & setSaveEnabled(true) should solve the issue.

    tp = (TimePicker) findViewById(R.id.timePickerComponent);
    //two lines to add after
    tp.setSaveFromParentEnabled(false);
    tp.setSaveEnabled(true);
    

提交回复
热议问题