title: Handling AsyncTask warning class should be static or leaks might occur
body: <p>I have created as asynctask to upload data to a server as below. But it shows this warning.
  This AsyncTask class should be static or leaks might occurs......
  I have read and tried the weak reference style but i cant be able to integrate in this code.
  How can I get rid of this warning in the code below?.</p>
  <pre><code> public void ImageUploadToServerFunction(){
          final String imageName1 = GetImageNameEditText1.trim();
          final String userName = GetUserName.trim();
          final String imageView1 = getStringImage1(bitmap1);
        
          class AsyncTaskUploadClass extends AsyncTask&lt;Void,Void,String&gt; {
              @Override
              protected void onPreExecute() {
                  super.onPreExecute();
                  progressDialog = ProgressDialog.show(UploadActivity.this,&quot;Your Data is Uploading....&quot;,false,false);
              }
              @Override
              protected void onPostExecute(String string1) {
                  super.onPostExecute(string1);
                  progressDialog.dismiss();
               }
              @Override
              protected String doInBackground(Void... params) {
                  ImageProcessClass imageProcessClass = new ImageProcessClass();
                  HashMap&lt;String,String&gt; HashMapParams = new HashMap&lt;&gt;();
                  HashMapParams.put(ImageName1, imageName1);
                  HashMapParams.put(UserName, userName);
                  HashMapParams.put(ImagePath1, imageView1);
                  return imageProcessClass.ImageHttpRequest(ServerUploadPath, HashMapParams);
              }
          }
          AsyncTaskUploadClass AsyncTaskUploadClassOBJ = new AsyncTaskUploadClass();
          AsyncTaskUploadClassOBJ.execute();
      }
  </code></pre>