Questions tagged [android-editable]

9 questions
2
votes
1 answer

Android StringBuilder vs Editable

While trying to comprehend this answer, I failed to understand the difference between StringBuilder and Editable. This image (minus the hand-drawn red circles) comes from that answer. Both of them have methods to append, delete, insert, and replace…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
1
vote
1 answer

What really happens when setText() is called on an EditText?

This is a part of the code: editText.setText("Some Text", TextView.BufferType.EDITABLE); Editable editable = (Editable) editText.getText(); // value of editable.toString() here is "Some Text" editText.setText("Another Text",…
1
vote
0 answers

Why we should not change content of returned value from TextView#getText()?

Android Docs in about TextView.getText() say: Note: The content of the return value should not be modified. If you want a modifiable one, you should make your own copy first. Also TextView has setText (CharSequence text, TextView.BufferType type)…
hasanghaforian
  • 13,858
  • 11
  • 76
  • 167
0
votes
1 answer

Relationship between Editable objects and EditText text attribute

The app I've created just shows what users have typed in the EditText. This is the onCreate method of its MainActivity: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); …
0
votes
1 answer

How to change span position automatically, if some text added before spanned text in EditText?

Am creating an application in which edittext adds style span to certain positions of text editable.setSpan(new StyleSpan(Typeface.BOLD), start, start+replacement.length(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); My issue is that if user adds, some text…
Bincy Baby
  • 3,941
  • 5
  • 36
  • 62
0
votes
1 answer

EditText: Cursor does not update when calling setText() with a custom Editable

I'm experiencing issues trying to use a custom type that implements Editable as the basis for an EditText. Here is my code: // This is a custom type that implements Editable. // It's just a wrapper over a SpannableStringBuilder, with some //…
James Ko
  • 32,215
  • 30
  • 128
  • 239
0
votes
2 answers

How can I validate EditText. App is getting crashed on submit without any value in EditText

I'm trying to validate EditText for mandatory check. So I created Validation.java with hasText() function. Even after using this my app is getting crashed when no value is passed in EditText instead of displaying warning. Attaching my code below.…
Pavithran
  • 9
  • 5
-1
votes
1 answer

Android Editable is abstract; cannot be instantiated

I'm creating an EditText subclass and I want to make an Editable variable to pass to the super class. When I originally tried private Editable unicodeText = new Editable(); I got the error 'Editable' is abstract; cannot be…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
-4
votes
1 answer

android dialog with editable listview

I am trying to create a ListView with editable lines: MainActivity public class AlertDialogList extends AppCompatActivity { protected final String DEBUG_TAG = this.getClass().getName(); List> headers = new…
Alex B
  • 347
  • 1
  • 3
  • 9