title: Proper Way To Separate Class - Download Manager
body: <p><strong>Can I separate <code>DownloadManager</code> in a separate <code>class</code>?</strong> I want to reused it in my several <code>class</code>. In <code>Volley</code> we can make a <code>class</code> extending <code>StringRequest</code> or <code>ImageRequest</code>. </p>
  
  <p>For example: </p>
  
  <pre><code>public class VolleyStringRequest extends StringRequest{
  
  public VolleyStringRequest(Response.Listenter&lt;String&gt; listener, 
                             Response.ErrorListener errorListener)
      {
          super(Method.POST, " " , listener, errorListener);
  
  
  
      } }
  </code></pre>
  
  <p>I came across with this <a href="http://www.codota.com/android/classes/android.app.DownloadManager" rel="nofollow">link</a>. All of it is directly declare. <strong>How can I achieve this in a separate <code>class</code> by extends <code>DownloadManager</code>?</strong></p>
  
  <pre><code>DownloadManager dm= (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
  DownloadManager.Request request = new DownloadManager.Request(Uri.parse("https://www.google.com.tw/images/srpr/logo4w.png"));
  dm.enqueue(request);
  
  DownloadManager dm= (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
  DownloadManager.Request request = new DownloadManager.Request(Uri.parse("https://www.google.com.tw/images/srpr/logo4w.png"));
  dm.enqueue(request);
  </code></pre>