Android webview

I’m unable to run the code that you posted. A blue field is briefly shown and then the app quits. It would be nice to have a WebView demo that is capable of loading your game’s url to start with. The following source code works on my Samsung tablet.

// Android/SketchPermissions check INTERNET

import android.webkit.WebView;
import android.app.Activity;
import android.content.Context;
import android.widget.FrameLayout;
import android.R;

Activity activity;
Context ctx;

void setup() {
  fullScreen();
  activity = this.getActivity();
  ctx = activity.getApplicationContext();
  runOnUiThread(new Runnable() {
    void run() {
      WebView webView = new WebView(ctx);
      webView.loadUrl("https://www.championsofregnum.com/?l=5&sec=3");
      FrameLayout layout = (FrameLayout)activity.findViewById(R.id.content);
      layout.addView(webView);
    }
  }
  );
}

void draw() {
}

In order to change the location of the map I think you would have to edit the html code for the website. You should be able to see that code in a regular browser but I’m not sure how you would edit it to achieve what you want to do.

1 Like