List of usage examples for org.apache.cordova CordovaChromeClient FILECHOOSER_RESULTCODE
int FILECHOOSER_RESULTCODE
To view the source code for org.apache.cordova CordovaChromeClient FILECHOOSER_RESULTCODE.
Click Source Link
From source file:com.AlcaldiaSucre.App.CordovaActivity.java
License:Apache License
@Override /**/*from www . j a va 2 s . co m*/ * Called when an activity you launched exits, giving you the requestCode you started it with, * the resultCode it returned, and any additional data from it. * * @param requestCode The request code originally supplied to startActivityForResult(), * allowing you to identify who this result came from. * @param resultCode The integer result code returned by the child activity through its setResult(). * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). */ protected void onActivityResult(int requestCode, int resultCode, Intent intent) { LOG.d(TAG, "Incoming Result"); super.onActivityResult(requestCode, resultCode, intent); Log.d(TAG, "Request code = " + requestCode); if (appView != null && requestCode == CordovaChromeClient.FILECHOOSER_RESULTCODE) { ValueCallback<Uri> mUploadMessage = this.appView.getWebChromeClient().getValueCallback(); Log.d(TAG, "did we get here?"); if (null == mUploadMessage) return; Uri result = intent == null || resultCode != Activity.RESULT_OK ? null : intent.getData(); Log.d(TAG, "result = " + result); // Uri filepath = Uri.parse("file://" + FileUtils.getRealPathFromURI(result, this)); // Log.d(TAG, "result = " + filepath); mUploadMessage.onReceiveValue(result); mUploadMessage = null; } CordovaPlugin callback = this.activityResultCallback; if (callback == null && initCallbackClass != null) { // The application was restarted, but had defined an initial callback // before being shut down. this.activityResultCallback = appView.pluginManager.getPlugin(initCallbackClass); callback = this.activityResultCallback; } if (callback != null) { LOG.d(TAG, "We have a callback to send this result to"); callback.onActivityResult(requestCode, resultCode, intent); } }
From source file:org.rti.olutindo_app.Olutindo.java
License:Apache License
@Override /**/* w w w . j a v a2s .c o m*/ * Called when an activity you launched exits, giving you the requestCode you started it with, * the resultCode it returned, and any additional data from it. * * @param requestCode The request code originally supplied to startActivityForResult(), * allowing you to identify who this result came from. * @param resultCode The integer result code returned by the child activity through its setResult(). * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). */ protected void onActivityResult(int requestCode, int resultCode, Intent intent) { Log.d(TAG, "Incoming Result"); super.onActivityResult(requestCode, resultCode, intent); Log.d(TAG, "Request code = " + requestCode); if (appView != null && requestCode == CordovaChromeClient.FILECHOOSER_RESULTCODE) { ValueCallback<Uri> mUploadMessage = this.appView.getWebChromeClient().getValueCallback(); Log.d(TAG, "did we get here?"); if (null == mUploadMessage) return; Uri result = intent == null || resultCode != Activity.RESULT_OK ? null : intent.getData(); Log.d(TAG, "result = " + result); // Uri filepath = Uri.parse("file://" + FileUtils.getRealPathFromURI(result, this)); // Log.d(TAG, "result = " + filepath); mUploadMessage.onReceiveValue(result); mUploadMessage = null; } CordovaPlugin callback = this.activityResultCallback; if (callback == null && initCallbackClass != null) { // The application was restarted, but had defined an initial callback // before being shut down. this.activityResultCallback = appView.pluginManager.getPlugin(initCallbackClass); callback = this.activityResultCallback; } if (callback != null) { Log.d(TAG, "We have a callback to send this result to"); callback.onActivityResult(requestCode, resultCode, intent); } }