List of usage examples for android.content Intent getStringArrayListExtra
public ArrayList<String> getStringArrayListExtra(String name)
From source file:com.sunildhaker.watch.heart.ConnectActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == SPEECH_REQUEST_CODE && resultCode == RESULT_OK) { List<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); spokenText = results.get(0);/*from ww w . j a v a 2 s. com*/ gotText = true; btn.setImageDrawable(getResources().getDrawable(R.drawable.send)); // Do something with spokenText Toast.makeText(this, spokenText, Toast.LENGTH_SHORT).show(); } else { Toast.makeText(this, "Didn't caught anything :(", Toast.LENGTH_SHORT).show(); } super.onActivityResult(requestCode, resultCode, data); }
From source file:com.manotaurgames.castro.sample.MainFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK) { ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); if (matches.size() > 0) { Log.d(TAG, matches.get(0));/* w ww . j a v a 2 s . c o m*/ sendMessage(matches.get(0)); } } super.onActivityResult(requestCode, resultCode, data); }
From source file:org.lol.reddit.activities.MoreCommentsListingActivity.java
public void onCreate(final Bundle savedInstanceState) { PrefsUtility.applyTheme(this); super.onCreate(savedInstanceState); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); OptionsMenuUtility.fixActionBar(this, getString(R.string.app_name)); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); sharedPreferences.registerOnSharedPreferenceChangeListener(this); final boolean solidblack = PrefsUtility.appearance_solidblack(this, sharedPreferences) && PrefsUtility.appearance_theme(this, sharedPreferences) == PrefsUtility.AppearanceTheme.NIGHT; // TODO load from savedInstanceState final View layout = getLayoutInflater().inflate(R.layout.main_single); if (solidblack) layout.setBackgroundColor(Color.BLACK); setContentView(layout);/*from w w w. j a v a 2 s.c om*/ RedditAccountManager.getInstance(this).addUpdateListener(this); if (getIntent() != null) { final Intent intent = getIntent(); final ArrayList<String> urls = intent.getStringArrayListExtra("urls"); for (final String url : urls) { final RedditURLParser.RedditURL redditURL = RedditURLParser .parseProbableCommentListing(Uri.parse(url)); if (redditURL != null) { mUrls.add(redditURL); } } doRefresh(RefreshableFragment.COMMENTS, false); } else { throw new RuntimeException("Nothing to show! (should load from bundle)"); // TODO } }
From source file:com.example.swipeuiforupclose.MainActivity.java
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && null != data && requestCode == REQUEST_CODE) { ArrayList<String> text = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); Toast.makeText(getApplicationContext(), "Great Job !", Toast.LENGTH_SHORT).show(); EditText et = (EditText) findViewById(R.id.et_about_me_text); et.setText(text.get(0));// ww w . j av a2 s . com } }
From source file:com.jaspersoft.android.jaspermobile.activities.library.LibraryPageFragment.java
@OnActivityResult(VOICE_COMMAND) final void voiceCommandAction(int resultCode, Intent data) { if (resultCode != Activity.RESULT_OK) return;//from w ww .j a va2s . c o m ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); if (libraryControllerFragment != null) { libraryControllerFragment.handleVoiceCommand(matches); } }
From source file:com.anenn.photopick.ImagePagerActivity.java
private void initValue() { Intent intent = getIntent(); mShowUris = intent.getStringArrayListExtra(SHOW_URIS); mPagerPosition = intent.getIntExtra(PAGER_POSITION, -1); mEditable = intent.getBooleanExtra(EDITABLE, false); String mSingleUri = intent.getStringExtra(SINGLE_URI); if (mSingleUri != null) { mShowUris = new ArrayList<>(); mShowUris.add(mSingleUri);/*from www . j a v a2 s. c o m*/ mPagerPosition = 0; } View customActionBar = getLayoutInflater().inflate(R.layout.layout_image_pager_actionbar, null); tvImagePos = (TextView) customActionBar.findViewById(R.id.imagePos); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { if (mEditable) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(false); actionBar.setIcon(android.R.color.transparent); actionBar.setCustomView(customActionBar); actionBar.setDisplayShowCustomEnabled(true); viewPager.setBackgroundColor(getResources().getColor(R.color.bg_grep)); viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { setPosDisplay(position); } @Override public void onPageScrollStateChanged(int state) { } }); setPosDisplay(0); } else { actionBar.hide(); viewPager.setBackgroundColor(getResources().getColor(android.R.color.black)); } } initPager(); }
From source file:com.corumgaz.mobilsayac.VoiceRecognizer.VoiceRecognizer.java
/** * Handle the results from the recognition activity. *///w ww .ja va 2s . c om @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { // Fill the list view with the strings the recognizer thought it could have heard ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); returnSpeechResults(matches); } else { // Failure - Let the caller know this.callbackContext.error(Integer.toString(resultCode)); } super.onActivityResult(requestCode, resultCode, data); }
From source file:com.perm.DoomPlay.SearchVkActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 23 && resultCode == RESULT_OK) { editQuery.setText(data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS).get(0)); }// ww w . j av a 2 s . com super.onActivityResult(requestCode, resultCode, data); }
From source file:net.xisberto.phonetodesktop.LinkListActivity.java
private void updateMainLayout(Intent intent) { if ((intent.getAction() != null) && (intent.getAction().equals(GoogleTasksActivity.ACTION_LIST_TASKS))) { ids = intent.getStringArrayListExtra("ids"); titles = intent.getStringArrayListExtra("titles"); done = intent.getBooleanExtra("done", false); }// w w w . ja v a2 s . c om TextView text = (TextView) findViewById(R.id.textView_linkList); ListView list_view = (ListView) findViewById(R.id.listView_linkList); if (done) { findViewById(R.id.progressBar_linkList).setVisibility(View.GONE); if ((titles == null) || (titles.size() < 1)) { text.setText(R.string.txt_empty_list); list_view.setVisibility(View.GONE); text.setVisibility(View.VISIBLE); } else { //We're using LinkedHashMap to guarantee the order of insertion HashMap<String, String> tasks = new LinkedHashMap<String, String>(); for (int i = 0; i < titles.size(); i++) { tasks.put(ids.get(i), titles.get(i)); } TasksArrayAdapter adapter = new TasksArrayAdapter(this, tasks); list_view.setAdapter(adapter); list_view.setVisibility(View.VISIBLE); text.setVisibility(View.GONE); } } else { findViewById(R.id.progressBar_linkList).setVisibility(View.VISIBLE); list_view.setVisibility(View.GONE); text.setVisibility(View.GONE); } }
From source file:com.hollowsoft.smarthome.view.MainScreen.java
@Override protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) { if (requestCode == 1337) { if (resultCode == RESULT_OK) { final TextView textView = (TextView) findViewById(R.id.text_name); final ArrayList<String> textList = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); final StringBuilder builder = new StringBuilder(); for (final String string : textList) { builder.append(string).append("\n"); }//from ww w.java 2 s.c om textView.setText(builder.toString()); } } }