title: Android: Multiple buttons continuously tapped using Timertask/timer
body: <p>This Braille app I am making has 6 different buttons that I would like to have every unique combination bring me different letters. For example: I would like hitting button 1 to simple bring me the letter "A". Then hitting button 1 and button 2 continuously brings me the letter "C". I want every different button combination of these 6 buttons to bring me a seperate letter.</p>
  
  <p>The problem with my code is that when I tried clicking buttons "the app automatically stopped and exit" So I was wondering what's wrong with my timer code? And did the <code>map</code> inside the <code>processInput()</code> is good?</p>
  
  <p>My other post (reference): <a href="https://stackoverflow.com/questions/41514223/android-tapping-one-to-six-buttons-continuously-one-after-another-to-string-t">here</a></p>
  
  <p>My <code>onClick</code> code:</p>
  
  <pre><code>        @Override
      public void onClick(View v) {
  
          final Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
  
  
          Timer processTimer = new Timer();
          processTimer.schedule(new TimerTask() {
              public void run() {    
                  processInput();    
              }
  
              private void processInput() {
                  // TODO Auto-generated method stub
                  map.put(getString(R.id.block1), "A");
                  map.put(getString(R.id.block1) + getString(R.id.block2), "C");
  
  
  
              }
          }, 500); // Delay before processing. 
  
      processTimer.cancel();
  
      processTimer.schedule(new TimerTask() {
              public void run() {    
                  processInput();    
              }
  
              private void processInput() {
                  // TODO Auto-generated method stub
                  map.get(R.id.block1);
                  map.get(R.id.block1+R.id.block2);
                  //this.close();
  
  
              }
          }, 500);
  }
  </code></pre>
  
  <p>Logcat: </p>
  
  <pre><code>01-13 03:47:55.578: E/AndroidRuntime(31053): FATAL EXCEPTION: main
  01-13 03:47:55.578: E/AndroidRuntime(31053): Process: info.androidhive.speechtotext, PID: 31053
  01-13 03:47:55.578: E/AndroidRuntime(31053): java.lang.IllegalStateException: Timer was canceled
  01-13 03:47:55.578: E/AndroidRuntime(31053):    at java.util.Timer.scheduleImpl(Timer.java:558)
  01-13 03:47:55.578: E/AndroidRuntime(31053):    at java.util.Timer.schedule(Timer.java:456)
  01-13 03:47:55.578: E/AndroidRuntime(31053):    at info.androidhive.speechtotext.Braillekeyboard.onClick(Braillekeyboard.java:305)
  01-13 03:47:55.578: E/AndroidRuntime(31053):    at android.view.View.performClick(View.java:4781)
  01-13 03:47:55.578: E/AndroidRuntime(31053):    at android.view.View$PerformClick.run(View.java:19900)
  01-13 03:47:55.578: E/AndroidRuntime(31053):    at android.os.Handler.handleCallback(Handler.java:739)
  01-13 03:47:55.578: E/AndroidRuntime(31053):    at android.os.Handler.dispatchMessage(Handler.java:95)
  01-13 03:47:55.578: E/AndroidRuntime(31053):    at android.os.Looper.loop(Looper.java:159)
  01-13 03:47:55.578: E/AndroidRuntime(31053):    at android.app.ActivityThread.main(ActivityThread.java:5461)
  01-13 03:47:55.578: E/AndroidRuntime(31053):    at java.lang.reflect.Method.invoke(Native Method)
  01-13 03:47:55.578: E/AndroidRuntime(31053):    at java.lang.reflect.Method.invoke(Method.java:372)
  01-13 03:47:55.578: E/AndroidRuntime(31053):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
  01-13 03:47:55.578: E/AndroidRuntime(31053):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)
  </code></pre>