List of usage examples for android.content Intent getStringArrayListExtra
public ArrayList<String> getStringArrayListExtra(String name)
From source file:fr.bmartel.android.notti.service.bluetooth.events.BluetoothObject.java
public static BluetoothObject parseArrayList(Intent intent) { ArrayList<String> actionsStr = intent.getStringArrayListExtra(""); if (actionsStr.size() > 0) { try {//from w ww. j a v a 2 s . com JSONObject mainObject = new JSONObject(actionsStr.get(0)); if (mainObject.has(BluetoothConst.DEVICE_ADDRESS) && mainObject.has(BluetoothConst.DEVICE_NAME)) { return new BluetoothObject(mainObject.get(BluetoothConst.DEVICE_ADDRESS).toString(), mainObject.get(BluetoothConst.DEVICE_NAME).toString()); } } catch (JSONException e) { e.printStackTrace(); } } return null; }
From source file:com.github.akinaru.bleanalyzer.bluetooth.events.BluetoothObject.java
public static BluetoothObject parseArrayList(Intent intent) { ArrayList<String> actionsStr = intent.getStringArrayListExtra(""); if (actionsStr.size() > 0) { try {//w w w .j av a 2 s .c om JSONObject mainObject = new JSONObject(actionsStr.get(0)); if (mainObject.has(JsonConstants.BT_ADDRESS) && mainObject.has(JsonConstants.BT_DEVICE_NAME)) { int scanInterval = -1; if (mainObject.has(JsonConstants.BT_ADVERTISING_INTERVAL)) scanInterval = mainObject.getInt(JsonConstants.BT_ADVERTISING_INTERVAL); return new BluetoothObject(mainObject.get(JsonConstants.BT_ADDRESS).toString(), mainObject.get(JsonConstants.BT_DEVICE_NAME).toString(), scanInterval); } } catch (JSONException e) { e.printStackTrace(); } } return null; }
From source file:com.xbm.android.matisse.Matisse.java
/** * Obtain user selected media path list in the starting Activity or Fragment. * * @param data Intent passed by {@link Activity#onActivityResult(int, int, Intent)} or * {@link Fragment#onActivityResult(int, int, Intent)}. * @return User selected media path list. *//* w ww . j av a2s . co m*/ public static List<String> obtainPathResult(Intent data) { return data.getStringArrayListExtra(MatisseActivity.EXTRA_RESULT_SELECTION_PATH); }
From source file:com.yanzhenjie.album.Album.java
/** * ????{@code resultCode = Activity.RESULT_OK}. * * @param intent {@code Intent} from {@code onActivityResult(int, int, Intent)}. * @return {@code List<String>}.//from ww w. j a va 2 s . com */ public static @NonNull List<String> parseResult(Intent intent) { List<String> pathList = intent.getStringArrayListExtra(KEY_OUTPUT_IMAGE_PATH_LIST); if (pathList == null) pathList = Collections.emptyList(); return pathList; }
From source file:com.learnncode.mediachooser.activity.DirectoryListActivity.java
public static ArrayList<String> getSelectedPaths(Intent intent) { if (intent != null && intent.getExtras() != null) { return intent.getStringArrayListExtra("list"); } else {/* w w w . ja v a 2 s. c o m*/ return new ArrayList<String>(); } }
From source file:fr.bmartel.android.tictactoe.request.ResponseParser.java
public static String parseUsernameEvent(Intent intent) { ArrayList<String> actionsStr = intent.getStringArrayListExtra(""); if (actionsStr.size() > 0) { try {//from ww w . j av a 2 s .c om JSONObject mainObject = new JSONObject(actionsStr.get(0)); if (mainObject.has(RequestConstants.DEVICE_NAME)) { return mainObject.get(RequestConstants.DEVICE_NAME).toString(); } } catch (JSONException e) { e.printStackTrace(); } } return ""; }
From source file:fr.bmartel.android.tictactoe.request.ResponseParser.java
public static List<DeviceItem> parseDeviceList(Intent intent, String excludedDeviceId) { ArrayList<String> actionsStr = intent.getStringArrayListExtra(""); List<DeviceItem> deviceList = new ArrayList<>(); if (actionsStr.size() > 0) { try {//from ww w . ja va 2 s .c o m JSONObject mainObject = new JSONObject(actionsStr.get(0)); if (mainObject.has(RequestConstants.DEVICE_ITEMS)) { JSONArray devices = mainObject.getJSONArray(RequestConstants.DEVICE_ITEMS); for (int i = 0; i < devices.length(); i++) { JSONObject item = (JSONObject) devices.get(i); JSONObject docItem = item.getJSONObject("doc"); if (docItem.has("_id") && docItem.has(RequestConstants.DEVICE_NAME) && docItem.has(RequestConstants.DEVICE_STATE)) { if (!docItem.getString("_id").equals(excludedDeviceId)) { deviceList.add(new DeviceItem(docItem.getString("_id"), docItem.getString(RequestConstants.DEVICE_NAME), GameStates.getState(docItem.getInt(RequestConstants.DEVICE_STATE)))); } /* deviceList.add(new DeviceItem(docItem.getString("_id"), docItem.getString(RequestConstants.DEVICE_NAME), GameStates.getState(docItem.getInt(RequestConstants.DEVICE_STATE)))); */ } } } } catch (JSONException e) { e.printStackTrace(); } } return deviceList; }
From source file:fr.bmartel.android.tictactoe.request.ResponseParser.java
public static MessageObject parseMessage(Intent intent) { ArrayList<String> actionsStr = intent.getStringArrayListExtra(""); if (actionsStr.size() > 0) { try {//from ww w. java 2s . co m JSONObject mainObject = new JSONObject(actionsStr.get(0)); if (mainObject.has(RequestConstants.DEVICE_MESSAGE_TOPIC)) { GameMessageTopic topic = GameMessageTopic .getTopic(mainObject.getInt(RequestConstants.DEVICE_MESSAGE_TOPIC)); switch (topic) { case CHALLENGED: { if (mainObject.has(RequestConstants.DEVICE_MESSAGE_CHALLENGER_ID) && mainObject.has(RequestConstants.DEVICE_MESSAGE_CHALLENGER_NAME)) { return new ChallengeMessage(topic, mainObject.getString(RequestConstants.DEVICE_MESSAGE_CHALLENGER_ID), mainObject.getString(RequestConstants.DEVICE_MESSAGE_CHALLENGER_NAME)); } return null; } case ACCEPTED: { if (mainObject.has(RequestConstants.DEVICE_MESSAGE_CHALLENGER_ID) && mainObject.has(RequestConstants.DEVICE_MESSAGE_CHALLENGER_NAME)) { return new ChallengeResponse(topic, true, mainObject.getString(RequestConstants.DEVICE_MESSAGE_CHALLENGER_ID), mainObject.getString(RequestConstants.DEVICE_MESSAGE_CHALLENGER_NAME)); } return null; } case DECLINED: { if (mainObject.has(RequestConstants.DEVICE_MESSAGE_CHALLENGER_ID) && mainObject.has(RequestConstants.DEVICE_MESSAGE_CHALLENGER_NAME)) { return new ChallengeResponse(topic, false, mainObject.getString(RequestConstants.DEVICE_MESSAGE_CHALLENGER_ID), mainObject.getString(RequestConstants.DEVICE_MESSAGE_CHALLENGER_NAME)); } return null; } case GAME_STOPPED: { break; } case PLAY: { if (mainObject.has(RequestConstants.DEVICE_PLAY)) { return new PlayRequest(topic, mainObject.getInt(RequestConstants.DEVICE_PLAY)); } return null; } case CLIENT_CONNECTED: { if (mainObject.has(RequestConstants.DEVICE_ID) && mainObject.has(RequestConstants.DEVICE_NAME)) { return new ClientConnectionEvent(topic, mainObject.getString(RequestConstants.DEVICE_ID), mainObject.getString(RequestConstants.DEVICE_NAME)); } return null; } } } } catch (JSONException e) { e.printStackTrace(); } } return null; }
From source file:com.yanzhenjie.durban.Durban.java
/** * Analyze the crop results./*from www . jav a2 s.c o m*/ */ public static ArrayList<String> parseResult(@NonNull Intent intent) { return intent.getStringArrayListExtra(KEY_OUTPUT_IMAGE_LIST); }
From source file:org.chromium.chrome.browser.util.IntentUtils.java
/** * Just like {@link Intent#getStringArrayListExtra(String)} but doesn't throw exceptions. *///from ww w . j av a 2s . com public static ArrayList<String> safeGetStringArrayListExtra(Intent intent, String name) { try { return intent.getStringArrayListExtra(name); } catch (Throwable t) { // Catches un-parceling exceptions. Log.e(TAG, "getStringArrayListExtra failed on intent " + intent); return null; } }