Can anyone help me with this error
Anonymous new View.OnClickListener() can be replaced with lambda
button_copy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String scanned_text = textview_data.getText().toString();
copyToClipBoard(scanned_text);
}
});
CodePudding user response:
Can anyone help me with this error
As noted in the comments it is NOT an error. It is style advice provided by your IDE (I guess).
You could ignore it, and there are probably IDE-specific settings to selectively turn off this kind of message. But it is easy to just follow the IDE's suggestion and replace the anonymous class with a lambda; e.g.
button_copy.setOnClickListener(
v -> copyToClipBoard(textview_data.getText().toString());