How to implement a PIN code screen
<p><strong>How to code such type of password screen design, while after inputting the password the circles should change or imageview should change..??</strong></p>

<p><strong>Login.xml</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"&gt;
&lt;LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="20dp"
    android:orientation="vertical"&gt;
&lt;LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:background="@color/light_grey"
    &gt;
    &lt;TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Enter MPIN"
        android:textStyle="bold"
        android:textSize="18dp"
        android:layout_margin="10dp"
        android:layout_gravity="center_horizontal"
        /&gt;
    &lt;LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_gravity="center_horizontal"
        &gt;
        &lt;ImageView
            android:id="@+id/imageview_circle1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="6dp"
            android:src="@drawable/circle"
            /&gt;
        &lt;ImageView
            android:id="@+id/imageview_circle2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="6dp"
            android:src="@drawable/circle"
            /&gt;
        &lt;ImageView
            android:id="@+id/imageview_circle3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="6dp"
            android:src="@drawable/circle"
            /&gt;
        &lt;ImageView
            android:id="@+id/imageview_circle4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="6dp"
            android:src="@drawable/circle"
            /&gt;
    &lt;/LinearLayout&gt;
&lt;/LinearLayout&gt;
&lt;LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:background="@color/light_grey2"
    &gt;
    &lt;EditText
        android:id="@+id/editText_enter_mpin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="number"
        android:maxLength="4"
        android:visibility="visible" &gt;
    &lt;/EditText&gt;
&lt;/LinearLayout&gt;
&lt;/LinearLayout&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p><strong>LoginActivity.java</strong></p>

<pre><code>public class LoginActivity extends AppCompatActivity {

private static final String TAG = "LoginActivity";
EditText enter_mpin;
ImageView i1, i2, i3, i4;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    i1 = (ImageView) findViewById(R.id.imageview_circle1);
    i2 = (ImageView) findViewById(R.id.imageview_circle2);
    i3 = (ImageView) findViewById(R.id.imageview_circle3);
    i4 = (ImageView) findViewById(R.id.imageview_circle4);

    enter_mpin = (EditText) findViewById(R.id.editText_enter_mpin);
    enter_mpin.requestFocus();
    enter_mpin.setInputType(InputType.TYPE_CLASS_NUMBER);
    enter_mpin.setFocusableInTouchMode(true);

    enter_mpin.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            Log.d(TAG, "onKey: screen key pressed");
            i1.setImageResource(R.drawable.circle2);
        }
    });
}
}
</code></pre>

<p><strong>circle.xml</strong></p>

<pre><code>&lt;shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"&gt;
&lt;stroke
    android:width="2dp"
    android:color="#6ab17b" /&gt;
&lt;size
    android:width="25dp"
    android:height="25dp" /&gt;
&lt;/shape&gt;
</code></pre>

<p><strong>circle2.xml</strong></p>

<pre><code>&lt;shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"&gt;
&lt;solid
    android:color="#505253"/&gt;
&lt;size
    android:width="25dp"
    android:height="25dp" /&gt;
&lt;/shape&gt;
</code></pre>

<p><a href="https://i.stack.imgur.com/rT8pl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rT8pl.png" alt="enter image description here"></a></p>