/** {@link} */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /// read extra parameters in intent Intent intent = getIntent(); mAccount = intent.getParcelableExtra(EXTRA_ACCOUNT); mRemotePaths = intent.getStringArrayListExtra(EXTRA_REMOTE_PATHS); mLocalPaths = intent.getStringArrayListExtra(EXTRA_LOCAL_PATHS); mStorageManager = new FileDataStorageManager(mAccount, getContentResolver()); mHandler = new Handler(); if (mCurrentDialog != null) { mCurrentDialog.dismiss(); mCurrentDialog = null; } /// load generic layout setContentView(R.layout.generic_explanation); /// customize text message TextView textView = (TextView) findViewById(R.id.message); String appName = getString(R.string.app_name); String message = String.format( getString(R.string.sync_foreign_files_forgotten_explanation), appName, appName, appName, appName, mAccount.name); textView.setText(message); textView.setMovementMethod(new ScrollingMovementMethod()); /// load the list of local and remote files that failed ListView listView = (ListView) findViewById(R.id.list); if (mLocalPaths != null && mLocalPaths.size() > 0) { mAdapter = new ErrorsWhileCopyingListAdapter(); listView.setAdapter(mAdapter); } else { listView.setVisibility(View.GONE); mAdapter = null; } /// customize buttons Button cancelBtn = (Button) findViewById(R.id.cancel); Button okBtn = (Button) findViewById(R.id.ok); okBtn.setText(R.string.foreign_files_move); cancelBtn.setOnClickListener(this); okBtn.setOnClickListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_food); // インテントで渡されたデータをロードする。 Intent home_work_getIntent = getIntent(); homework_send_strArray = home_work_getIntent.getStringArrayListExtra("homework_data"); Intent memo_getIntent = getIntent(); memo_send_strArray = memo_getIntent.getStringArrayListExtra("memo_data"); Intent food_data_getIntent = getIntent(); data = food_data_getIntent.getStringArrayExtra("DATA"); Intent food_int_getIntent = getIntent(); num = food_int_getIntent.getIntExtra("NUM", 0); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(TAG, "onActivityResult"); super.onActivityResult(requestCode, resultCode, data); if (data == null) { Log.d(TAG, "onActivityResult but data is null"); return; } switch (requestCode) { case SelectLeagueActivity.ACTION_SELECT_LEAGUE: { // handle select league result (return a league id list) ArrayList<String> selectedList = null; selectedList = data.getStringArrayListExtra(SelectLeagueActivity.KEY_SELECTED_LEAGUE); if (selectedList == null) { Log.d(TAG, "onActivityResult but select league list is null"); return; } Log.d(TAG, "onActivityResult, select league list is " + selectedList); // Set<String> selectedSet = new HashSet<String>(); selectedSet.clear(); selectedSet.addAll(selectedList); leagueManager.setFilterLeagueSet(selectedSet); oddsManager.setFilterLeagueIdList(selectedList); this.reloadListDataAndView(); } break; case SelectCompanyActivity.ACTION_SELECT_COMPANY: { // handle companyId here ArrayList<String> selectedList = null; selectedList = data.getStringArrayListExtra(SelectCompanyActivity.KEY_SELECTED_COMPANY); if (selectedList == null) { Log.d(TAG, "onActivityResult but select company list is null"); return; } Log.d(TAG, "onActivityResult, select company list is " + selectedList); setCompanyIdFromList(selectedList); loadAllOddsData(); this.reloadListDataAndView(); } break; default: break; } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == SPEECH_REQUEST && resultCode == RESULT_OK) { List<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); String spokenText = results.get(0); System.out.println("spokenText = " + spokenText); try { String[] transfer = spokenText.split(" "); quantity = Integer.parseInt(transfer[0]); divise = transfer[1]; // Do something with spokenText. Intent intent = new Intent(this, PinActivity.class); intent.putExtra("target", target); intent.putExtra("quantity", quantity); intent.putExtra("divise", divise); startActivity(intent); } catch (Exception e) { } } super.onActivityResult(requestCode, resultCode, data); }
// 인텐트 받아왔을 때.. 근데 이거 있으면 onStart 호출 불가 protected void onNewIntent(Intent intent) { super.onNewIntent(intent); setIntent(intent); // if (intent.hasExtra("bm")) { // Log.d("MainActivity : ", "bm is not null"); // // bm = intent.getParcelableExtra("bm"); // adapterViewPager.setImageView(bm); // // } else { // Log.d("MainActivity : ", "bm is null"); // } if (intent.hasExtra("card")) { adapterViewPager.setCardItem((Card) intent.getParcelableExtra("card")); } if (intent.hasExtra("keyword")) { keyword = intent.getStringArrayListExtra("keyword"); Log.d("In mainActivity : ", keyword.get(0)); Log.d("In mainActivity : ", keyword.get(1)); Log.d("In mainActivity : ", keyword.get(2)); Log.d("In mainActivity : ", keyword.get(3)); Log.d("In mainActivity : ", keyword.get(4)); // FirstFragment fragment = new FirstFragment(); // Bundle bundle = new Bundle(); // bundle.putStringArrayList("keyword", keyword); // fragment.setArguments(bundle); adapterViewPager.getFirstFragment().getkeyword(keyword); } }
/** * Overrides parent's onCreate method. Sets player, opponents and health bars. * * @param savedInstanceState */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent getIntent = getIntent(); player = (Player) getIntent.getSerializableExtra("player"); level = getIntent.getStringExtra("level"); opponents = new ArrayList<Opponent>(); playerProgressBar = (ProgressBar) findViewById(R.id.playerProgressBar); opProgressBar = (ProgressBar) findViewById(R.id.oppProgressBar); playerHealth = (TextView) findViewById(R.id.playerHealthTextView); opHealth = (TextView) findViewById(R.id.oppTextView); opList = getIntent.getStringArrayListExtra("opList"); opponents = (ArrayList<Opponent>) getIntent.getSerializableExtra("opponents"); displayedResults = false; if (opList == null) { opList = new ArrayList<String>(); } if (opponents == null) { opponents = new ArrayList<Opponent>(); } setContentView(R.layout.activity_fight); setContent(); totalEnemyHP = 0; for (Opponent enemy : opponents) { totalEnemyHP += enemy.getTotalHealth(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_endereco); Intent intentEndereco = getIntent(); dadosCEP = intentEndereco.getStringArrayListExtra(MainActivity.EXTRA_MESSAGE); ArrayList<TextView> viewEnderecos = new ArrayList<TextView>(); ArrayList<TextView> viewLabel = new ArrayList<TextView>(); /* * Referenciando campos à serem escritos na Activity que apresenta os dados de * determinado endereço. */ viewEnderecos.add((TextView) findViewById(R.id.editLogradouro)); viewEnderecos.add((TextView) findViewById(R.id.editBairro)); viewEnderecos.add((TextView) findViewById(R.id.editCidade)); viewEnderecos.add((TextView) findViewById(R.id.editEstado)); // Alguns Cep's não retornam logradouro e bairro somente cidade e estado. viewLabel.add((TextView) findViewById(R.id.textLogradouro)); viewLabel.add((TextView) findViewById(R.id.textBairro)); for (int i = 0; i < viewEnderecos.size(); i++) { // Verificando se campos estão vazios para não exibir o Label correspondente. if (dadosCEP.get(i).equalsIgnoreCase("") || dadosCEP.get(i).equalsIgnoreCase(" ")) { viewLabel.get(i).setText(""); } else { viewEnderecos.get(i).setText(dadosCEP.get(i)); } } }
// Need to add this here since the ZXing library creates a new activity from activity, not // fragment @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); if (scanResult != null) { mCodeText = scanResult.getContents(); setCode(mCodeText); } else if (requestCode == VOICE_RECOGNITION_REQUEST_CODE) { if (resultCode == Activity.RESULT_OK) { ArrayList<String> textMatchList = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); if (!textMatchList.isEmpty()) { String text = textMatchList.get(0); TextView textView = (TextView) findViewById(R.id.cart_grocery_edit_name); textView.setText(text); } } else if (resultCode == RecognizerIntent.RESULT_AUDIO_ERROR) { makeToast("Audio error"); } else if (resultCode == RecognizerIntent.RESULT_CLIENT_ERROR) { makeToast("Client error"); } else if (resultCode == RecognizerIntent.RESULT_NETWORK_ERROR) { makeToast("Network error"); } else if (resultCode == RecognizerIntent.RESULT_NO_MATCH) { makeToast("Please repeat the item"); } else if (resultCode == RecognizerIntent.RESULT_SERVER_ERROR) { makeToast("Server error"); } } super.onActivityResult(requestCode, resultCode, data); }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // Check recognition voice Intent if (requestCode == VOICE_RECOGNITION && resultCode == RESULT_OK) { // Results of the recognition order by the successfull trust ArrayList<String> recognitionResult = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); String message = recognitionResult.get(0).toString().toLowerCase(); Toast.makeText(this, getString(R.string.text_recognized) + message, Toast.LENGTH_LONG).show(); int orientation = calculateProvidedOrientation(message); int error = calculateErrorMargin(message); int[] orientation_error = {orientation, error}; // Toast.makeText(this,"El error reconocido es:" + Integer.toString(error), // Toast.LENGTH_LONG).show(); if (checkMessage(message)) { Intent intent = new Intent(this, Compass.class); intent.putExtra(EXTRA_MESSAGE, orientation_error); startActivity(intent); } else { Toast.makeText(this, R.string.compass_suggestion, Toast.LENGTH_LONG).show(); } } }
public void onResume() { super.onResume(); Log.d(TAG, "onResume()"); Intent startingIntent = this.getIntent(); selectedImage = startingIntent.getStringExtra("selected"); Log.d(TAG, "selectedImage: " + selectedImage); oriTitle = startingIntent.getStringExtra("oriTitle"); croppedTitle = startingIntent.getStringExtra("croppedTitle"); annotated = startingIntent.getBooleanExtra("annotated", false); timestamps = startingIntent.getBundleExtra("timestamps"); imageType = startingIntent.getStringExtra("img_type"); Log.d(TAG, "annotated: " + annotated); Log.d(TAG, "nTs: " + timestamps.getLong("tsNot") + ", ts: " + timestamps.getLong("ts")); if (annotated) { this.bubbleTexts = startingIntent.getStringArrayListExtra("texts"); this.bubbleTypes = startingIntent.getIntegerArrayListExtra("types"); Log.d(TAG, "bubbleTexts: " + bubbleTexts.size()); imageType = "annotated"; } if (yourSelectedImage != null) if (yourSelectedImage.isRecycled()) yourSelectedImage.prepareToDraw(); if (imageWithBubbles != null) if (imageWithBubbles.isRecycled()) imageWithBubbles.prepareToDraw(); new WorkerTask().execute(Uri.parse(selectedImage)); }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == FILE_CODE && resultCode == Activity.RESULT_OK) { if (data.getBooleanExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false)) { // For JellyBean and above if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { ClipData clip = data.getClipData(); if (clip != null) { for (int i = 0; i < clip.getItemCount(); i++) { Uri uri = clip.getItemAt(i).getUri(); uploadFile(uri.getPath()); } } } else { ArrayList<String> paths = data.getStringArrayListExtra(FilePickerActivity.EXTRA_PATHS); if (paths != null) { for (String path : paths) { Uri uri = Uri.parse(path); uploadFile(uri.getPath()); } } } } else { Uri uri = data.getData(); uploadFile(uri.getPath()); } } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (data != null) { if (requestCode == 1) { List<String> paths = data.getStringArrayListExtra(PhotoPickerActivity.KEY_SELECTED_PHOTOS); if (paths == null || paths.size() == 0) return; imgs.remove(imgs.size() - 1); for (int i = 0; i < paths.size(); i++) { if (imgs != null && imgs.size() < 6) { imgs.add(paths.get(i)); } else { break; } } if (imgs.size() < 6) { tvImgCount.setText( "(" + ((imgs == null || imgs.size() == 0) ? 0 : imgs.size()) + "/6)"); imgs.add(""); } else { tvImgCount.setText("6/6"); } imgAdapter.upDateList(imgs); if (imgs != null || imgs.size() > 0) { tvEdit.setEnabled(true); } } else if (requestCode == 2) { } } } }
/** * This callback-method has to be called from Fragment.onActivityResult within your fragment with * parameters directly on passthru.<br> * You can check in your fragment if it was really a RecognizerIntent that was handled here, if * so, this method returns true. In this case, you should call super.onActivityResult in your * fragment.onActivityResult. * * <p>If this method returns false, then it wasnt a request with a RecognizerIntent, so you can * handle these other requests as you need. * * @param activityRequestCode if this equals the requestCode specified by constructor, then * results of voice-recognition */ public boolean handleActivityResult( int activityRequestCode, int resultCode, Intent data, EditText textField) { boolean result = false; // handle the result of voice recognition, put it into the textfield if (activityRequestCode == this.requestCode) { // this was handled here, even if voicerecognition fails for any reason // so your program flow wont get chaotic if you dont explicitly state // your own requestCodes. result = true; if (resultCode == Activity.RESULT_OK) { // Fill the quickAddBox-view with the string the recognizer thought it could have heard ArrayList<String> match = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); // make sure we only do this if there is SomeThing (tm) returned if (match != null && match.size() > 0 && match.get(0).length() > 0) { String recognizedSpeech = match.get(0); recognizedSpeech = recognizedSpeech.substring(0, 1).toUpperCase() + recognizedSpeech.substring(1).toLowerCase(); if (append) { textField.setText((textField.getText() + " " + recognizedSpeech).trim()); } else { textField.setText(recognizedSpeech); } } } } return result; }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case 100: { if (resultCode == RESULT_OK && null != data) { atual = viewPager.getCurrentItem(); ArrayList<String> result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); stringSpeak = result.get(0); if (stringSpeak.toLowerCase().contains("next")) { if (atual == (tabs.size() - 1)) { viewPager.setCurrentItem(0); } else { viewPager.setCurrentItem(atual + 1); } } else if (stringSpeak.toLowerCase().contains("back")) { if (atual == 0) { viewPager.setCurrentItem(tabs.size() - 1); } else { viewPager.setCurrentItem(atual - 1); } } else { Toast.makeText(getApplicationContext(), "Invalid Command", Toast.LENGTH_LONG).show(); } } break; } } }
@Override protected void onActivityResult(int requestCode, int resultCode, final Intent data) { if (resultCode == RESULT_OK) { if (requestCode == REQUEST_GALLERY) { if (data.getData() != null) { execute(messenger().sendUri(peer, data.getData()), R.string.pick_downloading); } } else if (requestCode == REQUEST_PHOTO) { messenger().sendPhoto(peer, pending_fileName); } else if (requestCode == REQUEST_VIDEO) { messenger().sendVideo(peer, pending_fileName); } else if (requestCode == REQUEST_DOC) { if (data.getData() != null) { execute(messenger().sendUri(peer, data.getData()), R.string.pick_downloading); } else if (data.hasExtra("picked")) { ArrayList<String> files = data.getStringArrayListExtra("picked"); if (files != null) { for (String s : files) { messenger().sendDocument(peer, s); } } } } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // get instances to upload Intent i = getIntent(); ArrayList<String> instances = i.getStringArrayListExtra(GlobalConstants.KEY_INSTANCES); if (instances == null) { // nothing to upload return; } SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); String url = settings.getString(UserPreferences.KEY_SERVER, getString(R.string.default_server)); String authCredentials = settings.getString(UserPreferences.KEY_USERNAME, getString(R.string.username)) + ":" + settings.getString(UserPreferences.KEY_PASSWORD, getString(R.string.password)); mInstanceUploaderTask = (InstanceUploaderTask) getLastNonConfigurationInstance(); if (mInstanceUploaderTask == null) { // setup dialog and upload task showDialog(PROGRESS_DIALOG); mInstanceUploaderTask = new InstanceUploaderTask(); mInstanceUploaderTask.setUploadServer(url + "/fileUpload?"); mInstanceUploaderTask.setAuthCredentials(authCredentials); totalCount = instances.size(); // convert array list to an array String[] sa = instances.toArray(new String[totalCount]); mInstanceUploaderTask.execute(sa); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.view_details); Intent intent = getIntent(); blipProps = intent.getStringArrayListExtra("Blip Properties"); if (blipProps != null) { TextView dialogName = (TextView) findViewById(R.id.txtName); dialogName.setText(blipProps.get(0)); TextView dialogAddress = (TextView) findViewById(R.id.txtAddress); dialogAddress.setText(blipProps.get(1)); TextView dialogCity = (TextView) findViewById(R.id.txtCity); dialogCity.setText(blipProps.get(2)); TextView dialogState = (TextView) findViewById(R.id.txtState); dialogState.setText(blipProps.get(3)); TextView dialogZip = (TextView) findViewById(R.id.txtZip); dialogZip.setText(blipProps.get(4)); TextView dialogRecord = (TextView) findViewById(R.id.txtRecord); dialogRecord.setText(blipProps.get(5)); TextView dialogViolation = (TextView) findViewById(R.id.txtViolation); dialogViolation.setText(blipProps.get(6)); TextView dialogDesc = (TextView) findViewById(R.id.txtDesc); dialogDesc.setText(blipProps.get(7)); TextView dialogComments = (TextView) findViewById(R.id.txtComments); dialogComments.setText(blipProps.get(8)); TextView dialogAction = (TextView) findViewById(R.id.actionStatus); dialogAction.setText(blipProps.get(9)); ImageView iImage = (ImageView) findViewById(R.id.detailImage); if (blipProps.get(9).equalsIgnoreCase("Abated")) { iImage.setImageResource(R.drawable.clean); } else if (blipProps.get(9).equalsIgnoreCase("Not Abated")) { iImage.setImageResource(R.drawable.td); } else { iImage.setImageResource(R.drawable.tu); } Button dialogButton = (Button) findViewById(R.id.btnCancel); dialogButton.setText("OK"); dialogButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode != RESULT_OK) { // 正しい結果が得られなかった場合の処理 return; } if (requestCode == REQUEST_CODE_PICK_IMAGE) { // 画像を共有へ imageShare(data.getData()); } else if (requestCode == REQUEST_CODE_PICK_IMAGE_TO_MAIL) { // メール添付送信へ sendMail(data.getData()); } else if (requestCode == REQUEST_CODE_RECOGNIZE) { StringBuffer sb = new StringBuffer(); // 認識結果のリストを取得 // 似ている言葉など、複数の結果がある場合もある。 List<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); for (String result : results) { sb.append(result); sb.append("\n"); } // AlertDialogに表示 new AlertDialog.Builder(this).setMessage(sb).show(); } }
@Override public void onInit() { Intent intent = getIntent(); String initSelected = null; if (intent != null) { initSelected = intent.getStringExtra("title"); datas = intent.getStringArrayListExtra("datas"); } if (datas == null) { datas = new ArrayList<String>(); } datas.add("+_add"); if (!TextUtils.isEmpty(initSelected)) { String[] selecteds = initSelected.split(","); for (String key : selecteds) { selected.put(key, key); boolean isExist = false; for (Iterator<String> i = datas.iterator(); i.hasNext(); ) { if (key.equals(i.next())) { isExist = true; break; } } if (!isExist) { datas.add(datas.size() - 1, key); } } } setTitle("亮点标签"); showLeft(true); }
@Override public void onActivityResult(int requestCode, int resultCode, Intent it) { super.onActivityResult(requestCode, resultCode, it); messageList.clear(); if (requestCode != 1) { return; } if (resultCode != RESULT_OK) { return; } List<String> list = it.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); for (String s : list) { messageList.add(s); } Log.d("howmany", String.valueOf(count)); if (edtext != null) { edtext.setText(messageList.get(0)); } else { if (voice < count) { edit1[voice].setText(messageList.get(0)); voice++; Log.d("vvv", String.valueOf(voice)); } else { voice = count - 1; edit1[voice].setText(messageList.get(0)); Log.d("nnn", String.valueOf(voice)); } } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { switch (requestCode) { case REQUEST_TO_PLACE_PICKER: List<String> list = data == null ? null : data.getStringArrayListExtra(PlacePickerWindow.RESULT_PLACE_LIST); if (list == null || list.size() < 2) { CommonUtil.showShortToast(context, "请先选择地址哦~"); CommonUtil.toActivity( context, PlacePickerWindow.createIntent(context, packageName, 2), REQUEST_TO_PLACE_PICKER, false); return; } String place = ""; for (String s : list) { place += s; } tvEditTextInfoPlace.setText(place); break; default: break; } } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) { ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); if (matches.size() > 0) { String firstMatch = matches.get(0); String[] splitted = firstMatch.split("\\smais\\s|\\smas\\s"); List<ItensCompras> itens = new ArrayList<>(splitted.length); for (String nome : splitted) { ItensCompras item = new ItensCompras(); item.setListaCompras(listaCompras); String[] nomeSplit = nome.split(" "); if (nomeSplit.length > 1) { try { Double qtd = Double.parseDouble(nomeSplit[0]); item.setProduto(nomeSplit[1]); item.setQtde(qtd); } catch (NumberFormatException e) { item.setProduto(nome); item.setQtde(0d); } } item.setValorUnitario(0d); itens.add(item); } salvarItens(itens); } } super.onActivityResult(requestCode, resultCode, data); }
protected void onActivityResult(int requestCode, int resultCode, Intent data) { // super.onActivityResult(requestCode, resultCode, data); // 수행을 제대로 한 경우 // 1. 사진 if (resultCode == FROM_IMAGEPIC && data != null) { picturePathLists = data.getStringArrayListExtra("PicturesPath"); } // 2. 음악 else if (resultCode == FROM_MUSICPIC && data != null) { musicPath = data.getStringExtra("musicPath"); mp3Singer = data.getStringExtra("mp3Singer"); mp3Title = data.getStringExtra("mp3Title"); mp3AlbumArtID = data.getIntExtra("mp3AlbumArtID", 0); } // 3. 지도 else if (resultCode == FROM_LOCATIONPIC && data != null) { addr = new AddInfo( data.getStringArrayExtra("addr")[0], data.getStringArrayExtra("addr")[1], data.getStringArrayExtra("addr")[2]); } // 수행을 제대로 하지 못한 경우 else if (resultCode == RESULT_CANCELED) { Toast.makeText(this, "취소", 0).show(); } };
@Override public void onActivityResult(int reqCode, int resultCode, Intent data) { super.onActivityResult(reqCode, resultCode, data); Uri outputFile = Uri.fromFile(new File(getCacheDir(), "cropped")); if (data == null || resultCode != Activity.RESULT_OK) return; switch (reqCode) { case PICK_CONTACT: List<String> selected = data.getStringArrayListExtra("contacts"); for (String contact : selected) { Recipient recipient = RecipientFactory.getRecipientsFromString(this, contact, false).getPrimaryRecipient(); if (!selectedContacts.contains(recipient) && (existingContacts == null || !existingContacts.contains(recipient)) && recipient != null) { addSelectedContact(recipient); } } syncAdapterWithSelectedContacts(); break; case Crop.REQUEST_PICK: new Crop(data.getData()).output(outputFile).asSquare().start(this); break; case Crop.REQUEST_CROP: new DecodeCropAndSetAsyncTask(Crop.getOutput(data)).execute(); } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (ScanOrdersActivity.RESULT_CODE_LOOK_ORDER == resultCode) { // 从订单查看列表页返回 scanList = data.getStringArrayListExtra(ScanOrdersActivity.EXTRA_ORDER_LIST); } else if (OrderExecuteActivity.REQUEST_CODE_EXECUTE_ORDER == resultCode) { // 从订单执行提交页返回,清空扫描订单缓存 scanList.clear(); } else if (RESULT_CODE_ADD_REPORT == resultCode) { // 从异常报告提交页返回,清空扫描订单缓存 scanList.clear(); } mNewOrder = (ExecuteAction) UtilsJava.depthClone(mNewOrder); // 去除重复数据,更新界面提示信息 Set<String> set = new HashSet<String>(); set.addAll(scanList); mTextScanCount.setText( String.format(getString(R.string.barcode_total), PreferencesUtil.ordtitle, set.size())); if (scanList.size() == 0) { mTextOrderNum.setText(""); mTextOrderNum.setBackgroundColor(Color.parseColor("#00000000")); } super.onActivityResult(requestCode, resultCode, data); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1234 && resultCode == RESULT_OK) { String voice_text = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS).get(0); Toast.makeText(getApplicationContext(), voice_text, Toast.LENGTH_LONG).show(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_result); Intent intent = getIntent(); ArrayList<String> first_Choices = new ArrayList<String>(); ArrayList<String> second_Choices = new ArrayList<String>(); first_Choices = intent.getStringArrayListExtra("choiceSet1"); second_Choices = intent.getStringArrayListExtra("choiceSet2"); TextView player1 = (TextView) findViewById(R.id.player1TextView); TextView player2 = (TextView) findViewById(R.id.player2TextView); TextView resultPercent = (TextView) findViewById(R.id.resultPercent); player1.setText(first_Choices.toString()); player2.setText(second_Choices.toString()); Integer match = 0; for (int i = 0; i < 3; i++) { String curr = first_Choices.get(i); if (second_Choices.contains(curr)) { match = match + 1; } else { match = match; } } float newMatch = (float) match / 3; newMatch = newMatch * 100; String results = String.valueOf(newMatch); resultPercent.setText(results + " %"); Button home = (Button) findViewById(R.id.homeButton); home.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(ResultActivity.this, MainActivity.class); startActivity(i); } }); }
private void getCheckedImg() { Intent intent = getIntent(); ArrayList<String> imgDatas = intent.getStringArrayListExtra(ParamConst.CHECKED_IMG_DATAS); if (imgDatas != null) { ImageGridItemContainCheckAdapter.setmSelectedImage(imgDatas); designationPath = new File(imgDatas.get(0)).getParentFile().getAbsolutePath(); } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == VOICE_RECOGNITION_REQUEST_CODE && resultCode == RESULT_OK) { ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); mSearchView.populateEditText(matches); } super.onActivityResult(requestCode, resultCode, data); }
@Override public void onReceive(Context context, Intent intent) { ArrayList<String> selectedImageItems = intent.getStringArrayListExtra("selectedImageItems"); Intent intent2 = new Intent(MainActivity.this, PhotoActivity.class); intent2.putExtra("selectedImageItems", selectedImageItems); startActivityForResult(intent2, 2); }