Error calling android static method from Unity

Hi, I have this simplified android code:

package com.ak.shimmer;
import com.unity3d.player.UnityPlayerActivity;
public class MainActivity extends UnityPlayerActivity{
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
.(etc)
.}
// call this method from unity
public static void calledFromUnity(){
System.out.println(“calledFromUnity method is called”);
}
}

This C+ code in Unity:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class on_onClick:MonoBehaviour{

public void shareText(){
//executethebelowlinesifbeingrunonaAndroid device
#ifUNITY_ANDROID
var androidJC=new AndroidJavaClass(“com.unity3d.player.UnityPlayer”);
var jo=androidJC.GetStatic(“currentActivity”);
jo.CallStatic(“calledFromUnity”);
#endif
}
}

And I am getting this error in the logcat:

08-17 17:51:58.245: I/Unity(14253): AndroidJavaException: java.lang.NoSuchMethodError: no static method “Lcom/unity3d/player/UnityPlayerActivity;.calledFromUnity()V”

It looks like currentActivity returns UnityPlayerActivity, and not MainActivity (the one that you have defined).

Are you sure you have set it up properly so that it will override Unity’s default activity ?

What do you mean with set it up?

I let the android app running in background while I push the method´s button of my Unity app.

I have followed these steps: http://forum.unity3d.com/threads/integrating-unity-and-eclipse.71607/

I meant - if you declare your own activity (a Java class derived from Activity), you have to declare that this is the main activity you use for your game in the AndroidManifest.xml. Also - your class should derive from Unity’s activity.

Check out this link for more information: Unity - Manual: Create and use plug-ins in Android