这是我在活动中使用的代码。
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {
// get the DownloadManager instance
DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
DownloadManager.Query q = new DownloadManager.Query();
Cursor c = manager.query(q);
if(c.moveToFirst()) {
do {
String name = c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_FILENAME));
Log.i("DOWNLOAD LISTENER", "file name: " + name);
} while (c.moveToNext());
} else {
Log.i("DOWNLOAD LISTENER", "empty cursor :(");
}
c.close();
}
}
在preExecute我正在使用
$('#cancel-feedback, #feedback-dialogs .icon-close, #feedbackCloseAfter').click(function (e) {
closeDialog();
});
在postexecute我正在使用
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(com.c2info.eDawa.R.layout.hll_layout);
AppController.logite("Activity", "HllActivity");
final Toolbar toolbar = (Toolbar) findViewById(com.c2info.eDawa.R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setIcon(R.mipmap.app_launcher);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(com.c2info.eDawa.R.menu.menu_hll, menu);
final MenuItem searchItem = menu.findItem(com.c2info.eDawa.R.id.action_search);
searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
if (searchView != null)
searchView.clearFocus();
return true;
}
@Override
public boolean onQueryTextChange(String newText) {
if (newText.length() > 2) {
getSearchData(newText); // this is the service
}
}
return false;
}
});
return super.onCreateOptionsMenu(menu);
}
但是进度条没有显示任何人都可以提供帮助。提前谢谢。