No package identifier when getting value for resource number 0x0000001c

Android为textView设置setText的时候报错的讲解方案 在对中TextView setText 覆值int 时报错,网上查下原因是setText整型表明是设值R.id.xxx,当然找不到。 解决方法是将int转化为string,用String.valueOf(xxx) 一、我的代码如下:就是我textView设置值 if (list != null) { for (Student stu : list) { //如果一下子赋值的话是不正确的 tv_name.setText(stu.getName()); tv_sex.setText(stu.getSex()); tv_age.setText(stu.getAg 立即下载

 

 W/ResourceType(2411): No package identifier when getting value for resource number 0x0000001c
 W/System.err(2411): android.content.res.Resources$NotFoundException: String resource ID #0x1c

错误位置示例代码:

 int percent = current * 100 / total;
textView1.setText(percent);


原因分析:

主要原因是TextView的setText方法把传入的int类型的percent当做资源Id到项目中查询资源,而资源中却找不到相应的数值,就会报NotFoundException的错误。

在Android中利用id来索引资源的地方很多(如:Toast.makeText()等),所以如果不小心往方法中传入int类型的参数,虽然编译时IDE不会报错,但是运行时,很容易因找不到对应的资源而报错。


解决办法:

所以如果要在TextView中显示int类型的数据,应提前转换成字符串类型。转换方法很多,最简单的就是在int类型数据后加上一个空字符串,如:

textView1.setText(percent+"");

【AAAI 2025】轻量级特征增强新范式!FCM 模块助力小目标检测,即插即用提升模型泛化能力 本文介绍了AAAI 2025提出的轻量级特征增强新范式FCM模块,它通过显式分离并双向交互语义与空间特征,有效解决了小目标检测中特征信息失配的核心难题。该模块设计精巧,计算开销极低,能够即插即用式地嵌入YOLO等主流检测网络,显著提升模型对小目标的泛化检测能力,尤其适用于遥感、自动驾驶等对计算资源敏感的实际场景。 阅读详情

相关推荐

Python爬虫实战:用BeautifulSoup和Pandas轻松抓取去哪儿网景点数据(附完整代码)

本文详细介绍了如何使用Python的BeautifulSoup和Pandas库构建一个高效的旅游数据爬虫,从去哪儿网抓取景点数据。内容涵盖环境准备、网页结构分析、核心代码实现、反爬策略以及数据清洗与存储,提供完整代码示例,帮助开发者快速掌握数据采集技术。

river的博客 357

Android错误:W/ResourceType(2411): No package identifier when getting value for resource number 0x

报错信息: 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$NotFound

ImKing 2万+

Python+Seaborn可视化:双因素方差分析结果这样呈现更专业

本文详细介绍了如何利用Python中的Seaborn和statsmodels库,专业地执行并可视化双因素方差分析结果。通过模拟实验数据,演示了从模型构建、统计检验(包括交互作用分析)到诊断验证的全流程。重点展示了如何使用Seaborn绘制交互效应图、组合分布图及热图,将复杂的统计结果转化为直观、富有洞察力的可视化图表,助力科研论文与商业报告的专业呈现。

weixin_29274969的博客 137

Android setText()函数传入Int类型参数分析

setText()之类函数参数为string,如果传入Integer类型数据,会对资源进行搜索,并返回无该id资源错误,所以解决的方法只有一个就是设置setText(string) 上述string参数就有两种方式来输入, 方法1: setText(R.string.*),通过SourceID的方式定位到string,然后传入 方法2:把int类型强制转换成string类型 1)setText(int+"") 2)setText(String.valueOf(int)) ...

kepengs的博客 3825

LVI-SAM实战:如何在Ubuntu20.04上快速复现激光-视觉-惯性里程计系统

本文详细解析了在Ubuntu 20.04环境下部署和优化LVI-SAM激光-视觉-惯性里程计系统的全流程。从环境配置、依赖安装到源码编译和实战调参,提供了完整的解决方案和性能优化策略,帮助开发者快速实现厘米级精度的实时位姿估计。

m3n5b7v8c9x的博客 1047

Windows 10下三菱PLC控件安装报错Error Number:-119的终极解决方案(附详细步骤)

本文针对Windows 10系统安装三菱PLC控件时常见的Error Number:-119报错,提供了深度分析与终极解决方案。文章剖析了该错误源于oleaut32.dll文件版本冲突,并详细介绍了通过设置兼容性模式、手动注册DLL、直接安装MX Component以及高级系统修复等多种方法,帮助用户彻底解决此安装难题,顺利搭建PLC开发环境。

weixin_29289821的博客 334

No package identifier when getting value for resource number

这种错误一般是因为我们使用类似TextView的SetText()或者其他填充参数的方法时,我们引入的参数为int类型,这个时候,方法会将int类型的参数当做资源id去搜索并填充,显然,资源id不是我们想要的结果,就会报错。 在这里,我们可以将int类型转换为String类型即可。

c814684904的专栏 1165

WGCNA加权基因共表达网络分析(1)简介、原理

WGCNA简介 WGCNA(Weighted Gene Co-Expression Network Analysis, 加权基因共表达网络分析),鉴定表达模式相似的基因集合(module),解析基因集合与样品表型之间的联系,绘制基因集合之间的调控网络并鉴定关键调控基因 WGCNA适用于复杂的转录组数据(样本数目较多) 研究不同器官/组织类型和不同阶段的发育调控、生物和非生物胁迫的不同时间响应机制 WGCNA原理 原理概要 1.构建基因共表达网络:先构建基因共表达网络,通常利用两两基因之间的表达模式来计算

qq_44520665的博客 3万+

setText参数如果是int类型,一定要在最后加上 +"",否则报错

今天在做类似QQ列表功能,在获取每个组的人数时,一开始写成holder.childCount.setText(mDataChild.get(groupPosition).size());后来调试时报错,说资源找不到,我以为是获取每个组人数的代码不对,然后就各种移动位置,尝试其他获取方式,最后发现setText的参数应该是String类型,而我传给的int类型,花了老娘快2个小时,哎,真心伤不起啊。

u010477502的专栏 3499

ubuntu虚拟机搭建OP-TEE

在网上找了一些搭建OP-TEE的过程,模仿着进行搭建,结果有好多报错,为了方便自己以后重新搭建,所以将整个过程记录下来。

weixin_44213847的博客 1001

R语言实战应用精讲50篇(二)-多重线性回归系列之稳健回归

前言 线性回归的参数估计主要采用的是最小二乘法(又称最小平方法),该法是将使观测值与模型预测值之差的平方达到最小的值作为参数估计值。如果数据存在异常点或者异方差,最小二乘法估计会存在偏差,常用的处理策略就是改用稳健回归(Robust Regression)。 稳健回归就是采用更为稳健的参数估计方法来拟合模型,所谓稳健就是数据的波动对参数估计影响不大,比如不受异常值影响,或删除某一观测后对结果影响不大。稳健估计的方法有很多,主要有这么几类:最小绝对值回归(也称最小一乘法回归,lAV),最小中位数二乘法(L

wenyusuran的专栏 3161

W/ResourceType: No package identifier when getting value for resource number 0x00000000

W/ResourceType: No package identifier when getting value for resource number 0x00000000 Toast.makeText(getApplicationContext(), 0, Toast.LENGTH_SHORT).show(); 第二个参数int resId 要么能在R.id.下面找到资源 要么直接是

zhao_liwei的博客 1591

节省人力成本40%!仓储物流AI机器人调度系统实战案例(含路径规划算法与系统架构图)

首先,我们需要定义一个Node类self.x = x # 节点x坐标self.y = y # 节点y坐标self.g = g # 从起点到当前节点的实际成本(g值)self.h = h # 从当前节点到终点的启发式成本(h值)self.f = g + h # 总成本(f值)self.parent = None # 父节点(用于回溯路径)self.task_id = task_id # 任务IDself.priority = priority # 任务优先级(1=最高,5=最低)

小程序开发 950

int类型的正负数转换

public static void main(String[] args) { System.out.println(-22 * (-1)); } 打印结果

qq_35785208的博客 1944

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

Android报错:No package identifier when getting value for resource number 0x00000003

错误提示信息: W/ResourceType(6991): No package identifier when getting value for resource number 0x00000003 W/dalvikvm(8564): threadid=1: thread exiting with uncaught exception (group=0x415f7498) 代码位置...

XuXin_的博客 646

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

a android.view.view.setbackgroundresource(int)' null object on referen void_android.view.View androi...

突然出现这样的错误Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference只在vivo 和乐视手机出现这种情况,以为是机型问题。追查原因发现...

weixin_34378888的博客 327

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

No package identifier when getting value for resource number 0x00000000

我在代码动态添加button控件时,设置文字的时候写成btn.setText(i); 因为i是int类型的数字,所以报错No package identifier when getting value for resource number 0x00000000 改成btn.setText(i+“”); 后才正常运行。 网上找的原因: 在Android中利用id来索引资源的地

678

android TextView类setText()方法显示数字

当让一个textview对象显示的内容为数字时,要注意不要直接把int类型作为参数直接带入方法,因为textview类有重载方法setText(int resid),将int作为参数的方法实际上是另一个方法,该方法把参数作为string资源的id去获取string资源。 显示文本的方法为: public final void setText(CharSequence text) {    

7402

TextView使用技术点(一)

TextView作为开发时候显示最常用的控件之一,我们使用的频率是非常高的,但是我们平时的使用都是怎么使用的那些相关的属性和方法呢? 内容:setText() 字体:TextSize、TextColor 宽度和高度:width、weigth 边距:margin、padding 背景:background ...... 常用的基本也就这些吧。 虽然基本都用,但是我们真的了解这些属性和...

android开发笔记 1011

解决 android.content.res.Resources$NotFoundException: Resource ID #0xfffffe6c 错误

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33842328的博客 5466

数据类型TextView中添入int型的错误

android 在做项目中,我们误把 int变量 TextView.setText(一个int变量) 会出现错误,编译不会出现 当把int转成字符串的形式 String.valueOf(int) 就可以实现了 在做myadapter中经常会遇到,要认真对待

lyq563874257的博客 761

QT在多行文本框中显示int型数据

使用多行文本框不能直接显示int型数据,需显示int数据必须将其转化为QString格式,有以下两种方法 方法一,使用中间变量(不可以放在长句中) int a ; QString s = QString("%1").arg(a); ui→textdisplay→appendPlainText(s); 方法二,直接转化(这个方法也可以写中间变量) int a; ui→textdisplay→appendPlainText(QString::number(a)); ...

weixin_41574255的博客 2838

TextView里的setText方法

TextView里的setText方法支持以下多态构造方法:public final void setText(CharSequence text)public final void setText(int resid)public void setText(CharSequence text, TextView.BufferType type)public final void setText(int resid, TextView.BufferType type)public final voi

Vincent_czz的专栏 1万+

andriod使用setText()对象传入int会被识别十六进制

2,解决:应该提前将这个int值转换成字符串类型。转换的方法有很多,最简单的一种是在int类型的数据后面加上一个空字符串,这样编译器就会自动将其转换为字符串类型,从而避免上述错误。方法在处理int类型的参数时,会将这个int值当作资源ID来处理。如果这个int值代表的资源在项目中不存在,就会引发。来确保传入的参数被正确处理‌1。

m0_63853518的博客 378

textview的settext

TextView setText有2个方法: final void setText(int resid) final void setText(CharSequence text) 接受int型的参数时,调用的是第一个方法,系统会去R文件里面找int值匹配的String值

hudie86555的专栏 703

微信支付 拉取支付失败 返回-1 解决办法

Android 微信支付统一下单成功,成功返回prepayid,启动支付, 拉取支付页面失败,直接调用回调页面,返回错误码-1

shaaiwei521的专栏 2万+
上一篇: Android————————Handler
下一篇: Android 设置dialog 的大小
shaaiwei521
博客等级 码龄14年 3粉丝 23原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值