@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.activity_main); WebView webView = (WebView) browser = findViewById(R.id.webview); browser.setLayerType(View.LAYER_TYPE_SOFTWARE, null); browser.setWebViewClient(new Callback()); browser.getSettings().setJavaScriptEnabled(true); }
private CallbackType(String function, boolean hasReturn, String... args) { this.name = function; this.setHasReturn(hasReturn); this.args = args; }
private void generateCallbackConfiguration(Map<String, Object> mainConf, TableConfiguration tableConfiguration) { if (tableConfiguration.getCallbacks() != null) { for (Callback callback : tableConfiguration.getCallbacks()) { mainConf.put(callback.getType().getName(), callback.getFunction()); } } } }
super.onCreate(savedInstanceState); setContentView(R.layout.home_screen); wv = (WebView) findViewById(R.id.webView1); // here is the error. What is wrong in this line? wv.setWebViewClient(new Callback()); loadTime();
private void generateCallbackConfiguration(Map<String, Object> mainConf, TableConfiguration tableConfiguration) { if (tableConfiguration.getCallbacks() != null) { for (Callback callback : tableConfiguration.getCallbacks()) { mainConf.put(callback.getType().getName(), callback.getFunction()); } } } }
private CallbackType(String function, boolean hasReturn, String... args) { this.name = function; this.setHasReturn(hasReturn); this.args = args; }
// Get access to a callback function for receiving the sel_handleAppleEvent message aeCallback = new Callback(Main.class, "handleAppleEvent", 4); long aeProc = aeCallback.getAddress(); // Create a ObjC class that provides a method with the sel_handleAppleEvent footprint String objcClassName = "ObjCAppleEventHandler"; long objcClass = OS.objc_allocateClassPair(OS.class_NSObject, objcClassName, 0); OS.class_addMethod(objcClass, sel_handleAppleEvent, aeProc, "i@:@@"); OS.objc_registerClassPair(objcClass); long objcHandlerInstance = OS.class_createInstance (objcClass, 0); // Invoke [[NSAppleEventManager sharedAppleEventManager] setEventHandler:objcHandlerInstance andSelector:sel_handleAppleEvent forEventClass:kInternetEventClass andEventID:kAEGetURL] long sharedAppleEventMgr = OS.objc_msgSend (class_NSAppleEventManager, sel_sharedAppleEventManager); OS.objc_msgSend (sharedAppleEventMgr, sel_setEventHandler, objcHandlerInstance, sel_handleAppleEvent, kInternetEventClass, kAEGetURL);
obj = new Callback(); obj.callbacks.push(logStuff.bind(null, "My message")); obj.callbacks.push(logStuff.bind(null, "My other message")); obj.run();
double lat = 48.8566; double lng = 2.3522; WeatherAPI.Factory.getmWeatherAPI().getWeather(lat + "," + lng).enqueue(new Callback());
private final static Callback callback; static { callback = new Callback(); } public Foo() { super(getCallback()); } private static Callback getCallback() { return callback; }
private Callback callback; public Foo() { super(getCallback()); } private Callback getCallback() { callback = new Callback(); return callback; }