title: E/Toast: setGravity() shouldn't be called on text toasts, the values won't be used
body: <p>I'm watching a lecture, but I got stuck in a place called &quot;Showing the toast location.&quot;</p>
  <p>If you enter the left (X coordinate) and right (Y coordinate) in the equation, the toast position is</p>
  <p>They fly accordingly,</p>
  <p><a href="https://i.stack.imgur.com/0Atwy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0Atwy.png" alt="enter image description here" /></a></p>
  <p>The purpose is to make it this way,</p>
  <p><a href="https://i.stack.imgur.com/6JWCk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6JWCk.png" alt="enter image description here" /></a></p>
  <p>I entered the code as it was, and whatever value I entered</p>
  <p>It only appears below.</p>
  <p>Looking at the log</p>
  <p>E/Toast: setGravity() shouldn't be called on text toast and no value is used.</p>
  <p>I get this error, but I don't know what to do.</p>
  <p>Help me, seniors...</p>
  <p>MainActivity.java above is like this</p>
  <p>The xml below is like that.</p>
  <pre><code>public class MainActivity extends AppCompatActivity {
      EditText editText;
      EditText editText2;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          editText = findViewById(R.id.editText);
          editText2 = findViewById(R.id.editText2);
      }
  
      public void onButton1Clicked(View v) {
          try {
              Toast toastView = Toast.makeText(this, &quot;위치가 바뀐 토스트 메시지입니다.&quot;,
                      Toast.LENGTH_LONG); 
              int xOffset = Integer.parseInt(editText.getText().toString()); 
  
              int yOffset = Integer.parseInt(editText2.getText().toString());
  
              toastView.setGravity(Gravity.TOP, xOffset, yOffset);
              toastView.show();
          } catch (NumberFormatException e) { 
              e.printStackTrace();
  
  
  
  
  &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.MainActivity&quot;&gt;
      &lt;LinearLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:orientation=&quot;horizontal&quot;&gt;
          &lt;EditText
              android:id=&quot;@+id/editText&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_weight=&quot;1&quot;
              android:textSize=&quot;20sp&quot;
              android:hint=&quot;X 위치&quot;
              android:inputType=&quot;numberSigned&quot; /&gt;
          &lt;EditText
              android:id=&quot;@+id/editText2&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_weight=&quot;1&quot;
              android:textSize=&quot;20sp&quot;
              android:hint=&quot;Y 위치&quot;
              android:inputType=&quot;numberSigned&quot;
              /&gt;
          &lt;Button
              android:id=&quot;@+id/button&quot;
              android:layout_width=&quot;0dp&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_weight=&quot;1&quot;
              android:text=&quot;띄우기&quot;
              android:textSize=&quot;20sp&quot;
              android:onClick=&quot;onButton1Clicked&quot;/&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>