How to know if my code is spaghetti or not?
Is this is spaghetti code?
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
((Core) getActivity()).emailCore();
((Core) getActivity()).messengerSharer();
} catch (NumberFormatException e) {
e.printStackTrace();
Toast.makeText(getActivity(),
R.string.text_field_toast, Toast.LENGTH_SHORT)
.show();
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(getActivity(),
R.string.text_field_toast, Toast.LENGTH_SHORT)
.show();
} catch (OutOfMemoryError error) {
error.printStackTrace();
Toast.makeText(getActivity(),
Html.fromHtml(getString(R.string.html_toast)), Toast.LENGTH_LONG)
.show();
} catch (Error e) {
e.printStackTrace();
Toast.makeText(getActivity(),
R.string.text_field_toast, Toast.LENGTH_SHORT)
.show();
}
}
});
And how to write clean and good java code?