List of usage examples for android.content Intent getStringArrayListExtra
public ArrayList<String> getStringArrayListExtra(String name)
From source file:com.amaze.filemanager.activities.MainActivity.java
@Override public void onNewIntent(Intent i) { intent = i;// w w w. j a va 2s. com path = i.getStringExtra("path"); if (path != null) { if (new File(path).isDirectory()) { Fragment f = getDFragment(); if ((f.getClass().getName().contains("TabFragment"))) { Main m = ((Main) getFragment().getTab()); m.loadlist(path, false, 0); } else goToMain(path); } else utils.openFile(new File(path), mainActivity); } else if (i.getStringArrayListExtra("failedOps") != null) { ArrayList<BaseFile> failedOps = i.getParcelableArrayListExtra("failedOps"); if (failedOps != null) { mainActivityHelper.showFailedOperationDialog(failedOps, i.getBooleanExtra("move", false), this); } } else if ((openprocesses = i.getBooleanExtra("openprocesses", false))) { android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.content_frame, new ProcessViewer()); // transaction.addToBackStack(null); select = 102; openprocesses = false; //title.setText(utils.getString(con, R.string.process_viewer)); //Commit the transaction transaction.commitAllowingStateLoss(); supportInvalidateOptionsMenu(); } else if (intent.getAction() != null) if (intent.getAction().equals(Intent.ACTION_GET_CONTENT)) { // file picker intent mReturnIntent = true; Toast.makeText(this, utils.getString(con, R.string.pick_a_file), Toast.LENGTH_LONG).show(); } else if (intent.getAction().equals(RingtoneManager.ACTION_RINGTONE_PICKER)) { // ringtone picker intent mReturnIntent = true; mRingtonePickerIntent = true; Toast.makeText(this, utils.getString(con, R.string.pick_a_file), Toast.LENGTH_LONG).show(); } else if (intent.getAction().equals(Intent.ACTION_VIEW)) { // zip viewer intent Uri uri = intent.getData(); zippath = uri.toString(); openZip(zippath); } }
From source file:com.eveningoutpost.dexdrip.Home.java
/** * Receiving speech input// w w w.j a v a 2 s . c om */ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case REQ_CODE_SPEECH_INPUT: { /* Intent intent = data; // DEEEBUGGGG if (intent != null) { final Bundle bundle = intent.getExtras(); if ((bundle != null) && (true)) { for (String key : bundle.keySet()) { Object value = bundle.get(key); if (value != null) { Log.d(TAG+" xdebug", String.format("%s %s (%s)", key, value.toString(), value.getClass().getName())); } } } }*/ if (resultCode == RESULT_OK && null != data) { ArrayList<String> result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); voiceRecognitionText.setText(result.get(0)); voiceRecognitionText.setVisibility(View.VISIBLE); last_speech_time = JoH.ts(); naturalLanguageRecognition(result.get(0)); } recognitionRunning = false; break; } case REQ_CODE_SPEECH_NOTE_INPUT: { if (resultCode == RESULT_OK && null != data) { ArrayList<String> result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); //voiceRecognitionText.setText(result.get(0)); //voiceRecognitionText.setVisibility(View.VISIBLE); //last_speech_time = JoH.ts(); //naturalLanguageRecognition(result.get(0)); String treatment_text = result.get(0).trim(); Log.d(TAG, "Got treatment note: " + treatment_text); voiceRecognitionText.setText(result.get(0)); voiceRecognitionText.setVisibility(View.VISIBLE); Treatments.create_note(treatment_text, 0); // timestamp? if (dialog != null) { dialog.cancel(); dialog = null; } Home.staticRefreshBGCharts(); } recognitionRunning = false; break; } case NFCReaderX.REQ_CODE_NFC_TAG_FOUND: { if (NFCReaderX.useNFC()) { NFCReaderX nfcReader = new NFCReaderX(); nfcReader.tagFound(this, data); } } } }
From source file:com.zhenlaidian.ui.InputCarNumberActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // MyLog.i("INCarDialogActivity", "onActivityResult-------->"); if (resultCode == RESULT_OK) { switch (requestCode) { case Constant.BACK_FROM_OWE: if (!TextUtils.isEmpty(getIntent().getStringExtra("from")) && getIntent().getStringExtra("from").equals("input")) { intent2();/* w w w. j a va 2s. c o m*/ } else { finish(); } break; case 10: String SDState = Environment.getExternalStorageState(); MyLog.i("INCarDialogActivity", " String SDState = Environment.getExternalStorageState()"); if (SDState.equals(Environment.MEDIA_MOUNTED)) { MyLog.i("INCarDialogActivity", "if"); // ?? int degree = ImageUtils.readPictureDegree(files.get(numcount - 1).getPath()); MyLog.i("INCarDialogActivity", "int degree"); Bitmap bm = CameraBitmapUtil.getBitmapFromFile(files.get(numcount - 1), 1000, 1000);//?bitmap? MyLog.i("INCarDialogActivity", "bitmap bm:"); if (degree != 0) { MyLog.i("TakePhotoUpdateActivity", "" + degree); Bitmap newbitmap = ImageUtils.rotaingImageView(degree, bm); CameraBitmapUtil.saveBitmap2file(newbitmap, files.get(numcount - 1).getPath()); } else { MyLog.i("INCarDialogActivity", "eeeelse"); CameraBitmapUtil.saveBitmap2file(bm, files.get(numcount - 1).getPath()); } MyLog.i("INCarDialogActivity", "numcount=" + numcount + "---photonum" + photonum); try { if (numcount < photonum) { takePhoto(++numcount); } else { createOrderForPos(); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } else { Toast.makeText(this, "??", Toast.LENGTH_LONG).show(); } Constant.ISNEEDBACKUP = true; break; case 100: listPath = data.getStringArrayListExtra("list"); try { createOrderForPos(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } break; } } }
From source file:com.mb.android.MainActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == PURCHASE_REQUEST) { if (resultCode == RESULT_OK) { if (currentProduct.getEmbyFeatureCode() != null) { AppstoreRegRequest request = new AppstoreRegRequest(); request.setStore(intent.getStringExtra("store")); request.setApplication(AppPackageName); request.setProduct(currentProduct.getSku()); request.setFeature(currentProduct.getEmbyFeatureCode()); request.setType(currentProduct.getProductType().toString()); if (intent.getStringExtra("storeId") != null) request.setStoreId(intent.getStringExtra("storeId")); request.setStoreToken(intent.getStringExtra("storeToken")); request.setEmail(purchaseEmail); request.setAmt(currentProduct.getPrice()); RespondToWebView(String.format("window.IapManager.onPurchaseComplete(" + jsonSerializer.SerializeToString(request) + ");")); } else { // no emby feature - just report success RespondToWebView(String.format("window.IapManager.onPurchaseComplete(true);")); }/*from w w w . j a v a2 s . co m*/ } else { RespondToWebView(String.format("window.IapManager.onPurchaseComplete(false);")); } } else if (requestCode == REQUEST_DIRECTORY_SAF && resultCode == Activity.RESULT_OK) { Uri uri = intent.getData(); final int takeFlags = intent.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); // Check for the freshest data. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { getContentResolver().takePersistableUriPermission(uri, takeFlags); } RespondToWebviewWithSelectedPath(uri); } else if (requestCode == REQUEST_DIRECTORY && resultCode == RESULT_OK) { if (intent.getBooleanExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false)) { // For JellyBean and above if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { ClipData clip = intent.getClipData(); if (clip != null) { for (int i = 0; i < clip.getItemCount(); i++) { Uri uri = clip.getItemAt(i).getUri(); RespondToWebviewWithSelectedPath(uri); } } // For Ice Cream Sandwich } else { ArrayList<String> paths = intent.getStringArrayListExtra(FilePickerActivity.EXTRA_PATHS); if (paths != null) { for (String path : paths) { Uri uri = Uri.parse(path); RespondToWebviewWithSelectedPath(uri); } } } } else { Uri uri = intent.getData(); // Do something with the URI if (uri != null) { RespondToWebviewWithSelectedPath(uri); } } } else if (requestCode == VIDEO_PLAYBACK) { /*boolean completed = resultCode == RESULT_OK; boolean error = resultCode == RESULT_OK ? false : (intent == null ? true : intent.getBooleanExtra("error", false)); long positionMs = intent == null || completed ? 0 : intent.getLongExtra("position", 0); String currentSrc = intent == null ? null : intent.getStringExtra(VideoPlayerActivity.PLAY_EXTRA_ITEM_LOCATION); if (currentSrc == null) { currentSrc = ""; } RespondToWebView(String.format("VideoRenderer.Current.onActivityClosed(%s, %s, %s, '%s');", !completed, error, positionMs, currentSrc));*/ } }
From source file:com.amaze.carbonfilemanager.activities.MainActivity.java
@Override public void onNewIntent(Intent i) { intent = i;//from w ww . jav a2 s. c om path = i.getStringExtra("path"); if (path != null) { if (new File(path).isDirectory()) { Fragment f = getDFragment(); if ((f.getClass().getName().contains("TabFragment"))) { MainFragment m = ((MainFragment) getFragment().getTab()); m.loadlist(path, false, OpenMode.FILE); } else goToMain(path); } else utils.openFile(new File(path), mainActivity); } else if (i.getStringArrayListExtra(TAG_INTENT_FILTER_FAILED_OPS) != null) { ArrayList<BaseFile> failedOps = i.getParcelableArrayListExtra(TAG_INTENT_FILTER_FAILED_OPS); if (failedOps != null) { mainActivityHelper.showFailedOperationDialog(failedOps, i.getBooleanExtra("move", false), this); } } else if (i.getCategories() != null && i.getCategories().contains(CLOUD_AUTHENTICATOR_GDRIVE)) { // we used an external authenticator instead of APIs. Probably for Google Drive CloudRail.setAuthenticationResponse(intent); } else if ((openProcesses = i.getBooleanExtra(KEY_INTENT_PROCESS_VIEWER, false))) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.content_frame, new ProcessViewer(), KEY_INTENT_PROCESS_VIEWER); // transaction.addToBackStack(null); selectedStorage = SELECT_102; openProcesses = false; //title.setText(utils.getString(con, R.string.process_viewer)); //Commit the transaction transaction.commitAllowingStateLoss(); supportInvalidateOptionsMenu(); } else if (intent.getAction() != null) { if (intent.getAction().equals(Intent.ACTION_GET_CONTENT)) { // file picker intent mReturnIntent = true; Toast.makeText(this, getString(R.string.pick_a_file), Toast.LENGTH_LONG).show(); } else if (intent.getAction().equals(RingtoneManager.ACTION_RINGTONE_PICKER)) { // ringtone picker intent mReturnIntent = true; mRingtonePickerIntent = true; Toast.makeText(this, getString(R.string.pick_a_file), Toast.LENGTH_LONG).show(); } else if (intent.getAction().equals(Intent.ACTION_VIEW)) { // zip viewer intent Uri uri = intent.getData(); zippath = uri.toString(); openZip(zippath); } if (SDK_INT >= Build.VERSION_CODES.KITKAT) { if (intent.getAction().equals(UsbManager.ACTION_USB_DEVICE_ATTACHED)) { if (sharedPref.getString(KEY_PREF_OTG, null) == null) { sharedPref.edit().putString(KEY_PREF_OTG, VALUE_PREF_OTG_NULL).apply(); refreshDrawer(); } } else if (intent.getAction().equals(UsbManager.ACTION_USB_DEVICE_DETACHED)) { sharedPref.edit().putString(KEY_PREF_OTG, null).apply(); refreshDrawer(); } } } }
From source file:com.google.example.eightbitartist.DrawingActivity.java
@Override public void onActivityResult(int request, int response, Intent data) { super.onActivityResult(request, response, data); Log.i(TAG, "onActivityResult: code = " + request + ", response = " + response); // Coming back from resolving a sign-in request if (request == RC_SIGN_IN) { mSignInClicked = false;/*from www. j av a 2 s.co m*/ mResolvingConnectionFailure = false; if (response == RESULT_OK) { mGoogleApiClient.connect(); } else { BaseGameUtils.showActivityResultError(this, request, response, R.string.sign_in_failed); } } // Coming back from a RealTime Multiplayer waiting room if (request == RC_WAITING_ROOM) { dismissSpinner(); Room room = data.getParcelableExtra(Multiplayer.EXTRA_ROOM); if (response == RESULT_OK) { Log.d(TAG, "Waiting Room: Success"); mRoom = room; startMatch(); } else if (response == RESULT_CANCELED) { Log.d(TAG, "Waiting Room: Canceled"); leaveRoom(); } else if (response == GamesActivityResultCodes.RESULT_LEFT_ROOM) { Log.d(TAG, "Waiting Room: Left Room"); leaveRoom(); } else if (response == GamesActivityResultCodes.RESULT_INVALID_ROOM) { Log.d(TAG, "Waiting Room: Invalid Room"); leaveRoom(); } } // We are coming back from the player selection UI, in preparation to start a match. if (request == RC_SELECT_PLAYERS) { if (response != Activity.RESULT_OK) { // user canceled Log.d(TAG, "onActivityResult: user canceled player selection."); return; } // Create a basic room configuration RoomConfig.Builder roomConfigBuilder = RoomConfig.builder(this).setMessageReceivedListener(this) .setRoomStatusUpdateListener(this); // Set the auto match criteria int minAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MIN_AUTOMATCH_PLAYERS, 0); int maxAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MAX_AUTOMATCH_PLAYERS, 0); if (minAutoMatchPlayers > 0 || maxAutoMatchPlayers > 0) { Bundle autoMatchCriteria = RoomConfig.createAutoMatchCriteria(minAutoMatchPlayers, maxAutoMatchPlayers, 0); roomConfigBuilder.setAutoMatchCriteria(autoMatchCriteria); } // Set the invitees final ArrayList<String> invitees = data.getStringArrayListExtra(Games.EXTRA_PLAYER_IDS); if (invitees != null && invitees.size() > 0) { roomConfigBuilder.addPlayersToInvite(invitees); } // Build the room and start the match showSpinner(); Games.RealTimeMultiplayer.create(mGoogleApiClient, roomConfigBuilder.build()); } }
From source file:com.kaichaohulian.baocms.ecdemo.ui.chatting.ChattingFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); LogUtil.d(TAG,/*from w w w .j a v a 2 s . c o m*/ "onActivityResult: requestCode=" + requestCode + ", resultCode=" + resultCode + ", data=" + data); // If there's no data (because the user didn't select a picture and // just hit BACK, for example), there's nothing to do. if (requestCode == 111 && resultCode == 111) { ContactFriendsEntity data1 = (ContactFriendsEntity) data.getSerializableExtra("data"); handleSendIDCardMessage(data1.getUsername(), data1.getAvatar(), data1.getId() + "", data1.getId()); } if (requestCode == 0x2a || requestCode == SELECT_AT_SOMONE) { if (data == null) { return; } } else if (resultCode != ChattingActivity.RESULT_OK) { LogUtil.d("onActivityResult: bail due to resultCode=" + resultCode); isFireMsg = false; return; } if (data != null && 0x2a == requestCode) { handleAttachUrl(data.getStringExtra("choosed_file_path")); return; } if (requestCode == REQUEST_CODE_TAKE_PICTURE || requestCode == REQUEST_CODE_LOAD_IMAGE) { if (requestCode == REQUEST_CODE_LOAD_IMAGE) { ArrayList<String> result = data.getStringArrayListExtra(PhotoPickerActivity.KEY_RESULT); if (result != null && !result.isEmpty()) { mFilePath = result.get(0); } else { mFilePath = DemoUtils.resolvePhotoFromIntent(this.getActivity(), data, FileAccessor.IMESSAGE_IMAGE); } } if (TextUtils.isEmpty(mFilePath)) { return; } File file = new File(mFilePath); if (file == null || !file.exists()) { return; } try { ECPreferences.savePreference(ECPreferenceSettings.SETTINGS_CROPIMAGE_OUTPUTPATH, file.getAbsolutePath(), true); Intent intent = new Intent(getChattingActivity(), ImagePreviewActivity.class); getActivity().startActivityForResult(intent, REQUEST_CODE_IMAGE_CROP); } catch (Exception e1) { e1.printStackTrace(); } return; } if (requestCode == REQUEST_VIEW_CARD && data != null) { boolean exit = data.getBooleanExtra(GroupInfoActivity.EXTRA_QUEIT, false); if (exit) { finish(); return; } boolean reload = data.getBooleanExtra(GroupInfoActivity.EXTRA_RELOAD, false); if (reload) { mThread = mChattingAdapter.setUsername(mRecipients); queryUIMessage(); } } if (requestCode == SELECT_AT_SOMONE) { String selectUser = data.getStringExtra(AtSomeoneUI.EXTRA_SELECT_CONV_USER); if (TextUtils.isEmpty(selectUser)) { mChattingFooter.setAtSomebody(""); LogUtil.d(TAG, "@ [nobody]"); return; } LogUtil.d(TAG, "@ " + selectUser); ECContacts contact = ContactSqlManager.getContact(selectUser); if (contact == null) { return; } if (TextUtils.isEmpty(contact.getNickname())) { contact.setNickname(contact.getContactid()); } mChattingFooter.setAtSomebody(contact.getNickname()); mChattingFooter.putSomebody(contact); postSetAtSome(); return; } if (requestCode == GlobalConstant.ACTIVITY_FOR_RESULT_VIDEORECORD) { handleVideoRecordSend(data); } if (requestCode == REQUEST_CODE_TAKE_LOCATION) { locationInfo = (LocationInfo) data.getSerializableExtra("location"); handleSendLocationMessage(locationInfo); } if (requestCode == REQUEST_CODE_REDPACKET) { if (data != null) { handlesendRedPacketMessage(data); } } }
From source file:com.android.launcher3.Launcher.java
@Override protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) { handleActivityResult(requestCode, resultCode, data); if (mLauncherCallbacks != null) { mLauncherCallbacks.onActivityResult(requestCode, resultCode, data); }//from w ww . j av a 2s. c om if (REQUEST_ENABLE == requestCode) { super.onActivityResult(requestCode, resultCode, data); } if (RECOGNIZER_REQ_CODE == requestCode) { if (resultCode == Activity.RESULT_OK && null != data) { String search = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS).get(0); startSearch(search, true, null, true); } } }
From source file:com.if3games.chessonline.DroidFish.java
private void handleSelectPlayersResult(int response, Intent data, int variant) { if (response != Activity.RESULT_OK) { //Log.w(TAG, "*** select players UI cancelled, " + response); switchToMainScreen();/* www.j av a2 s. c o m*/ return; } Log.d(TAG, "Select players UI succeeded."); // get the invitee list final ArrayList<String> invitees = data.getStringArrayListExtra(Games.EXTRA_PLAYER_IDS); //Log.d(TAG, "Invitee count: " + invitees.size()); // get the automatch criteria Bundle autoMatchCriteria = null; int minAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MIN_AUTOMATCH_PLAYERS, 0); int maxAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MAX_AUTOMATCH_PLAYERS, 0); if (minAutoMatchPlayers > 0 || maxAutoMatchPlayers > 0) { autoMatchCriteria = RoomConfig.createAutoMatchCriteria(minAutoMatchPlayers, maxAutoMatchPlayers, 0); //Log.d(TAG, "Automatch criteria: " + autoMatchCriteria); } // create the room Log.d(TAG, "Creating room..."); RoomConfig.Builder rtmConfigBuilder = RoomConfig.builder(this); rtmConfigBuilder.addPlayersToInvite(invitees); rtmConfigBuilder.setMessageReceivedListener(this); rtmConfigBuilder.setRoomStatusUpdateListener(this); if (autoMatchCriteria != null) { rtmConfigBuilder.setAutoMatchCriteria(autoMatchCriteria); } rtmConfigBuilder.setVariant(variant); switchToScreen(R.id.screen_wait); keepScreenOn(); resetGameVars(); resetGameBoolVars(); Games.RealTimeMultiplayer.create(getApiClient(), rtmConfigBuilder.build()); Log.d(TAG, "Room created, waiting for it to be ready..."); }