Androi 报错:android.content.res.Resources$NotFoundException: String resource ID #0x0

Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0

错误原因:在setText()中使用了int型的参数

pay.setText(getString(R.string.dollar)+getIntent().getIntExtra("Amount",0));

发现即使使用了getString也会出现这种情况,所以修改添加

 pay.setText(getString(R.string.dollar)+""+getIntent().getIntExtra("Amount",0));

或者

pay.setText(getString(R.string.dollar)+String.valueOf(getIntent().getIntExtra("Amount",0)));

 


版权声明:本文为qq_35988274原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。