queryResult.putInt("rowsAffected", rowsAffected); if (insertId != -1) { queryResult.putDouble("insertId", insertId); queryResult.putInt("rowsAffected", 1); } else { queryResult.putInt("rowsAffected", 0); queryResult.putInt("rowsAffected", 0); } catch (SQLiteException ex) { errorMessage = ex.getMessage(); queryResult.putInt("rowsAffected", 0); } catch (SQLiteException ex) { errorMessage = ex.getMessage(); queryResult.putInt("rowsAffected", 0); } catch (SQLiteException ex) { errorMessage = ex.getMessage(); queryResult.putInt("rowsAffected", rowsAffectedCompat);
queryResult.putInt("rowsAffected", rowsAffected); if (insertId != -1) { queryResult.putDouble("insertId", insertId); queryResult.putInt("rowsAffected", 1); } else { queryResult.putInt("rowsAffected", 0); queryResult.putInt("rowsAffected", 0); } catch (SQLiteException ex) { errorMessage = ex.getMessage(); queryResult.putInt("rowsAffected", 0); } catch (SQLiteException ex) { errorMessage = ex.getMessage(); queryResult.putInt("rowsAffected", 0); } catch (SQLiteException ex) { errorMessage = ex.getMessage();
private WritableMap metaDataFromFile(File file) { WritableMap map = Arguments.createMap(); if(!file.exists()) return map; map.putInt(Fields.FILE_SIZE, (int) file.length()); map.putString(Fields.FILE_NAME, file.getName()); map.putString(Fields.TYPE, mimeTypeFromName(file.getAbsolutePath())); return map; }
private void exceptionCallback(Exception ex, final Callback onFail) { WritableMap error = Arguments.createMap(); error.putInt("errorCode", ex.hashCode()); error.putString("errorMessage", ex.getMessage()); error.putString("allErrorMessage", ex.toString()); onFail.invoke(error); }
private WritableMap metaDataFromContentResolver(Uri uri) { WritableMap map = Arguments.createMap(); ContentResolver contentResolver = getReactApplicationContext().getContentResolver(); map.putString(Fields.TYPE, contentResolver.getType(uri)); Cursor cursor = contentResolver.query(uri, null, null, null, null, null); try { if (cursor != null && cursor.moveToFirst()) { map.putString(Fields.FILE_NAME, cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME))); int sizeIndex = cursor.getColumnIndex(OpenableColumns.SIZE); if (!cursor.isNull(sizeIndex)) { String size = cursor.getString(sizeIndex); if (size != null) map.putInt(Fields.FILE_SIZE, Integer.valueOf(size)); } } } finally { if (cursor != null) { cursor.close(); } } return map; }
private WritableMap metaDataFromUri(Uri uri) { WritableMap map = Arguments.createMap(); File outputDir = getReactApplicationContext().getCacheDir(); try { File downloaded = download(uri, outputDir); map.putInt(Fields.FILE_SIZE, (int) downloaded.length()); map.putString(Fields.FILE_NAME, downloaded.getName()); map.putString(Fields.TYPE, mimeTypeFromName(uri.toString())); } catch (IOException e) { Log.e("DocumentPicker", "Failed to download file", e); } return map; }
private void onUpdate(ArrayList<DetectedActivity> detectedActivities) { WritableMap params = Arguments.createMap(); for (DetectedActivity activity : detectedActivities) { params.putInt(DetectionService.getActivityString(activity.getType()), activity.getConfidence()); } sendEvent("DetectedActivity", params); }
resp.putInt("status", response.getCode()); resp.putString("data", rawBody); onComplete.invoke(null, resp);