Alright, I am newer to the forums here so I am not sure if this question will be specific enough, but my code is below.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String firstNo = ((EditText) findViewById(R.id.txtRent)).getText().toString();
int ApartmentCost = Integer.parseInt(firstNo);
TextView txtTotal = (TextView) findViewById(R.id.lblTotal);
txtTotal.setText(ApartmentCost);
}
});
}
Whenever I try to place a value into the textbox to see if it displays i get the following error codes.
02-04 10:42:19.496 1072-1072/com.example.itc201.appartmentsharing E/AndroidRuntime﹕ FATAL EXCEPTION: main
android.content.res.Resources$NotFoundException: String resource ID #0x1f4
at android.content.res.Resources.getText(Resources.java:239)
at android.widget.TextView.setText(TextView.java:3844)
at
com.example.itc201.appartmentsharing.MainActivity$1.onClick(MainActivity.java:34)
at android.view.View.performClick(View.java:4240)
at android.view.View$PerformClick.run(View.java:17721)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Any help would be great!