Android Error: W/resourcetype (2411): No package identifier if getting value for resource number 0x

Source: Internet
Author: User

Error message:

07-04 11:14:43.064:w/resourcetype (2411): No package identifier when getting value for resource number 0x0000001c
07-04 11:14:43.064:w/system.err (2411): android.content.res.resources$notfoundexception:string resource ID #0x1c

Error Location Sample code:

int percent = current * 100/total;
Textview1.settext (percent);

Cause Analysis:

The main reason is that the SetText method of TextView the input int type percent as the resource ID to the project query resource, but the resource can not find the corresponding value, will be reported notfoundexception error.

There are many places in the android that use ID to index resources (such as: Toast.maketext (), etc.), so if you accidentally pass an int type parameter to the method, although the IDE does not make an error at compile time, it is easy to get an error when the corresponding resource is not found in the runtime.

Workaround:

So if you want to display data of type int in TextView, you should convert it to a string type in advance. There are many conversion methods, the simplest of which is to add an empty string after the int type data, such as:

Textview1.settext (percent+ "");

Reference: http://blog.csdn.net/wangfayinn/article/details/7716165

Android Error: W/resourcetype (2411): No package identifier if getting value for resource number 0x

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.