本文整理汇总了Java中org.chromium.ui.WindowAndroid.sendBroadcast方法的典型用法代码示例。如果您正苦于以下问题:Java WindowAndroid.sendBroadcast方法的具体用法?Java WindowAndroid.sendBroadcast怎么用?Java WindowAndroid.sendBroadcast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.chromium.ui.WindowAndroid
的用法示例。
在下文中一共展示了WindowAndroid.sendBroadcast方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onIntentCompleted
import org.chromium.ui.WindowAndroid; //导入方法依赖的package包/类
/**
* Callback method to handle the intent results and pass on the path to the native
* SelectFileDialog.
* @param window The window that has access to the application activity.
* @param resultCode The result code whether the intent returned successfully.
* @param contentResolver The content resolver used to extract the path of the selected file.
* @param results The results of the requested intent.
*/
@Override
public void onIntentCompleted(WindowAndroid window, int resultCode,
ContentResolver contentResolver, Intent results) {
if (resultCode != Activity.RESULT_OK) {
onFileNotSelected();
return;
}
boolean success = false;
if (results == null) {
// If we have a successful return but no data, then assume this is the camera returning
// the photo that we requested.
nativeOnFileSelected(mNativeSelectFileDialog, mCameraOutputUri.getPath());
success = true;
// Broadcast to the media scanner that there's a new photo on the device so it will
// show up right away in the gallery (rather than waiting until the next time the media
// scanner runs).
window.sendBroadcast(new Intent(
Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, mCameraOutputUri));
} else {
// We get back a content:// URI from the system if the user picked a file from the
// gallery. The ContentView has functionality that will convert that content:// URI to
// a file path on disk that Chromium understands.
Cursor c = contentResolver.query(results.getData(),
new String[] { MediaStore.MediaColumns.DATA }, null, null, null);
if (c != null) {
if (c.getCount() == 1) {
c.moveToFirst();
String path = c.getString(0);
if (path != null) {
// Not all providers support the MediaStore.DATA column. For example,
// Gallery3D (com.android.gallery3d.provider) does not support it for
// Picasa Web Album images.
nativeOnFileSelected(mNativeSelectFileDialog, path);
success = true;
}
}
c.close();
}
}
if (!success) {
onFileNotSelected();
window.showError(R.string.opening_file_error);
}
}