Edittext: Change background image when start typing
<p>I have used background image for edittext and i want that when i start typing it should change. How to do it??? </p>

<p>I have used:</p>

<pre><code>editText_username.setOnFocusChangeListener(this);
editText_password.setOnFocusChangeListener(this);

@Override
public void onFocusChange(View v, boolean hasFocus) {
    if(editText_username.hasFocus()){
        editText_username.setBackgroundResource(R.drawable.textarea_blue);
    }else{
        editText_username.setBackgroundResource(R.drawable.textarea_gray);
    }
    if(editText_password.hasFocus()){
        editText_password.setBackgroundResource(R.drawable.textarea_blue);
    }else{
        editText_password.setBackgroundResource(R.drawable.textarea_gray);
    }
   }
</code></pre>

<p>edittext background images is changing. But when i first click on username edittext the background image is not changing and when i click password edittext image is changing and again when i click on username edittext now the image is changing...Why is it so? I want that when i click username edittext for the first time background image is changed at that time only and also when click outside editext the color shoukd return to default color.</p>
