I have source code from https://awsrh.blogspot.com/2018/05/volley-glide-tutorial-send-data-and.html
I want to download pdf files, one by one from a server on a button click
Example
I have source code from https://awsrh.blogspot.com/2018/05/volley-glide-tutorial-send-data-and.html
I want to download pdf files, one by one from a server on a button click
Example
So first you need a normal Button[do this in yourlayoutfile.yml]
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_test"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="198dp"
android:text="Download" />
</RelativeLayout>
Now set a OnClickListener at your Button in youre Activity:
public class MainActivity extends AppCompatActivity {
private Button downloadButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
downloadButton= (Button) findViewById(R.id.button);
downloadButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
downloadFile();
}
});
}
public void downloadFile() {
//Here put-in youre download stuff
//so download the file from your server
}
}
here is the SO Thread for downloading with progress : Download a file with Android, and showing the progress in a ProgressDialog
and here is another SO Thread for download via android's download manager : Download Files Using download manager
all you need is for loop now :)