EditText.getText() isn't bound
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- android, csharp
- Domain
- mobile-dev
Research direction
Start in src/Mono.Android/metadata and inspect how EditText and TextView members are represented in the binding metadata. Confirm that EditText.getText() is exposed as an editable TextEditable property, allowing Clear() and Append() while preserving the requested behavior.
Written by the indexing model from the issue text.
Description
Android framework version
net8.0-android, net9.0-android
Affected platform version
.NET 8.0
Description
Context: https://discord.com/channels/732297728826277939/732297837953679412/1272467705534091348
Context: https://stackoverflow.com/questions/26365808/edittext-settext-changes-the-keyboard-type-to-default-from-123-to-abc
Background
A customer came onto Discord asking:
When calling
EditText.setText()on android, it resets the keyboard. This is super annoying if you are processing inputs and the user changes from ABC view to symbols view, the keyboard jumps 'back' to ABC view.
…
The 'workaround' natively is to not callSetTextand instead callgetText().Clear()and thengetText().Append(blah)
The problem is, that's not currently possible, because there is no Text or TextFormatted property that has a .Clear() method. The TextView.TextFormatted property returns ICharSequence, which has no Clear() method.
What's Going On?
What's going on is our favorite, covariant return types: TextView.getText() returns CharSequence, while EditText.getText() returns the Editable interface. However, C# covariant return types only works for classes, not interfaces, and regardless we don't re-bind the Text property on EditText.
Proposal
Use src/Mono.Android/metadata to bind the EditText.getText() method as the EditText.TextEditable property. That would allow the original customer to call myEditText.TextEditable.Clear(), which is not currently possible.
- Dominant language
- C#
- Stars
- 2.1k
- Forks
- 580
- Avg merge
- 2d 19m
- Merged PRs (30d)
- 228
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/android
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Area: Debugger enhancement needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
agentic-workflows needs-triage
-
automated needs-triage skill-runner
Difficulty 5/5 Over a week Newbie friendliness 10/100
-
Area: App Runtime needs-triage
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·