Counter display code in SMS

26 Oct

Core Logic:
Counter Display = No of Chars Left / Required SMS Count

private final TextWatcher mTextEditorWatcher = new TextWatcher() {
public void beforeTextChanged(CharSequence s, int start,
int count, int after) {
public void onTextChanged(CharSequence s, int start,
int before, int count) {
//This sets a textview to the current length
String smsNo;
if(s.length() == 0)
smsNo = "0";
smsNo = String.valueOf(s.length()/160 + 1);
String smsLength = String.valueOf(160-(s.length()%160));
public void afterTextChanged(Editable arg0) {
// TODO Auto-generated method stub


Leave a comment

Posted by on October 26, 2012 in Android Source Code


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: