title: Android Getting a int from a edit text?
body: <p>I am trying to get an int from an edit text set to inputType="number" and then out put it ( i will do something with it later) i cant do it, this is the code i have which i have been told to try but it dose not work</p>
  
  <pre><code>Button go;
  EditText num;
  TextView OP, ST;
  String OPS;
  int oer;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      initalize();
      go.setOnClickListener(new View.OnClickListener() {
  
          public void onClick(View v) {
  
              int myNum = 0;
  
              OPS = num.getText().toString();
  
              try {
                  myNum = Integer.parseInt(OPS);
              } catch(NumberFormatException nfe) {
                  System.out.println("Could not parse " + nfe);
              }
              OP.setText(myNum);
          }
  </code></pre>
  
  <p>After i run it it force closes.
  This Is the LOG CAT:</p>
  
  <pre><code>09-09 16:53:00.400: W/ResourceType(20145): No package identifier when getting value for resource number 0x00000008
  09-09 16:53:00.400: D/AndroidRuntime(20145): Shutting down VM
  09-09 16:53:00.400: W/dalvikvm(20145): threadid=1: thread exiting with uncaught exception (group=0x40a411f8)
  09-09 16:53:00.561: E/AndroidRuntime(20145): FATAL EXCEPTION: main
  09-09 16:53:00.561: E/AndroidRuntime(20145): android.content.res.Resources$NotFoundException: String resource ID #0x8
  09-09 16:53:00.561: E/AndroidRuntime(20145):    at android.content.res.Resources.getText(Resources.java:248)
  09-09 16:53:00.561: E/AndroidRuntime(20145):    at android.widget.TextView.setText(TextView.java:3473)
  09-09 16:53:00.561: E/AndroidRuntime(20145):    at com.Nutty.studios.randnumgen.free.RandomNumberGenActivity$1.onClick(RandomNumberGenActivity.java:42)
  09-09 16:53:00.561: E/AndroidRuntime(20145):    at android.view.View.performClick(View.java:3511)
  09-09 16:53:00.561: E/AndroidRuntime(20145):    at android.view.View$PerformClick.run(View.java:14105)
  09-09 16:53:00.561: E/AndroidRuntime(20145):    at android.os.Handler.handleCallback(Handler.java:605)
  09-09 16:53:00.561: E/AndroidRuntime(20145):    at android.os.Handler.dispatchMessage(Handler.java:92)
  09-09 16:53:00.561: E/AndroidRuntime(20145):    at android.os.Looper.loop(Looper.java:137)
  09-09 16:53:00.561: E/AndroidRuntime(20145):    at android.app.ActivityThread.main(ActivityThread.java:4575)
  09-09 16:53:00.561: E/AndroidRuntime(20145):    at java.lang.reflect.Method.invokeNative(Native Method)
  09-09 16:53:00.561: E/AndroidRuntime(20145):    at java.lang.reflect.Method.invoke(Method.java:511)
  09-09 16:53:00.561: E/AndroidRuntime(20145):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
  09-09 16:53:00.561: E/AndroidRuntime(20145):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
  09-09 16:53:00.561: E/AndroidRuntime(20145):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>it works fine if i try to out put the string but not as an integer? </p>