07-25 10:15:37.960: E/AndroidRuntime(8661): android.content.res.Resources$NotFoundException: String resource ID
Good day to everyone.
I am trying to show an integer value in a text representation and the above error appears in LogCat.
There are other similar reports about this problem; for example, and, but none of the solutions worked for me.
Any other ideas on what might be the issue?
Edited for code:
private static Button btnCancel; private static Button btnConfirm; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); txtRoomNumber = (EditText)findViewById(R.id.txtRoomNumber); btnCancel = (Button)findViewById(R.id.btnCancel); btnConfirm = (Button)findViewById(R.id.btnConfirm); btnCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); System.exit(0); } }); btnConfirm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int rmNo = getRoomNumberValue(); txtTesting.setText(rmNo); } }); } private int getRoomNumberValue() { int temp = 0; try { temp = Integer.parseInt(txtRoomNumber.getText().toString()); } catch(Exception e) { e.printStackTrace(); } return temp; }
source share