Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.webkit.WebView;
import org.json.JSONObject;

import java.util.List;

public class Main {
    public static void call(WebView webview, String function, JSONObject json) {
        webview.loadUrl("javascript:" + function + "('" + json.toString() + "')");
    }

    public static void call(WebView webview, String function, List<String> paramList) {
        String paramString = "";
        if (paramList != null) {
            for (String param : paramList) {
                if (paramString.equals(""))
                    paramString = "'" + param + "'";
                else
                    paramString = ",'" + param + "'";
            }
        }

        webview.loadUrl("javascript:" + function + "(" + paramString + ")");
    }
}