title: simulate touch events on Android
body: <p>I want to simulate a touch event on my own application.
  Although this question has been asked before, I would like to simulate touch on my own application.</p>
  <p>When I use these codes, my application crashes. I don't know where the problem is.
  MainActivity:
  <a href="https://justpaste.it/7g7ct" rel="nofollow noreferrer">https://justpaste.it/7g7ct</a></p>
  <p>And MyService:
  <a href="https://justpaste.it/2uury" rel="nofollow noreferrer">https://justpaste.it/2uury</a></p>
  <p>MainActivity:</p>
  <pre><code>package com.example.myapplicationdffghgh;
  
  import androidx.appcompat.app.AppCompatActivity;
  
  import android.accessibilityservice.AccessibilityService;
  import android.content.Intent;
  import android.os.Bundle;
  import android.os.IBinder;
  import android.os.SystemClock;
  import android.util.Log;
  import android.view.MotionEvent;
  import android.view.View;
  import android.widget.Button;
  import android.widget.RelativeLayout;
  import android.widget.Toast;
  
  import java.nio.file.Path;
  
  public class MainActivity extends AppCompatActivity {
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          Intent serviceIntent = new Intent(this, GestureDescription.class);
          startService(serviceIntent);
  
          GestureDescription.createClick(581,1044);
  
  
      }
  
  
  
  
     
  
  
  }
  </code></pre>