The completed code is listed here.
1: Created an interface in the core project
package com.fmeg.tapout;
public interface ShareInterface {
public void shareScore(int score);
}
2: Created a class in the android project
package com.fmeg.tapout.android;
import android.content.Intent;
import com.fmeg.tapout.ShareInterface;
public class AndroidShare implements ShareInterface {
private AndroidLauncher application;
public AndroidShare(AndroidLauncher application) {
this.application = application;
}
@Override
public void shareScore(int score) {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "Score: " + score);
sendIntent.setType("text/plain");
application.startActivity(sendIntent);
}
}
in my main class for androidlauncher i have
AndroidShare shareScore = new AndroidShare(this);
and that’s as far as I can get, I don’t know how to actually call shareScore
3: in the main class(core project) add ShareInterface as a paremeter to your constructor.
use the share interface to send the score.