I want to use this in lots of places in my code and there will be a lot of repetition, but my knowledge in java is not sufficient enough to make this work.
Toast myToast = Toast.makeText(net.asdqwe.activities.Signup.this, configurationz.ERROR_MESSAGES_SIGNUP_USER_NAME_MIN_LENGTH_PROBLEM, Toast.LENGTH_SHORT);
myToast.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL, 0, 0);
TextView tv = (TextView) myToast.getView().findViewById(android.R.id.message);
tv.setTextColor(Color.parseColor(configurationz.COLORS_TOAST_TEXT_COLOR));
tv.setTextSize(20);
myToast.getView().setBackgroundColor(Color.parseColor(configurationz.COLORS_TOAST_BACKGROUND));
myToast.show();
I wanna be able to use it this way:
ToastMaker(short duration (//or long), configurationz.ERROR_MESSAGE (//of my choice), configurationz.COLORS_TOAST_TEXT_COLOR(//or some other variable), configurationz.COLORS_TOAST_BACKGROUND_COLOR(//or some other variable), 30(//text size), gravity)
something like this
ToastMaker(length, errorMessage, textColor, backgroundColor, textSize, gravity)
the one thing that concerns me the most is that the following piece of code is going to change for every class, and I do not know how to obtain that dynamically
net.asdqwe.activities.Signup.this
Actually I can make the text color, size and background a general setting for the entire app (which makes sense), so we are left with this:
ToastMaker(length, errorMessage, gravity)
as the final desired result
EDIT: I've answered my question with the working code, that I generated after reading all the answers