title: Android simulate key press-2
body: <p><a href="https://stackoverflow.com/questions/8696489/android-simulate-key-press/8696700#8696700">Android simulate key press</a> ; I want to apply this answer to my app which when call activity was started number pressed itself but I have problem with these , how can I fix it I cannot find ,If there exist please share link .</p>
  
  <pre><code>Intent i = new Intent(Intent.ACTION_CALL);
              i.setData(Uri.parse("tel:090"));
              startActivity(i);
  new Thread(new Runnable() {         
          @Override
          public void run() {
              try {
              Instrumentation inst = new Instrumentation();
              for ( int i = 0; i &lt; 10; ++i ) {
                  inst.sendKeyDownUpSync(KeyEvent.KEYCODE_1);
                  Thread.sleep(2000);
                  inst.sendKeyDownUpSync(KeyEvent.KEYCODE_2);
                  Thread.sleep(2000);
              }
              }
              catch(InterruptedException e){
              }
          }   
      }).start();
  </code></pre>