title: Can't call method from other class (android)
body: <p>My main class is:</p>
  
  <pre><code>package com.myapps.myapp;
  
  import android.os.Bundle; 
  //...and all the other imports
  
  
  public class MainActivity extends Activity {
  
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
  
      //...
  
      }
  
      MoneyCalc moneyCalculator = new MoneyCalc();
      moneyCalculator.MoneyCalculate(this);
  
  }
  </code></pre>
  
  <p>My second class:</p>
  
  <pre><code>package com.myapps.myapp;
  
  public class MoneyCalc{
  
      public void MoneyCalculate(MainActivity activity){
          TextView textview = (TextView) activity.findViewById(R.id.MoneyResult);
          EditText edittext = (EditText) activity.findViewById(R.id.MoneyInput);
      Spinner spinner = (Spinner) activity.findViewById(R.id.MoneySpinner1);
      Spinner spinner2 = (Spinner) activity.findViewById(R.id.MoneySpinner2);
          //...
          }
  }
  </code></pre>
  
  <p>The second class is not an activity, I keep it only to have some methods. The MoneyCalc method is called when a button is clicked. I can't read the methods in the MainActivity, it says:</p>
  
  <pre><code>Multiple markers at this line
      - Syntax error on token(s), misplaced construct(s)
      - Syntax error on token "this", delete this token
      - Syntax error on token "MoneyCalculate", Identifier expected after this 
       token
  </code></pre>
  
  <p>The logcat errors:</p>
  
  <pre><code>01-24 17:13:31.071: E/AndroidRuntime(3662): FATAL EXCEPTION: main
  01-24 17:13:31.071: E/AndroidRuntime(3662): java.lang.IllegalStateException: Could not find a method MoneyCalculate(View) in the activity class com.myapps.myapp.MainActivity for onClick handler on view class android.widget.Button with id 'CalculateButton'
  01-24 17:13:31.071: E/AndroidRuntime(3662):     at android.view.View$1.onClick(View.java:3584)
  01-24 17:13:31.071: E/AndroidRuntime(3662):     at android.view.View.performClick(View.java:4202)
  01-24 17:13:31.071: E/AndroidRuntime(3662):     at android.view.View$PerformClick.run(View.java:17340)
  01-24 17:13:31.071: E/AndroidRuntime(3662):     at android.os.Handler.handleCallback(Handler.java:725)
  01-24 17:13:31.071: E/AndroidRuntime(3662):     at android.os.Handler.dispatchMessage(Handler.java:92)
  01-24 17:13:31.071: E/AndroidRuntime(3662):     at android.os.Looper.loop(Looper.java:137)
  01-24 17:13:31.071: E/AndroidRuntime(3662):     at android.app.ActivityThread.main(ActivityThread.java:5039)
  01-24 17:13:31.071: E/AndroidRuntime(3662):     at java.lang.reflect.Method.invokeNative(Native Method)
  01-24 17:13:31.071: E/AndroidRuntime(3662):     at java.lang.reflect.Method.invoke(Method.java:511)
  01-24 17:13:31.071: E/AndroidRuntime(3662):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  01-24 17:13:31.071: E/AndroidRuntime(3662):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  01-24 17:13:31.071: E/AndroidRuntime(3662):     at dalvik.system.NativeStart.main(Native Method)
  01-24 17:13:31.071: E/AndroidRuntime(3662): Caused by: java.lang.NoSuchMethodException: MoneyCalculate [class android.view.View]
  01-24 17:13:31.071: E/AndroidRuntime(3662):     at java.lang.Class.getConstructorOrMethod(Class.java:460)
  01-24 17:13:31.071: E/AndroidRuntime(3662):     at java.lang.Class.getMethod(Class.java:915)
  01-24 17:13:31.071: E/AndroidRuntime(3662):     at android.view.View$1.onClick(View.java:3577)
  01-24 17:13:31.071: E/AndroidRuntime(3662):     ... 11 more
  </code></pre>