title: ResourceNotFoundException in textview android
body: <p>Hello I'm quite new to Android. I developed a calculator which has all 10 number buttons and +,-,*,/ operation buttons.</p>
  <p>But when I click the equal button it gives ResourceNotFoundException. Please help me with this.
  Thanks</p>
  <pre><code>public class MainActivity extends Activity implements OnClickListener{
  
      Button one,two,three,four,five,six,seven,eight,nine,zero,add,equal;
      TextView displayVw;
      int btnVal=0;
      int total=0;
      int num1,num2;
      
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          
          displayVw=(TextView) findViewById(R.id.textView_display);
          displayVw.setHint(&quot;0&quot;);
          
          one=(Button) findViewById(R.id.button_1);
          one.setOnClickListener(this);
          
          two=(Button) findViewById(R.id.button_2);
          two.setOnClickListener(this);
          
          three=(Button) findViewById(R.id.button_3);
          three.setOnClickListener(this);
          
          four=(Button) findViewById(R.id.button_4);
          four.setOnClickListener(this);
          
          five=(Button) findViewById(R.id.button_5);
          five.setOnClickListener(this);
          
          six=(Button) findViewById(R.id.button_six);
          six.setOnClickListener(this);
          
          seven=(Button) findViewById(R.id.button_7);
          seven.setOnClickListener(this);
          
          eight=(Button) findViewById(R.id.button_8);
          eight.setOnClickListener(this);
          
          nine=(Button) findViewById(R.id.button_9);
          nine.setOnClickListener(this);
          
          zero=(Button) findViewById(R.id.button_0);
          zero.setOnClickListener(this);
          
          equal=(Button) findViewById(R.id.button_equal);
          equal.setOnClickListener(this);
          
          add=(Button) findViewById(R.id.button_add);
          add.setOnClickListener(this);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.activity_main, menu);
          return true;
      }
  
      @Override
      public void onClick(View v) {
          String currentVal=&quot;&quot;;
          if(v.getId()==R.id.button_1)
          {
              btnVal=1;
              displayVw.append(currentVal+btnVal);
              currentVal=displayVw.getText().toString();
          }
          
          if(v.getId()==R.id.button_2)
          {
              btnVal=2;
              displayVw.append(currentVal+btnVal);
              currentVal=displayVw.getText().toString();
          }
          
          if(v.getId()==R.id.button_3)
          {
              btnVal=3;
              displayVw.append(currentVal+btnVal);
              currentVal=displayVw.getText().toString();
          }
          
          if(v.getId()==R.id.button_4)
          {
              btnVal=4;
              displayVw.append(currentVal+btnVal);
              currentVal=displayVw.getText().toString();
          }
          
          if(v.getId()==R.id.button_5)
          {
              btnVal=5;
              displayVw.append(currentVal+btnVal);
              currentVal=displayVw.getText().toString();
          }
          
          if(v.getId()==R.id.button_six)
          {
              btnVal=6;
              displayVw.append(currentVal+btnVal);
              currentVal=displayVw.getText().toString();
          }
          
          if(v.getId()==R.id.button_7)
          {
              btnVal=7;
              displayVw.append(currentVal+btnVal);
              currentVal=displayVw.getText().toString();
          }
          
          if(v.getId()==R.id.button_8)
          {
              btnVal=8;
              displayVw.append(currentVal+btnVal);
              currentVal=displayVw.getText().toString();
          }
          if(v.getId()==R.id.button_9)
          {
              btnVal=9;
              displayVw.append(currentVal+btnVal);
              currentVal=displayVw.getText().toString();
          }
          if(v.getId()==R.id.button_0)
          {
              btnVal=0;
              displayVw.append(currentVal+btnVal);
              currentVal=displayVw.getText().toString();
          }
          
          
          if(v.getId()==R.id.button_add)
          {
              num1=Integer.parseInt(displayVw.getText().toString());
              btnVal=0;
              //currentVal=&quot;&quot;;
              displayVw.setText(&quot;&quot;);
          }
          
          
          
           if(v.getId()==R.id.button_equal)
          {
              num2=Integer.parseInt(displayVw.getText().toString());
              total=num1+num2;
              displayVw.setText(total);
          }
  
      
      }
  
  }
  </code></pre>
  <p>This is mylogcat</p>
  <blockquote>
  <p>07-18 09:21:08.930: E/AndroidRuntime(27409): FATAL EXCEPTION: main
  07-18 09:21:08.930: E/AndroidRuntime(27409):
  android.content.res.Resources$NotFoundException: String resource ID</p>
  <h1>0x91 07-18 09:21:08.930: E/AndroidRuntime(27409):    at android.content.res.Resources.getText(Resources.java:1068) 07-18</h1>
  <p>09:21:08.930: E/AndroidRuntime(27409):    at
  android.widget.TextView.setText(TextView.java:4546) 07-18
  09:21:08.930: E/AndroidRuntime(27409):    at
  com.chanaka.calculator.MainActivity.onClick(MainActivity.java:158)
  07-18 09:21:08.930: E/AndroidRuntime(27409):  at
  android.view.View.performClick(View.java:4475) 07-18 09:21:08.930:
  E/AndroidRuntime(27409):  at
  android.view.View$PerformClick.run(View.java:18786) 07-18
  09:21:08.930: E/AndroidRuntime(27409):    at
  android.os.Handler.handleCallback(Handler.java:730) 07-18
  09:21:08.930: E/AndroidRuntime(27409):    at
  android.os.Handler.dispatchMessage(Handler.java:92) 07-18
  09:21:08.930: E/AndroidRuntime(27409):    at
  android.os.Looper.loop(Looper.java:137) 07-18 09:21:08.930:
  E/AndroidRuntime(27409):  at
  android.app.ActivityThread.main(ActivityThread.java:5419) 07-18
  09:21:08.930: E/AndroidRuntime(27409):    at
  java.lang.reflect.Method.invokeNative(Native Method) 07-18
  09:21:08.930: E/AndroidRuntime(27409):    at
  java.lang.reflect.Method.invoke(Method.java:525) 07-18 09:21:08.930:
  E/AndroidRuntime(27409):  at
  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1209)
  07-18 09:21:08.930: E/AndroidRuntime(27409):  at
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1025) 07-18
  09:21:08.930: E/AndroidRuntime(27409):    at
  dalvik.system.NativeStart.main(Native Method)</p>
  </blockquote>