Code example for URL

Methods: getFile

    public DownloadTask(Context context,
	    String url, String path, DownloadTaskListener listener) throws MalformedURLException {
	this.url = url;
	this.URL = new URL(url);
	this.listener = listener;
	String fileName = new File(URL.getFile()).getName();
	this.file = new File(path, fileName);
	this.context = context;
    public String getUrl() {
	return url;
    public long getDownloadPercent() { 
	return downloadPercent;
Connect your IDE to all the code out there  Get Codota for Java