Calling a non static method from a static Handler in Android
<p>I've been googling this day and I can't find a simple solution that answers my question.  I have the Lint warning "This Handler class should be static or leaks might occur" So I follow the logic as proposed by Romain Guy and many others and constructed my Handler as follows..</p>

<pre><code>public static class MyHandler extends Handler {
    private final WeakReference&lt;CustomTrophyCreateActivity&gt; mActivity;

    MyHandler(CustomTrophyCreateActivity activity) {
        mActivity = new WeakReference&lt;CustomTrophyCreateActivity&gt;(activity);
    }

    @Override
    public void handleMessage(Message msg) {

    if (mActivity != null) {
    Activity activity = mActivity.get();
        if (activity != null) {
            // Call non static method in enclosing activity.. CANT DO THIS
            startUploadPhoto();
        }
    }           
}
</code></pre>

<p>So the basic question is.. how to I call this non-static method from a Handler that has been made static to avoid memory leaks??</p>

<p>I really would like to avoid making startUploadPhoto() static, because 1) It doesn't need to be and 2) It would require a lot of work changing variables.  I fully understand why this lint warning is popping up.. I just can't seem to find a simple solution to rid myself of it.  Thank you.  </p>
