need permission
<uses-permission android:name="android.permission.INTERNET"/>
import android.annotation.SuppressLint; import android.app.DownloadManager; import android.content.Context; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity { Button down; DownloadManager downloadManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); down = (Button)findViewById(R.id.downloadFile); down.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { downloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); Uri uri = Uri.parse("http://mandsit.com/amirul/assets/just/just_result.pdf"); DownloadManager.Request request = new DownloadManager.Request(uri); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); Long reference = downloadManager.enqueue(request); } }); } }<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.edupointbd.amirul.myapplication.MainActivity"> <Button android:text="donload file" android:id="@+id/downloadFile" android:layout_width="match_parent" android:layout_height="wrap_content" /> </RelativeLayout>