当前位置: 首页>>代码示例>>Java>>正文


Java WritableArray.pushString方法代码示例

本文整理汇总了Java中com.facebook.react.bridge.WritableArray.pushString方法的典型用法代码示例。如果您正苦于以下问题:Java WritableArray.pushString方法的具体用法?Java WritableArray.pushString怎么用?Java WritableArray.pushString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.react.bridge.WritableArray的用法示例。


在下文中一共展示了WritableArray.pushString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: pushObject

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public static void pushObject(WritableArray a, Object v) {
  if (v == null) {
    a.pushNull();
  } else if (v instanceof String) {
    a.pushString((String) v);
  } else if (v instanceof Bundle) {
    a.pushMap(fromBundle((Bundle) v));
  } else if (v instanceof Byte) {
    a.pushInt(((Byte) v) & 0xff);
  } else if (v instanceof Integer) {
    a.pushInt((Integer) v);
  } else if (v instanceof Float) {
    a.pushDouble((Float) v);
  } else if (v instanceof Double) {
    a.pushDouble((Double) v);
  } else if (v instanceof Boolean) {
    a.pushBoolean((Boolean) v);
  } else {
    throw new IllegalArgumentException("Unknown type " + v.getClass());
  }
}
 
开发者ID:de-code,项目名称:react-native-android-speech-recognizer,代码行数:22,代码来源:ArgumentsConverter.java

示例2: getIpAddress

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
@ReactMethod
public void getIpAddress(Callback successCallback, Callback errorCallback) {
    WritableArray ipList = Arguments.createArray();
    try {
        Enumeration<NetworkInterface> enumNetworkInterfaces = NetworkInterface.getNetworkInterfaces();
        while (enumNetworkInterfaces.hasMoreElements()) {
            NetworkInterface networkInterface = enumNetworkInterfaces.nextElement();
            Enumeration<InetAddress> enumInetAddress = networkInterface.getInetAddresses();
            while (enumInetAddress.hasMoreElements()) {
                InetAddress inetAddress = enumInetAddress.nextElement();
                if (inetAddress.isSiteLocalAddress()) {
                    ipList.pushString(inetAddress.getHostAddress());
                }
            }
        }
    } catch (SocketException e) {
        Log.e(eTag, "getIpAddress SocketException", e);
        errorCallback.invoke(e.getMessage());
    }
    successCallback.invoke(ipList);
}
 
开发者ID:davidstoneham,项目名称:react-native-sockets,代码行数:22,代码来源:SocketsModule.java

示例3: getEnginesInfo

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
@ReactMethod
public void getEnginesInfo(Promise promise) {
	if(notReady(promise)) return;

	try {
		WritableArray ttsInfo = Arguments.createArray();

		List<TextToSpeech.EngineInfo> engineList = tts.getEngines();
		Iterator iterator = engineList.iterator();
		while(iterator.hasNext()) {
			ttsInfo.pushString(iterator.next().toString());
		}

		promise.resolve(ttsInfo);
	} catch(Exception e) {
		promise.reject("error", "Unable to retrieve TTS Engine info for getEnginesInfo()", e);
	}
}
 
开发者ID:echo8795,项目名称:react-native-android-text-to-speech,代码行数:19,代码来源:RNAndroidTextToSpeechModule.java

示例4: writeStaticNodesFile

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
protected void writeStaticNodesFile(String enodes) {
    try {
        File dir = new File(this.reactContext
                .getFilesDir() + STATIC_NODES_FILES_PATH);
        if (dir.exists() == false) dir.mkdirs();
        File f = new File(dir, STATIC_NODES_FILES_NAME);
        if (f.exists() == false) {
            if (f.createNewFile() == true) {
                WritableArray staticNodes = new WritableNativeArray();
                staticNodes.pushString(enodes);
                Writer output = new BufferedWriter(new FileWriter(f));
                output.write(staticNodes.toString());
                output.close();
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:YsnKsy,项目名称:react-native-geth,代码行数:20,代码来源:GethHolder.java

示例5: testStringWithMultibyteUTF8Characters

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public void testStringWithMultibyteUTF8Characters() {
  TestJavaToJSArgumentsModule jsModule = mInstance.getJSModule(TestJavaToJSArgumentsModule.class);

  WritableNativeMap map = new WritableNativeMap();
  map.putString("two-bytes", "\u00A2");
  map.putString("three-bytes", "\u20AC");
  map.putString("four-bytes", "\uD83D\uDE1C");
  map.putString(
      "mixed",
      "\u017C\u00F3\u0142\u0107 g\u0119\u015Bl\u0105 \u6211 \uD83D\uDE0E ja\u017A\u0107");

  jsModule.receiveMapWithMultibyteUTF8CharacterString(map);
  waitForBridgeAndUIIdle();
  mAssertModule.verifyAssertsAndReset();

  WritableArray array = new WritableNativeArray();
  array.pushString("\u00A2");
  array.pushString("\u20AC");
  array.pushString("\uD83D\uDE1C");
  array.pushString(
      "\u017C\u00F3\u0142\u0107 g\u0119\u015Bl\u0105 \u6211 \uD83D\uDE0E ja\u017A\u0107");

  jsModule.receiveArrayWithMultibyteUTF8CharacterString(array);
  waitForBridgeAndUIIdle();
  mAssertModule.verifyAssertsAndReset();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:27,代码来源:CatalystNativeJavaToJSArgumentsTestCase.java

示例6: processPicture

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
private synchronized void processPicture(byte[] jpeg, int captureTarget, double maxJpegQuality,
                                         int maxSize, int orientation, List<String> paths,
                                         Callback successCallback, Callback errorCallback,
                                         String streamId, int totalPictures) {

    Log.d(TAG, "Processing picture");
    try {
        String path = savePicture(jpeg, captureTarget, maxJpegQuality, maxSize, orientation);

        Log.d(TAG, "Saved picture to " + path);

        paths.add(path);

        if (paths.size() == totalPictures) {
            WritableArray pathsArray = Arguments.createArray();
            for (String p : paths) {
                pathsArray.pushString(p);
            }
            successCallback.invoke(pathsArray);
            imagePorcessingHandler.removeCallbacksAndMessages(null);
        }
    } catch (IOException e) {
        String message = "Could not save picture for stream id " + streamId;
        Log.d(TAG, message, e);
        errorCallback.invoke(message);
        imagePorcessingHandler.removeCallbacksAndMessages(null);
    }
}
 
开发者ID:angellsl10,项目名称:react-native-webrtc,代码行数:29,代码来源:WebRTCModule.java

示例7: onResponseReceived

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public static void onResponseReceived(
  RCTDeviceEventEmitter eventEmitter,
  int requestId,
  int statusCode,
  WritableMap headers,
  String url) {
  WritableArray args = Arguments.createArray();
  args.pushInt(requestId);
  args.pushInt(statusCode);
  args.pushMap(headers);
  args.pushString(url);

  eventEmitter.emit("didReceiveNetworkResponse", args);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:15,代码来源:ResponseUtil.java

示例8: onRequestComplete

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
private void onRequestComplete(int requestId, @Nullable String error) {
  WritableArray args = Arguments.createArray();
  args.pushInt(requestId);
  args.pushString(error);

  getEventEmitter().emit("didCompleteNetworkResponse", args);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:8,代码来源:NetworkRecordingModuleMock.java

示例9: convertJsonToArray

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public static WritableArray convertJsonToArray(JSONArray jsonArray) throws JSONException {
    WritableArray array = new WritableNativeArray();

    for (int i = 0; i < jsonArray.length(); i++) {
        Object value = jsonArray.get(i);
        if (value instanceof JSONObject) {
            array.pushMap(convertJsonToMap((JSONObject) value));
        } else if (value instanceof  JSONArray) {
            array.pushArray(convertJsonToArray((JSONArray) value));
        } else if (value instanceof  Boolean) {
            array.pushBoolean((Boolean) value);
        } else if (value instanceof  Integer) {
            array.pushInt((Integer) value);
        } else if (value instanceof  Double) {
            array.pushDouble((Double) value);
        } else if (value instanceof String)  {
            array.pushString((String) value);
        } else {
            array.pushString(value.toString());
        }
    }
    return array;
}
 
开发者ID:salathegroup,项目名称:react-native-scandit,代码行数:24,代码来源:ReactBridgeHelpers.java

示例10: toWritableArray

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public static WritableArray toWritableArray(Object[] array) {
    WritableArray writableArray = Arguments.createArray();

    for (int i = 0; i < array.length; i++) {
        Object value = array[i];

        if (value == null) {
            writableArray.pushNull();
        }
        if (value instanceof Boolean) {
            writableArray.pushBoolean((Boolean) value);
        }
        if (value instanceof Double) {
            writableArray.pushDouble((Double) value);
        }
        if (value instanceof Integer) {
            writableArray.pushInt((Integer) value);
        }
        if (value instanceof String) {
            writableArray.pushString((String) value);
        }
        if (value instanceof Map) {
            writableArray.pushMap(MapUtil.toWritableMap((Map<String, Object>) value));
        }
        if (value.getClass().isArray()) {
            writableArray.pushArray(ArrayUtil.toWritableArray((Object[]) value));
        }
    }

    return writableArray;
}
 
开发者ID:dangerfarms,项目名称:react-native-batch,代码行数:32,代码来源:ArrayUtil.java

示例11: onIncrementalDataReceived

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public static void onIncrementalDataReceived(
  RCTDeviceEventEmitter eventEmitter,
  int requestId,
  String data,
  long progress,
  long total) {
  WritableArray args = Arguments.createArray();
  args.pushInt(requestId);
  args.pushString(data);
  args.pushInt((int) progress);
  args.pushInt((int) total);

  eventEmitter.emit("didReceiveNetworkIncrementalData", args);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:15,代码来源:ResponseUtil.java

示例12: onDataReceived

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public static void onDataReceived(
  RCTDeviceEventEmitter eventEmitter,
  int requestId,
  String data) {
  WritableArray args = Arguments.createArray();
  args.pushInt(requestId);
  args.pushString(data);

  eventEmitter.emit("didReceiveNetworkData", args);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:11,代码来源:ResponseUtil.java

示例13: onRequestError

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public static void onRequestError(
  RCTDeviceEventEmitter eventEmitter,
  int requestId,
  String error,
  IOException e) {
  WritableArray args = Arguments.createArray();
  args.pushInt(requestId);
  args.pushString(error);

  if ((e != null) && (e.getClass() == SocketTimeoutException.class)) {
    args.pushBoolean(true); // last argument is a time out boolean
  }

  eventEmitter.emit("didCompleteNetworkResponse", args);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:16,代码来源:ResponseUtil.java

示例14: onDataReceived

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
private void onDataReceived(int requestId, String data) {
  WritableArray args = Arguments.createArray();
  args.pushInt(requestId);
  args.pushString(data);

  getEventEmitter().emit("didReceiveNetworkData", args);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:8,代码来源:NetworkRecordingModuleMock.java

示例15: getArray

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
@ReactMethod(isBlockingSynchronousMethod = true)
WritableArray getArray() {
  WritableArray arr = new WritableNativeArray();
  arr.pushString("a");
  arr.pushBoolean(true);
  return arr;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:8,代码来源:CatalystNativeJavaToJSReturnValuesTestCase.java


注:本文中的com.facebook.react.bridge.WritableArray.pushString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。