• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Request for simple example project / call Java file

J

Juhran

Guest
Hello, I am stuck with understanding how to add a java file as extension to my android GM2 project.

Maybe someone can upload a quick full example to study?

I got this in my "test.java" file:

package ${YYAndroidPackageName};
import ${YYAndroidPackageName}.RunnerActivity;
import ${YYAndroidPackageName}.R;

import com.yoyogames.runner.RunnerJNILib;
import android.app.Application;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;

public class WebViewEmbed// extends Activity
{
public String testMe()
{
return "Access to test method succeeded";
}
}

What is the next step?
1. Right click "Extensions" and "Create Extension"?
2. check "Android" under "Extra Platforms" ?
3. "Add Generic Placeholder" or "Add File" ?
4. Add Function and name it "testMe" with Return Type "string" ?
5. where and when do I add my test.java file here?
6. In "Tap" Event I would then try:

string x = testMe();
show_message(x);

to display the returned value of my function testMe() right?

Sorry, I really only need a bit guide here to get it started. I did read the tutorials
and some other questions reagrding this in this forum and searched for yt videos
on this topic. I am bit lost without a proper guide.

Maybe someone can provide an example I can test and play a bit with?
Or the youtubers here might even think about a video? :)
 
J

Juhran

Guest
Very frustrating that I can not get it to work.
I did try another start with this link: https://docs2.yoyogames.com/source/_build/2_interface/1_editors/extensions.html

And it says:

Once you have set this up correctly, you will need to add the required files for your extension package to work. To do this you need to click on the buttons at the bottom, either Add SDK or Add Source and then browse to the files you wish to add. Added files will be stored in the AndroidSource directory along with your extension. You can open this location at any time by right clicking on the extension and selecting Open Extension Directory.

In my case it is not possible to add files. I can only pick a folder and nothings else happens. I am sure doing it wrong.
Your help is highly welcome. If someone could upload a test project that I could try over and learn from, it would be awesome.
 
J

Juhran

Guest
I'll attach what I did so far hoping someone can tell me where I am doing it wrong. Please see pdf file at https://ufile.io/gxve3

I could not find any help. I am even willing to pay for help at this stage, just to learn what I am doing wrong!
 
Top