title: Android Download File from webserver using Volley
body: <p>Sorry I am a newbie with Android developing an app which sell digital downloads. I am using Volley Library to post INAPP_PURCHASE_DATA and INAPP_DATA_SIGNATURE to webserver to verify order and issue download link passing</p>
  
  <pre><code>http://domain.com/thankyou.php?purchaseData="+purchaseData+"&amp;dataSignature="+dataSignature+"
  </code></pre>
  
  <p>If the order is verified a download link will be issued inside the page.  The file name isn't static which means it's auto-generate by system so I can't guess the name each time issued from the server side. Can be file1.dat file2.dat file3.dat each time has a name depending on certain parameters I defined into the webserver.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Thank You&lt;/title&gt;
  &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;a href="http://domain.com/file.dat" title="Order" download&gt;Download File&lt;/a&gt;   
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Now I need to post the download file link to the app so the customer can download the file.</p>
  
  <pre><code>    StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
                              new Response.Listener&lt;String&gt;() {
  
                                  @Override
                                  public void onResponse(String response) {
  
  //download file on through a new in-app page
  Toast.makeText(MainActivity.this,response,Toast.LENGTH_LONG).show();
                                  }
                              },
                              new Response.ErrorListener() {
                                  @Override
                                  public void onErrorResponse(VolleyError error) {
                                      Toast.makeText(MainActivity.this,error.toString(),Toast.LENGTH_LONG).show();
                                  }
                              })
  </code></pre>
  
  <p>I have created an <code>activity_download.xml</code> file and a new Download Class.</p>
  
  <pre><code>package com.example.app;
  
  import java.util.List;
  
  import android.app.Activity;
  import android.net.Uri;
  import android.os.Bundle;
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  import com.example.app.R;
  
  import android.app.ProgressDialog;
  import android.content.Intent;
  
  import android.util.Log;
  import android.view.View;
  import android.widget.Button;
  import android.widget.TextView;
  import android.widget.Toast;
  
  public class Download extends Activity {
  
  private String filename;
  
  @Override
  protected void onCreate (final Bundle savedInstanceState) {
      super.onCreate (savedInstanceState);
      setContentView(R.layout.activity_download);
      }
  }
  
  }
  </code></pre>
  
  <p>Sorry again I am a newbie with Android. Can you guide me a provide me with a way to have a complete Download.java class as a new page and then call it from the MainActivity.java side onresponse and successful result.</p>
  
  <p>Thank you so much!</p>