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.google.android.marvin.mytalkback.TtsDiscoveryProxyActivity.java

/**
 * Handles the result of a TTS data check. Sends a
 * {@link #BROADCAST_TTS_DISCOVERED} broadcast if the returned data is
 * valid, or no-op otherwise./* w w w. j  a  va2 s .co  m*/
 *
 * @param engine The engine that returned a data check result.
 * @param data The data associated with the result.
 */
private void handleCheckTtsDataResult(TtsEngineInfo engine, Intent data) {
    if (data == null) {
        // broadcast failure for engine?
        return;
    }

    final ArrayList<String> availableLangs = data.getStringArrayListExtra(Engine.EXTRA_AVAILABLE_VOICES);
    if (availableLangs == null) {
        // broadcast failure for engine?
        return;
    }

    // Send a broadcast to TalkBack containing discovery information.
    final Intent broadcastIntent = new Intent(BROADCAST_TTS_DISCOVERED);
    broadcastIntent.putExtra(EXTRA_ENGINE_NAME, engine.name);
    broadcastIntent.putExtra(EXTRA_AVAILABLE_LANGUAGES, availableLangs);

    mBroadcastManager.sendBroadcast(broadcastIntent);
}

From source file:me.tylerbwong.pokebase.gui.fragments.PokebaseFragment.java

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

    if (requestCode == RECOGNIZER_REQ_CODE && data != null) {
        searchInput.setText(data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS).get(0));
        refreshData();/*from   w w w.  jav  a2  s .  c  o m*/
    }
}

From source file:com.smapley.vehicle.activity.SetActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    try {/*  w  ww . ja  v  a  2s. c  o  m*/
        if (resultCode == RESULT_OK) {
            switch (requestCode) {
            case 0:
                List<String> resultList = data.getStringArrayListExtra(MultiImageSelectorActivity.EXTRA_RESULT);
                //?
                Uri sourceUri = Uri.fromFile(new File(resultList.get(0)));
                Uri destinationUri = Uri.fromFile(new File(getCacheDir(), "SampleCropImage.jpeg"));
                UCrop.of(sourceUri, destinationUri).withAspectRatio(1, 1).withMaxResultSize(maxWidth, maxHeight)
                        .start(SetActivity.this);
                break;
            case UCrop.REQUEST_CROP:
                //
                final Uri resultUri = UCrop.getOutput(data);
                File file = new File(resultUri.getPath());
                updatePic(file);
                break;
            }

        }
    } catch (Exception e) {

    }
}

From source file:com.manueldeveloper.SpeechRecognizer.java

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

    // Check the request code
    if (requestCode == REQUEST_CODE) {
        // Check the result code
        if (resultCode == Activity.RESULT_OK) {
            // Get the results
            this.results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
            sendResults();//w  w  w .ja  v  a2s .c  o  m
        } else {
            if (this.speechRecognizerCallbackContext != null) {
                switch (resultCode) {
                case RecognizerIntent.RESULT_NETWORK_ERROR:
                    this.speechRecognizerCallbackContext.error("NETWORK_ERROR");
                    break;
                case RecognizerIntent.RESULT_CLIENT_ERROR:
                    this.speechRecognizerCallbackContext.error("CLIENT_ERROR");
                    break;
                case RecognizerIntent.RESULT_SERVER_ERROR:
                    this.speechRecognizerCallbackContext.error("SERVER_ERROR");
                    break;
                case RecognizerIntent.RESULT_AUDIO_ERROR:
                    this.speechRecognizerCallbackContext.error("AUDIO_ERROR");
                    break;
                case RecognizerIntent.RESULT_NO_MATCH:
                    this.speechRecognizerCallbackContext.error("NO_MATCH");
                    break;
                }
            }
        }
    }
}

From source file:org.catrobat.catroid.ui.ScratchConverterActivity.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == Constants.INTENT_REQUEST_CODE_SPEECH && resultCode == RESULT_OK) {
        List<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
        String spokenText = results.get(0);
        searchProjectsListFragment.searchAndUpdateText(spokenText);
    } else if (requestCode == Constants.INTENT_REQUEST_CODE_CONVERT && resultCode == RESULT_OK) {
        if (!data.hasExtra(Constants.INTENT_SCRATCH_PROGRAM_DATA)) {
            super.onActivityResult(requestCode, resultCode, data);
            return;
        }/*  w w  w .  ja v a  2  s.  co  m*/
        final ScratchProgramData projectData = data.getParcelableExtra(Constants.INTENT_SCRATCH_PROGRAM_DATA);
        final List<ScratchProgramData> projectList = new ArrayList<>();
        projectList.add(projectData);
        convertProjects(projectList);
    }
    super.onActivityResult(requestCode, resultCode, data);
}

From source file:rebus.gitchat.ui.MainActivity.java

@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);
        searchView.populateEditText(matches);
    }//w w  w .j ava 2 s.c om
    super.onActivityResult(requestCode, resultCode, data);
}

From source file:com.yibingding.haolaiwu.ViewPagerActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    Intent in = getIntent();
    String string = in.getStringExtra("type");
    if (TextUtils.equals("", string)) {
        adinfos = in.getParcelableArrayListExtra("adinfos");
        Log.e("=============", "===========adinfos.size()===" + adinfos.size());
    } else {//w  ww .j a  v a  2  s  .  c o  m
        list = in.getStringArrayListExtra("list");
        Log.e("=============", "========list.size()==" + list.size());
    }
    int position = getIntent().getIntExtra("position", 0);

    mViewPager = new HackyViewPager(this);
    mViewPager.setBackgroundColor(getResources().getColor(R.color.black));
    setContentView(mViewPager);

    mViewPager.setAdapter(new SamplePagerAdapter());
    mViewPager.setCurrentItem(position);
}

From source file:com.baozi.activity.NpcBusinessRegisterActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQUEST_IMAGE) {
        if (resultCode == RESULT_OK) {
            mSelectPath = data.getStringArrayListExtra(MultiImageSelectorActivity.EXTRA_RESULT);
            StringBuilder sb = new StringBuilder();
            for (String p : mSelectPath) {
                sb.append(p);//from  ww  w.  j  av  a 2s  . co  m
                //                    sb.append("\n");
            }
            Log.i("tag", "sb.toString()" + sb.toString());
            SetImage.setImage(sb.toString(), iv);
            mSelectPath = null;
        }
    }
}

From source file:zblibrary.demo.DEMO.DemoTabFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode != RESULT_OK) {
        return;//from   w w w .j  av a  2  s . c o  m
    }
    switch (requestCode) {
    case REQUEST_TO_PLACE_PICKER:
        if (data != null) {
            ArrayList<String> placeList = data.getStringArrayListExtra(PlacePickerWindow.RESULT_PLACE_LIST);
            if (placeList != null && placeList.size() > PlaceUtil.LEVEL_CITY) {
                tvDemoTabLeft.setText(StringUtil.getTrimedString(placeList.get(PlaceUtil.LEVEL_CITY)));
            }
        }
        break;
    default:
        break;
    }
}

From source file:com.mobicage.rogerthat.plugins.messaging.widgets.TextLineWidget.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQUEST_CODE_VOICE) {
        if (resultCode == Activity.RESULT_OK) {
            TextView txtLbl = (TextView) findViewById(R.id.edit_text);
            ArrayList<String> text = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
            String txt = txtLbl.getText().toString();
            if (!"".equals(txt)) {
                txt = txt + " ";
            }/*from  ww w.  j av  a2  s.c om*/
            for (String str : text) {
                txt = txt + str;
            }
            txtLbl.setText(txt);
        }
    }
}