views:

11

answers:

0

I use this code for voice recognition and it only work on HTC Desire on android OS 2.2 but it doesn't work on samsung galaxy S android 2.1 or Motorola Mile Stone. does anyone know why this happened?

PackageManager pm = getPackageManager(); List activities = pm.queryIntentActivities( new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);

    if (activities.size() != 0) {

   if(haveInternet()==true){
    if (v.getId() == R.id.mic) {
      startVoiceRecognitionActivity();
  }
    }else{
      Toast.makeText(Droidslator.this, "Require internet connection", Toast.LENGTH_SHORT).show();
    }

  }else{
    mic.setEnabled(false);
  }
    }