Save downloaded file using the External Storage (private)

view story

http://stackoverflow.com – this is my code to download a file and save it in the internal storage: public class getResults extends AsyncTask<String, Void, String>{ @Override protected String doInBackground(String... params){ String fileName = "results"+month+year+".pdf"; URLConnection conn; try { URL url = new URL(params[0]); conn = url.openConnection(); int contentLength = conn.getContentLength(); DataInputStream in = new DataInputStream(conn.getInputStream()); byte[] buffer = new byte[contentLength]; in.read (HowTos)