List of usage examples for android.content Intent getStringArrayListExtra
public ArrayList<String> getStringArrayListExtra(String name)
From source file:com.android.mail.ui.AbstractActivityController.java
/** * The mail activity calls other activities for two specific reasons: * <ul>//from ww w .j a va2 s. c o m * <li>To add an account. And receives the result {@link #ADD_ACCOUNT_REQUEST_CODE}</li> * <li>To update the password on a current account. The result {@link * #REAUTHENTICATE_REQUEST_CODE} is received.</li> * </ul> * @param requestCode * @param resultCode * @param data */ @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case ADD_ACCOUNT_REQUEST_CODE: // We were waiting for the user to create an account if (resultCode == Activity.RESULT_OK) { // restart the loader to get the updated list of accounts mActivity.getLoaderManager().initLoader(LOADER_ACCOUNT_CURSOR, Bundle.EMPTY, mAccountCallbacks); } else { // The user failed to create an account, just exit the app mActivity.finish(); } break; case REAUTHENTICATE_REQUEST_CODE: if (resultCode == Activity.RESULT_OK) { // The user successfully authenticated, attempt to refresh the list final Uri refreshUri = mFolder != null ? mFolder.refreshUri : null; if (refreshUri != null) { startAsyncRefreshTask(refreshUri); } } break; case CHANGE_NAVIGATION_REQUEST_CODE: if (ViewMode.isSearchMode(mViewMode.getMode())) { mActivity.setResult(resultCode, data); mActivity.finish(); } else if (resultCode == Activity.RESULT_OK && data != null) { // We have have received a result that indicates we need to navigate to a // different folder or account. This happens if someone navigates using the // drawer on the search results activity. final Folder folder = data.getParcelableExtra(EXTRA_FOLDER); final Account account = data.getParcelableExtra(EXTRA_ACCOUNT); if (folder != null) { onFolderSelected(folder); mViewMode.enterConversationListMode(); } else if (account != null) { switchToDefaultInboxOrChangeAccount(account); mViewMode.enterConversationListMode(); } } break; case VOICE_SEARCH_REQUEST_CODE: if (resultCode == Activity.RESULT_OK) { final ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); if (!matches.isEmpty()) { // not sure how dependable the API is, but it's all we have. // take the top choice. mSearchViewController.onSearchPerformed(matches.get(0)); } } break; } }
From source file:com.android.mms.ui.ComposeMessageActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (LogTag.VERBOSE) { log("onActivityResult: requestCode=" + requestCode + ", resultCode=" + resultCode + ", data=" + data); }/*www. j a v a 2 s . c om*/ mWaitingForSubActivity = false; // We're back! mShouldLoadDraft = false; if (mWorkingMessage.isFakeMmsForDraft()) { // We no longer have to fake the fact we're an Mms. At this point we are or we aren't, // based on attachments and other Mms attrs. mWorkingMessage.removeFakeMmsForDraft(); } if (requestCode == REQUEST_CODE_PICK) { mWorkingMessage.asyncDeleteDraftSmsMessage(mConversation); } if (requestCode == REQUEST_CODE_ADD_CONTACT) { // The user might have added a new contact. When we tell contacts to add a contact // and tap "Done", we're not returned to Messaging. If we back out to return to // messaging after adding a contact, the resultCode is RESULT_CANCELED. Therefore, // assume a contact was added and get the contact and force our cached contact to // get reloaded with the new info (such as contact name). After the // contact is reloaded, the function onUpdate() in this file will get called // and it will update the title bar, etc. if (mAddContactIntent != null) { String address = mAddContactIntent.getStringExtra(ContactsContract.Intents.Insert.EMAIL); if (address == null) { address = mAddContactIntent.getStringExtra(ContactsContract.Intents.Insert.PHONE); } if (address != null) { Contact contact = Contact.get(address, false); if (contact != null) { contact.reload(); } } } } if (resultCode != RESULT_OK) { if (LogTag.VERBOSE) log("bail due to resultCode=" + resultCode); return; } switch (requestCode) { case REQUEST_CODE_CREATE_SLIDESHOW: if (data != null) { WorkingMessage newMessage = WorkingMessage.load(this, data.getData()); if (newMessage != null) { // Here we should keep the subject from the old mWorkingMessage. setNewMessageSubject(newMessage); mWorkingMessage = newMessage; mWorkingMessage.setConversation(mConversation); updateThreadIdIfRunning(); drawTopPanel(false); drawBottomPanel(); updateSendButtonState(); } } break; case REQUEST_CODE_TAKE_PICTURE: { // create a file based uri and pass to addImage(). We want to read the JPEG // data directly from file (using UriImage) instead of decoding it into a Bitmap, // which takes up too much memory and could easily lead to OOM. File file = new File(TempFileProvider.getScrapPath(this)); Uri uri = Uri.fromFile(file); // Remove the old captured picture's thumbnail from the cache MmsApp.getApplication().getThumbnailManager().removeThumbnail(uri); addImageAsync(uri, false); break; } case REQUEST_CODE_ATTACH_IMAGE: { if (data != null) { addImageAsync(data.getData(), false); } break; } case REQUEST_CODE_TAKE_VIDEO: Uri videoUri = TempFileProvider.renameScrapFile(".3gp", null, this); // Remove the old captured video's thumbnail from the cache MmsApp.getApplication().getThumbnailManager().removeThumbnail(videoUri); addVideoAsync(videoUri, false); // can handle null videoUri break; case REQUEST_CODE_ATTACH_VIDEO: if (data != null) { addVideoAsync(data.getData(), false); } break; case REQUEST_CODE_ATTACH_SOUND: { // Attempt to add the audio to the attachment. Uri uri = (Uri) data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); if (uri == null) { uri = data.getData(); } else if (Settings.System.DEFAULT_RINGTONE_URI.equals(uri)) { break; } addAudio(uri); break; } case REQUEST_CODE_RECORD_SOUND: if (data != null) { addAudio(data.getData()); } break; case REQUEST_CODE_ECM_EXIT_DIALOG: boolean outOfEmergencyMode = data.getBooleanExtra(EXIT_ECM_RESULT, false); if (outOfEmergencyMode) { sendMessage(false); } break; case REQUEST_CODE_PICK: if (data != null) { processPickResult(data); } break; case REQUEST_CODE_ADD_RECIPIENTS: insertNumbersIntoRecipientsEditor(data.getStringArrayListExtra(SelectRecipientsList.EXTRA_RECIPIENTS)); break; default: if (LogTag.VERBOSE) log("bail due to unknown requestCode=" + requestCode); break; } }
From source file:com.rfo.basic.Run.java
public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case REQUEST_CONNECT_DEVICE_SECURE: // When DeviceListActivity returns with a device to connect if ((resultCode == Activity.RESULT_OK) && (mInterpreter != null)) { mInterpreter.connectDevice(data, bt_Secure); }/*www .j a v a 2s. c o m*/ break; case REQUEST_CONNECT_DEVICE_INSECURE: // When DeviceListActivity returns with a device to connect if ((resultCode == Activity.RESULT_OK) && (mInterpreter != null)) { mInterpreter.connectDevice(data, false); } break; case REQUEST_ENABLE_BT: // When the request to enable Bluetooth returns if (resultCode == Activity.RESULT_OK) { // Bluetooth is now enabled, so set up a chat session bt_enabled = 1; } else { bt_enabled = -1; } break; case VOICE_RECOGNITION_REQUEST_CODE: if (resultCode == RESULT_OK) { sttResults = new ArrayList<String>(); sttResults = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); } sttDone = true; break; } }