本文整理匯總了Java中org.apache.cordova.PluginResult.Status方法的典型用法代碼示例。如果您正苦於以下問題:Java PluginResult.Status方法的具體用法?Java PluginResult.Status怎麽用?Java PluginResult.Status使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.cordova.PluginResult
的用法示例。
在下文中一共展示了PluginResult.Status方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: sendUpdate
import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
/**
* Create a new plugin result and send it back to JavaScript
*
* @param obj a JSONObject contain event payload information
* @param status the status code to return to the JavaScript environment
*/
private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Status status) {
if (callbackContext != null) {
PluginResult result = new PluginResult(status, obj);
result.setKeepCallback(keepCallback);
callbackContext.sendPluginResult(result);
if (!keepCallback) {
callbackContext = null;
}
}
}
示例2: sendUpdate
import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
/**
* Create a new plugin result and send it back to JavaScript
*
* @param obj a JSONObject contain event payload information
* @param status the status code to return to the JavaScript environment
*/
private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Status status) {
if (callbackContext != null) {
PluginResult result = new PluginResult(status, obj);
result.setKeepCallback(keepCallback);
callbackContext.sendPluginResult(result);
if (!keepCallback) {
callbackContext = null;
}
}
}
示例3: sendCallback
import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
private static void sendCallback(PluginResult.Status status, String message){
if(!Thread.currentThread().isInterrupted()){
final PluginResult result = new PluginResult(status, message);
result.setKeepCallback(true);
_callbackContext.sendPluginResult(result);
}
}
示例4: sendCallback
import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
/**
* Callback handler for this Class
* @param status Message status
* @param message Any message
*/
private static void sendCallback(PluginResult.Status status, String message){
if(!Thread.currentThread().isInterrupted()){
final PluginResult result = new PluginResult(status, message);
result.setKeepCallback(true);
_callbackContext.sendPluginResult(result);
}
}
示例5: execute
import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
/**
* Executes the request and returns PluginResult.
*
* @param action The action to execute.
* @param args JSONArry of arguments for the plugin.
* @param callbackContext The callback context from which we were invoked.
* @return A PluginResult object with a status and message.
*/
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
PluginResult.Status status = PluginResult.Status.OK;
String result = "";
try {
if (action.equals("clearCache")) {
this.clearCache();
}
else if (action.equals("show")) {
// This gets called from JavaScript onCordovaReady to show the webview.
// I recommend we change the name of the Message as spinner/stop is not
// indicative of what this actually does (shows the webview).
cordova.getActivity().runOnUiThread(new Runnable() {
public void run() {
webView.postMessage("spinner", "stop");
}
});
}
else if (action.equals("loadUrl")) {
this.loadUrl(args.getString(0), args.optJSONObject(1));
}
else if (action.equals("cancelLoadUrl")) {
//this.cancelLoadUrl();
}
else if (action.equals("clearHistory")) {
this.clearHistory();
}
else if (action.equals("backHistory")) {
this.backHistory();
}
else if (action.equals("overrideButton")) {
this.overrideButton(args.getString(0), args.getBoolean(1));
}
else if (action.equals("overrideBackbutton")) {
this.overrideBackbutton(args.getBoolean(0));
}
else if (action.equals("exitApp")) {
this.exitApp();
}
else if (action.equals("messageChannel")) {
messageChannel = callbackContext;
return true;
}
callbackContext.sendPluginResult(new PluginResult(status, result));
return true;
} catch (JSONException e) {
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
return false;
}
}
示例6: sendCallback
import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
/**
* Callback handler for this Class
* @param status Message status
* @param message Any message
*/
private static void sendCallback(PluginResult.Status status, String message){
final PluginResult result = new PluginResult(status, message);
result.setKeepCallback(true);
_callbackContext.sendPluginResult(result);
}