by broakenmedia

broakenmedia / CharCountTextView

A Twitter style post length counter which can be bound to an EditText and provide callbacks when hit...

122 Stars 16 Forks Last release: Not found Apache License 2.0 11 Commits 1 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:



A Twitter style post length counter which can be bound to an EditText and provide callbacks when hitting a max character count.

Once bound to an EditText the characters remaining will go down as the user types. If the user goes over the max limit you will get notified and the view will show how much they are over (-5 etc.) where you can disable UI accordingly.

Note: When the user has 10% or less characters remaining the text color will change to use the "exceededTextColor" below (Default: RED)


Count Exceeded


Add this to your project build.gradle

allprojects {
    repositories {
        maven { url '' }

Add this to your module build.gradle

dependencies {
    compile 'com.github.broakenmedia:CharCountTextView:v1.0'


Add the following xml to your layout xml


Then in your activity/fragment:

CharCountTextView tvCharCount = (CharCountTextView) findViewById(;
tvCharCount.setCharCountChangedListener(new CharCountTextView.CharCountChangedListener() {
    public void onCountChanged(int countRemaining, boolean hasExceededLimit) {
        //Enable disable tweet button for example

Additonal Methods

To set the max no. of characters and character count exceeded text color dynamically:

 - setMaxCharacters(int maxCharacters); 
 - setExceededTextColor(int colorRes); //Font color will change to this when count has 10% or less remaining


Copyright (c) BroakenMedia 2016-2017

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.