public static String waitForReturn() throws InterruptedException { String value; while (null == (value = mPromptQueue.poll(1, TimeUnit.MILLISECONDS))) { GeckoAppShell.processNextNativeEvent(); } return value; }
// GeckoEventResponder implementation @Override public String getResponse() { // we only handle one kind of message in handleMessage, and this is the // response we provide for that message String result; while (null == (result = mPromptQueue.poll())) { GeckoAppShell.processNextNativeEvent(true); } return result; }
public String showFilePicker(String aMimeType) { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType(aMimeType); GeckoApp.this.startActivityForResult( Intent.createChooser(intent, getString(R.string.choose_file)), FILE_PICKER_REQUEST); String filePickerResult = ""; try { while (null == (filePickerResult = mFilePickerResult.poll(1, TimeUnit.MILLISECONDS))) { Log.i("GeckoApp", "processing events from showFilePicker "); GeckoAppShell.processNextNativeEvent(); } } catch (InterruptedException e) { Log.i(LOG_FILE_NAME, "showing file picker ", e); } return filePickerResult; }