you will need to register an BroadcastReceiver
for DownloadManager.ACTION_DOWNLOAD_COMPLETE
Action and enable button when download complete Action fire from Downloadnamager as:
findViewById(R.id.play).setEnabled(false); //<< disable button here
DownloadManager mgr=(DownloadManager)getSystemService(DOWNLOAD_SERVICE);
registerReceiver(onComplete,
new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
BroadcastReceiver onComplete=new BroadcastReceiver() {
public void onReceive(Context ctxt, Intent intent) {
findViewById(R.id.play).setEnabled(true); //<< enable button here
}
};
you can see this example for enable/disable button when download complete :