Reputation: 28786
I've formatted the following code in Android studio:
mSignUpButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
mValidator.validate();
}
}
);
The indentation of the OnClickListener is very deep. After looking at the code formatting settings, I couldn't find a way to reduce it. Is there a way?
Upvotes: 0
Views: 460
Reputation: 533820
This is how I would indent it with IntelliJ. This uses less lines. This is using the default code formatting settings in IntelliJ
mSignUpButton.setOnClickListener( // Note: I put the new on the next line.
new View.OnClickListener() {
@Override
public void onClick(View v) {
mValidator.validate();
}
}
);
This would be in Java 8,
mSignUpButton.setOnClickListener(mValidator::validate);
Upvotes: 2