B4A Library CharCounter

This library will allow you to add a character counter to EditTexts.

The counter can be ascending or descending.


Requirements:

1- Copy the CharCounter.jar and CharCounter.xml to your additional libraries directory.


Usage:
B4X:
'Initialize the library
Dim Ascending As CharCounter

'Add the counter to an EditText
Ascending.Initialize(Activity, EditText1, 10, "A", "L", "Length: ")


'Add this line to the TextChanged event (in this sample, EditText1)
Sub EditText1_TextChanged(Old As String, New As String)

    Ascending.Update(Old, New)

End Sub

That's it.

A sample project is attached.
 

Attachments

  • CharCounter_Project.zip
    10.6 KB · Views: 362
  • CharCounter_Lib_1.0.zip
    3.4 KB · Views: 405
Last edited:

cds-soft

Member
Licensed User
Longtime User
Thanks for this. Should be the posibility to hide the prompt? If i pass "" or Null it still appear. I'm ussing this in a scrollview, and the prompt is not attached with the edit and doesn't scroll with it. Thanks.
 

cds-soft

Member
Licensed User
Longtime User
How are you initializing the EditTexts?, do you have a small sample code for me to try?, if you do, please attach the ZIP file to a post.
Well, it's a big project now, so I have to make a simple example. This weekend.
Now i make the charcounter not visible and it's enough from now.
Thanks for your reply.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…