Example usage for android.content Intent getStringArrayListExtra

List of usage examples for android.content Intent getStringArrayListExtra

Introduction

In this page you can find the example usage for android.content Intent getStringArrayListExtra.

Prototype

public ArrayList<String> getStringArrayListExtra(String name) 

Source Link

Document

Retrieve extended data from the intent.

Usage

From source file:com.activiti.android.ui.fragments.form.picker.IdmPickerFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    switch (requestCode) {
    case RequestCode.TEXT_TO_SPEECH: {
        if (resultCode == Activity.RESULT_OK && data != null) {
            ArrayList<String> text = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
            searchForm.setText(text.get(0));
            search(text.get(0));//w  w w  . ja  va2  s  .co m
        }
        break;
    }
    default:
        break;
    }
}

From source file:org.bishoph.oxdemo.OXDemo.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.v("OXDemo", "onActivityResult " + resultCode + " // " + RESULT_OK);
    if (requestCode == VOICE_RECOGNITION_REQUEST_CODE && resultCode == RESULT_OK) {
        ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
        Log.v("OXDemo", "All text reconition: " + matches);
        if (matches != null && !matches.isEmpty()) {
            String bestResult = matches.get(0).toString();
            if (bestResult != null && bestResult.length() > 0) {
                Log.v("OXDemo", "Best result from text reconition: " + bestResult);
                if (folder_id > -1) {
                    createTask(folder_id, bestResult);
                }//  ww w  . j  a va  2s . com
            }
        }
    }
    super.onActivityResult(requestCode, resultCode, data);
}

From source file:net.olejon.mdapp.Icd10ChapterActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == VOICE_SEARCH_REQUEST_CODE && data != null) {
        ArrayList<String> voiceSearchArrayList = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);

        String voiceSearchString = voiceSearchArrayList.get(0);

        populateListView(voiceSearchString);
    }//from w w w . ja  v a  2  s.  c  om
}

From source file:com.ct.speech.HintReceiver.java

/**
 * Handle the results from the recognition activity.
 *///  w  w  w . j  a  v a 2 s . c o  m
@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);
        speechResults(requestCode, matches);

    } else if (resultCode == Activity.RESULT_CANCELED) {
        // cancelled by user
        speechFailure("Cancelled");
    } else {
        speechFailure("Unknown error");
    }

    super.onActivityResult(requestCode, resultCode, data);
}

From source file:org.protocoderrunner.base.BaseActivity.java

/**
 * Handle the results from the recognition activity.
 *//*from  w ww .jav a  2 s  . com*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == Audio.VOICE_RECOGNITION_REQUEST_CODE && resultCode == RESULT_OK) {
        // Fill the list view with the strings the recognizer thought it
        // could have heard
        ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);

        for (String _string : matches) {
            MLog.d(TAG, "" + _string);
        }

    }

    super.onActivityResult(requestCode, resultCode, data);
}

From source file:net.olejon.mdapp.NasjonaleRetningslinjerActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == VOICE_SEARCH_REQUEST_CODE && data != null) {
        ArrayList<String> voiceSearchArrayList = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);

        String voiceSearchString = voiceSearchArrayList.get(0);

        search(voiceSearchString);/*from   w w w .  j a  v  a  2s .  c o  m*/
    }
}

From source file:com.eugene.fithealthmaingit.UI.NavFragments.FragmentSearch.java

/**
 * Set the text based on google voice then implement search
 *//*www .  j a  v a 2s.c  om*/
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQ_CODE_SPEECH_INPUT) {
        if (resultCode == Activity.RESULT_OK && null != data) {
            ArrayList<String> result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
            edit_text_search.setText(result.get(0));
        }
    }
}

From source file:com.dazone.crewchat.libGallery.activity.BucketHomeFragmentActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == Activity.RESULT_OK) {

        if (requestCode == MediaChooserConstants.BUCKET_SELECT_IMAGE_CODE) {
            addMedia(mSelectedImage, data.getStringArrayListExtra("list"));

        } else if (requestCode == MediaChooserConstants.BUCKET_SELECT_VIDEO_CODE) {
            addMedia(mSelectedVideo, data.getStringArrayListExtra("list"));

        } else if (requestCode == MediaChooserConstants.CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {

            sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, fileUri));
            final AlertDialog alertDialog = MediaChooserConstants.getDialog(BucketHomeFragmentActivity.this)
                    .create();/*ww w  .  j  av  a2s .  co  m*/
            alertDialog.show();

            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    //Do something after 2000ms
                    String fileUriString = fileUri.toString().replaceFirst("file:///", "/").trim();
                    android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
                    BucketImageFragment bucketImageFragment = (BucketImageFragment) fragmentManager
                            .findFragmentByTag("tab1");
                    if (bucketImageFragment != null) {
                        bucketImageFragment.getAdapter().addLatestEntry(fileUriString);
                        bucketImageFragment.getAdapter().notifyDataSetChanged();
                    }
                    alertDialog.dismiss();
                }
            }, 5000);

        } else if (requestCode == MediaChooserConstants.CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE) {

            sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, fileUri));

            final AlertDialog alertDialog = MediaChooserConstants.getDialog(BucketHomeFragmentActivity.this)
                    .create();
            alertDialog.show();
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    //Do something after 2000ms
                    String fileUriString = fileUri.toString().replaceFirst("file:///", "/").trim();
                    android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
                    BucketVideoFragment bucketVideoFragment = (BucketVideoFragment) fragmentManager
                            .findFragmentByTag("tab2");
                    if (bucketVideoFragment != null) {
                        bucketVideoFragment.getAdapter().addLatestEntry(fileUriString);
                        bucketVideoFragment.getAdapter().notifyDataSetChanged();

                    }
                    alertDialog.dismiss();
                }
            }, 5000);
        }
    }
}

From source file:com.nicolls.ablum.activity.BucketHomeFragmentActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == Activity.RESULT_OK) {

        if (requestCode == MediaChooserConstants.BUCKET_SELECT_IMAGE_CODE) {
            addMedia(mSelectedImage, data.getStringArrayListExtra("list"));

        } else if (requestCode == MediaChooserConstants.BUCKET_SELECT_VIDEO_CODE) {
            addMedia(mSelectedVideo, data.getStringArrayListExtra("list"));

        }/*from  w  ww .  ja v  a2 s. co  m*/
        if (mSelectedVideo.size() > 0) {
            Intent videoIntent = new Intent();
            videoIntent.setAction(MediaChooser.VIDEO_SELECTED_ACTION_FROM_MEDIA_CHOOSER);
            videoIntent.putStringArrayListExtra("list", mSelectedVideo);
            sendBroadcast(videoIntent);
        }

        if (mSelectedImage.size() > 0) {
            Intent imageIntent = new Intent();
            imageIntent.setAction(MediaChooser.IMAGE_SELECTED_ACTION_FROM_MEDIA_CHOOSER);
            imageIntent.putStringArrayListExtra("list", mSelectedImage);
            sendBroadcast(imageIntent);
        }
        finish();
        //?
        //         else if (requestCode == MediaChooserConstants.CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE){
        //
        //            sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, fileUri));
        //            final AlertDialog alertDialog = MediaChooserConstants.getDialog(BucketHomeFragmentActivity.this).create();
        //            alertDialog.show();
        //
        //            handler.postDelayed(new Runnable() {
        //               @Override
        //               public void run() {
        //                  //Do something after 2000ms
        //                  String fileUriString = fileUri.toString().replaceFirst("file:///", "/").trim();
        //                  android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
        //                  BucketImageFragment bucketImageFragment = (BucketImageFragment) fragmentManager.findFragmentByTag("tab1");
        //                  if(bucketImageFragment != null){
        //                     bucketImageFragment.getAdapter().addLatestEntry(fileUriString);
        //                     bucketImageFragment.getAdapter().notifyDataSetChanged();
        //                  }
        //                  alertDialog.dismiss();
        //               }
        //            }, 5000);
        //
        //         }else if (requestCode == MediaChooserConstants.CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE){
        //
        //
        //            sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, fileUri));
        //
        //            final AlertDialog alertDialog = MediaChooserConstants.getDialog(BucketHomeFragmentActivity.this).create();
        //            alertDialog.show();
        //            handler.postDelayed(new Runnable() {
        //               @Override
        //               public void run() {
        //                  //Do something after 2000ms
        //                  String fileUriString = fileUri.toString().replaceFirst("file:///", "/").trim();
        //                  android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
        //                  BucketVideoFragment bucketVideoFragment = (BucketVideoFragment) fragmentManager.findFragmentByTag("tab2");
        //                  if(bucketVideoFragment != null){
        //                     bucketVideoFragment.getAdapter().addLatestEntry(fileUriString);
        //                     bucketVideoFragment.getAdapter().notifyDataSetChanged();
        //
        //                  }
        //                  alertDialog.dismiss();
        //               }
        //            }, 5000);
        //         }
    }
}

From source file:com.eugene.fithealthmaingit.UI.ChooseAddMealSearchFragment.java

/**
 * Set the text based on google voice then implement search
 *///from   w ww. j  ava 2s .  co  m
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQ_CODE_SPEECH_INPUT) {
        if (resultCode == Activity.RESULT_OK && null != data) {
            ArrayList<String> result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
            mEtSearch.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
            mEtSearch.setText(result.get(0));
            searchFood(mEtSearch.getText().toString(), 0);
            mItem.clear();
            mEtSearchAdapter.notifyDataSetChanged();
            mEtSearch.clearFocus();
        }
    }
}