Example #1
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == SearchView.SPEECH_REQUEST_CODE && resultCode == RESULT_OK) {
     List<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
     if (results != null && results.size() > 0) {
       String searchWrd = results.get(0);
       if (!TextUtils.isEmpty(searchWrd)) {
         mSearchView.setQuery(searchWrd);
       }
     }
   }
   super.onActivityResult(requestCode, resultCode, data);
 }
Example #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.AppThemeLight);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_toolbar);
    setTitle(null);

    setViewPager();

    // -----------------------------------------------------------------------------------------
    setSearchView();
    mSearchView.setOnMenuClickListener(
        new SearchView.OnMenuClickListener() {
          @Override
          public void onMenuClick() {
            mDrawerLayout.openDrawer(GravityCompat.START); // finish();
            perm(Manifest.permission.RECORD_AUDIO, 0);
          }
        });
    // -----------------------------------------------------------------------------------------

    customSearchView();
  }
Example #3
0
 @Override
 protected void onPostCreate(Bundle savedInstanceState) {
   super.onPostCreate(savedInstanceState);
 }