findViewById(R.id.progressbar) and static hell:
<p>clipProgress resets a progress bar to zero:</p>

<pre><code>public class Whatever extends Activity implements ListenerA, ListenerB {
        private Handler mHandler = new Handler();

        ProgressBar myProgressBar;  
        int myProgress = 0;  

        public void clipProgress() {
            myProgressBar = (ProgressBar)findViewById(R.id.progressbar);  
            myProgressBar.setProgress(myProgress);  
        }

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);

            clipProgress();

            public void onClick(View view) {
                Duration.duration = 0;
                startRecording();

                new Thread(new Runnable(){  
                    @Override  
                    public void run() {  
                        while(myProgress&lt;100){  
                            try{  
                                myHandle.sendMessage(myHandle.obtainMessage());  
                                Thread.sleep(50);  
                            }catch(Throwable t){  
                            }  
                        }  
                    }  
                }).start();  
            }

        Handler myHandle = new Handler(){  
            @Override  
            public void handleMessage(Message msg) {  
                myProgress++;  
                myProgressBar.setProgress(myProgress);  
            }  
        };
    });
}
</code></pre>

<hr>

<p>I have two different methods, below, where I suppose I could attempt to reset the progress bar to zero.  But they both reside in a different class entirely:</p>

<pre><code>@Override   protected void onPostExecute(Void result) {  
    Whatever.clipProgress();  //...which throws all kinds of red lines if I use this statement.
}
</code></pre>

<p>and</p>

<pre><code>public void stopThis(){
    thing.stop();
    try {
        Whatever.clipProgress();  //...which throws all kinds of red lines if I use this statement.

        dos.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
</code></pre>

<p>Eclipse wants to apply "static" to various initializations in the Whatever class.  But those fixes just leave findViewById(R.id.progressbar) redlined.</p>

<p>I just want to reset the progress bar (which was started from within class 1) from class 2.  It's too much to ask for.</p>

<p><strong>UPDATE:</strong>
Whatever is the starting point, the Android Activity.  Its handler, which I should have included in the above snip, right underneath onCreate is included in the snip below.  So more completely, and invoked from a button, is thus:</p>

<pre><code>        public void onClick(View view) {
            new Thread(new Runnable(){  
                @Override  
                public void run() {  
                    while(myProgress&lt;100){  
                        try{  
                            myHandle.sendMessage(myHandle.obtainMessage());  
                            Thread.sleep(87);  
                        }catch(Throwable t){  
                        }  
                    }  
                }  
            }).start();  
        }

        Handler myHandle = new Handler(){  
            @Override  
            public void handleMessage(Message msg) {  
                myProgress++;  
                myProgressBar.setProgress(myProgress);  
            }  
        };
</code></pre>

<p>Once that button is pressed a listener is produced:</p>

<pre><code>    myTask = new Task();
    myTask.addTaskListener(this);
    myTask.execute(this);
</code></pre>

<p>It is inside the Task class:</p>

<pre><code>public class Task extends AsyncTask&lt;Whatever, ArrayList&lt;Float&gt;, Void&gt;{
...
    public void addTaskListener(TaskListener rl){
        this.rl = rl;
    }
...
</code></pre>

<p>that those two functions reside, one of which I'm hoping to use to stop the progress bar.</p>

<p>A task is designed elsewhere to shut down at exactly a constant number of seconds, and so I can hardcode 50 into that progress bar value on the sleep().  I just want to be able to shut the bar down back to zero earlier if I stop the task earlier.</p>
