I have a custom View, a Button, but setOnClickListener()
does not work.
class ButtonReadBarcode extends android.support.v7.widget.AppCompatButton {
public String ma_vach = "";
private Activity ac = null;
public ButtonReadBarcode(Context context) {
super(context);
ac = Global.getActivity( context);
init();
}
private void init(){
setVisibility(View.VISIBLE);
setLayoutParams( new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
setText("Scan barcode ...");
setAllCaps(false);
}
@Override
public void setOnClickListener( View.OnClickListener l) {
super.setOnClickListener(l);
// this line does now work
setText("I want this text show when click");
}
}
not any error messages