I tired this bit of code:
Toast toast = new Toast(this);
toast.setText("Please enter your User-Id");
toast.setGravity(Gravity.CENTER, 0, 0);
toast.setDuration(Toast.LENGTH_LONG);
toast.show();
But still the toast is getting displayed at the bottom which is the default. Even this below one is also not working:
toast.setGravity(Gravity.TOP|Gravity.LEFT, 0, 0);
Please help.
Regards,
You should NOT use the constructor of the Toast class.
Do the following: