findViewById(android.R.id.progress) returns null

三世轮回 提交于 2019-12-05 05:58:43

The R.id.progress built-in tag is designed for the ProgressBar class. If you do not have a ProgressBar object or a ProgressBar in your XML, then it will return null.

EDITED

Sorry, I must have counted it up wrong. that's what I get for not pasting. Either way, is there a reason you don't just use one of ProgressBar's constructors? Here's the line from the latest project I used a bar in:

mProgress = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);

android.R.id.progress is used in conjunction with the ProgressBar.

Check this link: http://foo.jasonhudgins.com/2010/03/simple-progressbar-tutorial.html

your usage is thus wrong.

Ankitkumar Makwana

From Eclipse, perform a project clean by clicking on 'Project' > 'Clean...', click on the checkbox beside your project, and click 'Ok'. And try building your project again.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!