Refresh The fragment on download complete in android -
i want refresh or restart fragment when download completes (download manager) code must inside fragment class.
i used broadcast receiver restart fragment on download complete. code doesnt work. myfragment.java
broadcastreceiver oncomplete=new broadcastreceiver() { public void onreceive(context ctxt, intent intent) { toast.maketext(getactivity(), "download complete", toast.length_long).show(); getactivity().getsupportfragmentmanager().begintransaction() .detach(gettargetfragment()) .attach(gettargetfragment()).commit(); } }; getactivity().registerreceiver(oncomplete, new intentfilter(downloadmanager.action_download_complete));
use async task download. check below link on how refresh or restart fragment. refresh fragment @ reload
Comments
Post a Comment