我是android的新手,我知道这个问题已被提出但我无法得到满意的解释.我的怀疑是:
我希望问题很清楚,如果不是,请在评论中说明.
我有一个ListView,其中每个项目代表一个PDF文件.当用户单击某个项目时,该应用程序必须在外部存储上下载该文件.现在下载无法正常运行,但这不是问题.我想要一个ProgressBar,旋转轮样式,在下载文件时出现在列表的每个项目旁边.
我的问题是:我找不到如何使纺车出现.在下载管理器之前,我尝试使用AsyncTask并且旋转轮工作.
这是我的代码:
CategoryActivity.java(ListView的活动)
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// Récupère les valeurs depuis ListItem
udl = ((TextView) view.findViewById(R.id.udl)).getText().toString();
// This is the spinning wheel
loader = ((ProgressBar) view.findViewById(R.id.spinWheel2));
filepath = dirpath + udl + ".pdf";
File file = new File(filepath);
if (file.exists()) {
// If the file exists, I open it
}else{ // Else I download it
// Setting the spinning wheel to VISIBLE
loader.setVisibility(View.VISIBLE);
SharedPreferences codeSaveUrl = getSharedPreferences(PREFS_TEXT,Context.MODE_PRIVATE);
url2 = codeSaveUrl.getString("defaut", …Run Code Online (Sandbox Code Playgroud) android download-manager android-listview android-progressbar android-download-manager