I see a few examples of making a TextView clickable by setting onClick="clickHandler" and clickable="true".  Is there a way to use an anonymous class instead of hard coding a clickhandler method inside the activity.
There you go
TextView tv = (TextView)findViewById(R.id.textview);
tv.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
        // do whatever stuff you wanna do here
    }
});
                        public void setClickable (boolean clickable)
Enables or disables click events for this view. When a view is clickable 
it will change    its state to "pressed" on every click. Subclasses should 
set the view clickable to visually react to user's clicks.
Related XML Attributes
TextView tv = new TextView(this);
tv.setClickable(true);
tv.setOnClickListener(new OnClickListener(){
   public void onClick(View v) {
   }
});
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With