Another example of TextWatcher to monitor text changed in EditText

Pada kali ini saya mau share lirik lagu terbaru Another example of TextWatcher to monitor text changed in EditText. Dan berjumpa lagi dengan saya di blog Free apk androiddan bagi teman teman yang ingin blog ini update terus silahkan berkomentar ya . .. ^_^ Baca juga tentang postingan saya sebelumnya :
Last show Monitor user action on EditText, and do something in onTextChanged() method of TextWatcher. It's another example to do something in afterTextChanged() method, don't care what and where is the change, just do something on the changed text.


package com.blogspot.android_er.androidedittextchanged;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

EditText editText;
TextView tvMsg;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editText = (EditText)findViewById(R.id.edittext);
tvMsg = (TextView)findViewById(R.id.msg);

editText.addTextChangedListener(myTextWatcher);
}

TextWatcher myTextWatcher = new TextWatcher() {

@Override
public void beforeTextChanged(CharSequence charSequence,
int i, int i1, int i2) {
}

@Override
public void onTextChanged(CharSequence charSequence,
int i, int i1, int i2) {
}

@Override
public void afterTextChanged(Editable editable) {
tvMsg.setText(editable.toString().toUpperCase());
}
};
}



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:orientation="vertical"
tools:context="com.blogspot.android_er.androidedittextchanged.MainActivity">

<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:autoLink="web"
android:text="http://android-er.blogspot.com/"
android:textStyle="bold"/>

<EditText
android:id="@+id/edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter text"
android:textSize="24dp"/>
<TextView
android:id="@+id/msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="24dp"/>


</LinearLayout>




Sekian Lirik lagu yang dapat saya bagikan tentang Another example of TextWatcher to monitor text changed in EditText

. biar tetap update blognya silahkan berkomentar Di Free apk android sekian dari saya permalink untuk post kali ini adalah http://apkgameon.blogspot.com/2017/07/another-example-of-textwatcher-to.html

CONVERSATION

0 komentar:

Post a Comment

Back
to top