Hello all, I want to make something like this  

            Don't have an account? *Sign Up*

       What i am doing is 

     <TextView

    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/watcher"
    android:text="Don't have an account? Sign Up"
    android:textColor="#919191"
    android:layout_gravity="center_horizontal"/>



    TextView watcher = (TextView)findViewById(R.id.watcher);


    watcher.addTextChangedListener(new TextWatcher() {

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int 
after) {

        if(s.equals("Don't have an account? Sign Up")){

            watcher.setTextColor(Color.parseColor("#26C6DA"));
          
        }
    }

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

    }

    @Override
    public void afterTextChanged(Editable s) {

    }


});



     After running above code i am  getting an error


  java.lang.NullPointerException: Attempt to invoke virtual method 'void 
android.widget.TextView.addTextChangedListener(android.text.TextWatcher)' 

   on a null object reference


   What i am doing wrong Someone help.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/8f13ceb5-07ea-4a58-b90d-94ad3a4a63af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to