开发者

ContentURI cannot be resolved to a type

I am trying to follow an eclipse and android tutorial from ibm.

The source code from the tutorial is giving me an error that says ContentURI cannot be resolved to a type..

here is the source code line...

ContentURI theContact = new ContentURI(android.provider.Contacts.ContactMethods.CONTENT_URI.toURI());

eclipse wanted me to fix it by either creating a class an interface or changing it to ContentUris

I tried the last one w/no luck so开发者_JS百科 was looking for some advice.


ContentURI was replaced back around Android 0.9, about 18 months ago. Check the age of your tutorial -- it is probably from the summer of 2008 and is now out of date.


The class ContentUri was replaced with the Uri class.

I would change that line to be:

Uri theContact = android.provider.Contacts.ContactMethods.CONTENT_URI;

Or find a more up-to-date tutorial, as the one you are looking at is probably going to have other out-of-date references.


The Contacts.ContactMethods class is deprecated. Have you tried ContactsContract?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜