JAva Android show toast

You can change this position with the setGravity(int, int, int) method. This accepts three parameters: a Gravity constant, an x-position offset, and a y-position offset. For example, if you decide that the toast should appear in the top-left corner, you can set the gravity like this: toast.

 

Toast testToast = Toast.makeText(this, "Your Message Here", Toast.LENGTH_LONG);
testToast.show();