Android: How to create a direct download link in android -


can give me idea on how create textview has link , when user click it, file link automatically downloaded device

edit:

here's code working on:

string link = "http://www.exampleurl.com/"+pref.getstring("fsfile" + count, null);     link = link.replaceall(" ", "%20");     fsfile.settext("attached file");     fsfile.setonclicklistener(new view.onclicklistener() {          @override         public void onclick(view v) {             // starting new async task             new downloadfilefromurl().execute(link);         }     });  

but seems string link not identified inside .setonclicklistener

thats quite easy http://developer.android.com/reference/android/app/downloadmanager.html

example: http://androidtrainningcenter.blogspot.co.at/2013/05/android-download-manager-example.html

and start method after clicking textview (catch handler or listener)

/**  * start download  */ public void startdownload() {     downloadmanager mmanager = (downloadmanager) getsystemservice(context.download_service);     request mrqrequest = new request(             uri.parse("http://androidtrainningcenter.blogspot.in/2012/11/android-webview-loading-custom-html-and.html"));     mrqrequest.setdescription("this test file"); //  mrqrequest.setdestinationuri(uri.parse("give local path"));     long iddownload=mmanager.enqueue(mrqrequest); } 

but sure min. on api 9


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -