How to pause the activity?
<p>I want to pause the "Event Thread"/ activity as soon as the user does some action(long click for example), and unpause it when user does some other action(simple click). The problem is, after i do a long click, The event thread goes in the waiting queue. SO when a do a simple click, that is not intercepted. How do I achieve this? please note, i do not want to pause the activity by showing some progress dialog etc., i want to retain my activity in foreground and get paused.here is what i have tried :/</p>

<pre><code> final Thread t = new Thread(new Runnable() {

            @Override
            public void run() {
                 synchronized(this){    
                     try {
                         this.notify();
                         } catch (Exception e) {
                    e.printStackTrace();
                }
                 }
            }
        });
      vg.setOnLongClickListener(new View.OnLongClickListener() {

        @Override
        public boolean onLongClick(View v) {
            try {
                 synchronized(this){    
                     this.wait();
                     }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            return true;
        }
    });
      vg.setOnClickListener(new View.OnClickListener() {


        @Override
        public  void onClick(View v) {
             synchronized(this){    
                 t.start();}
        }

    });
</code></pre>
