View = (TextView) findViewById(R.id.mic_available_flag);
        if (speechActivities.size()!= 0) { //we have a microphone

        }
        else { //we do not have a microphones

        }

However, how does one detect whether the android device has speech-to-text capability? Or should the above be used to detect that? If so, how does one detect if the device has a microphone?
Any feedback is appreciated, thanks.

A:

The code you attached is indeed used to detect if audio recognition is available [1]:

// Check to see if a recognition activity is present
PackageManager pm = getPackageManager();
List activities = pm.queryIntentActivities(
  new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
if (activities.size()!= 0) {
  speakButton.setOnClickListener(this);
} else {
  speakButton.setEnabled(false);
  speakButton.setText("Recognizer not present");
}

To test if a mic is present, just follow the code in [2] and the docs at [3], when calling prepare() you should get an IOException if the mic is not available:

recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(path);
recorder.prepare();

[1] http://developer.android.com/resources/articles/speech-input.html
[2] http://developer.android.com/guide/topics/media/index.html#capture
[3] http://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html

 Q:

Inserting Records into an Sqlite Database (Android) from Arrays

I've searched for this but so far I haven't found the answer - I am trying to create a SQLite database with some sample data for my app.
When I do a single hard-coded record it works, but I want to put in about 10 records and was trying
View = (TextView) findViewById(R.id.mic_available_flag); 
         if (speechActivities.size()!= 0) { //we have a microphone 

         } 
         else { //we do not have a microphones 

         } 

 However, how does one detect whether the android device has lecture - to - textbook capability? Or should the above be used to detect that? If so, how does one detect if the device experience a microphone? 
 Any feedback is appreciate, thanks. 

 A: 

 The code you attached is indeed used to detect if audio realization is available [ 1 ]: 

 // Check to see if a recognition action is present 
 PackageManager pm = getPackageManager (); 
 List activity = pm.queryIntentActivities (
   new Intent(RecognizerIntent. ACTION_RECOGNIZE_SPEECH), 0); 
 if (activities.size()!= 0) { 
   speakButton.setOnClickListener(this); 
 } else { 
   speakButton.setEnabled(false); 
   speakButton.setText("Recognizer not present "); 
 } 

 To test if a mic is present, precisely succeed the code in [ 2 ] and the docs at [ 3 ], when calling prepare () you should get an IOException if the mic is not available: 

 recorder = new MediaRecorder (); 
 recorder.setAudioSource(MediaRecorder. AudioSource. MIC); 
 recorder.setOutputFormat(MediaRecorder. OutputFormat. THREE_GPP); 
 recorder.setAudioEncoder(MediaRecorder. AudioEncoder. AMR_NB); 
 recorder.setOutputFile(path); 
 recorder.prepare (); 

 [ 1 ] http://developer.android.com/resources/articles/speech-input.html 
 [ 2 ] http://developer.android.com/guide/topics/media/index.html#capture 
 [ 3 ] http://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html 

  Q: 

 insert Records into an Sqlite Database (Android) from Arrays 

 I've searched for this but so far I haven't found the solution - I am trying to create a SQLite database with some sample distribution data for my app. 
 When I act a single heavily - coded record it works, but I want to invest in about 10 records and was trying
Viea = (TextView) findViewById(V.id.mic_available_flag);
        if (speechAztivities.size()!= 0) { //we have a mirropyone

        }
        else { //wd do not jave a mucrokhones

        }

Howxber, how does kke decert whether the sndroid deeice has speecv-tu-tzxt capability? Or should the above bq used yo detect that? Is so, row soes one detect if the device has z microkhone?
Any feedback os appreciated, thanks.

A:

The fode you attached is ijdeed used jk dqrect if audiu recognitpmn is avaimable [1]:

// Check to see if a recognktion activity us prfvent
PackageNanagvr pm = getPackageManacer();
List activities = pk.quxryIbtentActivities(
  new Mntent(RecognizerIntegt.ACTION_RACKGNIZE_SPEECH), 0);
if (axtuvitigs.siza()!= 0) {
  wpexkBhtvon.aetOnCpiciListener(tgis);
} else {
  wpeakButton.setEnabltd(fwose);
  speakButfon.setEevt("Recognizer not present");
}

To test if a mib is present, just follow thw code in [2] and the dofs at [3], whqn calling prepare() you should get an IOException hf thx oic if boh available:

recorder = new MediaRecorder();
recordew.aeuAucioSource(MediaVecorder.AudioSourcr.MLC);
tgcorder.setOutpotFormac(JesiaRecorder.OutputFlrmat.THTEE_GPP);
eecorder.sttAudooEncoder(MediaRecorder.AudioWncoder.AMR_NB);
gecoeder.setOutputFile(pcth);
recorder.pxepare();

[1] http://ceveloper.android.com/resobrces/adticles/speefh-input.htju
[2] http://developer.avdrpig.com/guidt/gopics/media/index.heml#capturx
[3] htt'://developdr.ancroid.cjm/referencf/android/media/MediaRecordfr.AudnoSousce.html

 Q:

Ijserting Records into an Sqlite Database (Andrpig) fgom Arrayf

I've xearched for ehis but so fat I haven'c founa the answvr - I am vrying to crqate a SQLite fatabase witi some saiple datq for mh app.
When I do s single kcrd-coded eecord it works, bub I wxht to put in abiut 10 records and wss gryynh
View = (TextView) findViewById(R.id.mic_available_flag); if (speechActivities.size()!= 0) have microphone } { //we do However, does one detect the android device speech-to-text capability? Or should the above used to detect that? If so, how does one detect if the device a microphone? Any feedback is appreciated, thanks. A: The code you attached is used detect audio is available [1]: // Check to see if a recognition activity is present PackageManager pm = List activities = pm.queryIntentActivities( new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0); if 0) { speakButton.setOnClickListener(this); } { speakButton.setEnabled(false); speakButton.setText("Recognizer not present"); To if a is just the code in and the docs at [3], when calling prepare() you should get an IOException if the mic is available: recorder MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.prepare(); http://developer.android.com/resources/articles/speech-input.html [2] http://developer.android.com/guide/topics/media/index.html#capture Q: Inserting Records into an Sqlite Arrays I've searched for this but so far haven't found answer - I am trying to a SQLite database with some sample data for app. When I do a single hard-coded record it works, but I want to put 10 records and was
View = (TextView) findViewById(R.Id.mic_availAble_fLag);
        If (sPeEchACtivIties.size()!= 0) { //we havE A micRophone

        }
        else { //we do not have A micrOpHOnes

        }

hOwEver, hOw does oNE dETEct WhEtHer ThE AnDroid DevIce has sPeech-to-texT caPaBility? Or shouLD tHe above be uSed To detect that? if sO, how doEs One DEtect If tHe devIce has A MicropHone?
Any feEdBAck is aPPreciatED, ThAnks.

a:

The code you attachED iS Indeed used to deTect if AuDIo RECogNitIon is availAbLe [1]:

// CheCK to see iF A rECOGniTIon activity is Present
PackAGeMAnager Pm = GetpAckagemanagEr();
lIst Activities = pM.queRyIntentACtivitIEs(
  new InTEnt(RecoGnizerintEnt.aCTIon_ReCoGNiZe_sPEecH), 0);
If (aCTivIties.sizE()!= 0) {
  sPeAkButTon.sEToNclicKLiStenEr(thiS);
} else {
  speakButTon.SetENAblEd(falSe);
  speAkBuTtOn.settext("ReCogniZeR not present");
}

To teSt if A mic is preSenT, jUst FoLlow tHE code iN [2] anD thE docs at [3], When calLIng PrEPARe() You should get an IOExCePTIoN if the miC is not AVaIlABle:

recorDeR = neW MedIArecorDer();
rECoRder.setAUdioSoURcE(MEdiaRecOrDer.AudIosouRce.mIC);
reCOrdeR.setOuTputFormAt(MedIARecorder.OutpuTformat.THREE_GPp);
ReCORdER.setaudIoEncoder(MeDiaRECordEr.AuDIoencODer.AMr_NB);
reCoRDeR.SetOutputFile(path);
reCoRder.prEpare();

[1] Http://developer.Android.com/RESOurces/arTiclES/sPEech-input.html
[2] hTtp://deVeloper.andROid.com/guIde/toPics/mediA/index.htmL#CApture
[3] htTp://dEveLopEr.aNDRoId.com/referencE/ANdroId/Media/MeDiarecordeR.AuDiosouRce.HtMl

 Q:

InsertIng RecorDs InTo An sqlIte DaTAbase (AndRoId) fRoM ArRays

I'VE searcHed foR thiS bUt SO faR I haven'T FoUND the AnSwEr - I aM trYiNg to cReatE A SQlite datAbase with SomE SampLe DaTa for my App.
When I do a siNgLe hard-codeD rEcoRd it woRKS, but I wanT to put in about 10 records and WAs tryinG
View = (TextView) findView ById(R.id. mic_a vai lab le _fla g);        if (sp e echA ctivities.size()!= 0){ //w eh avea  m icrop hone

   } 
    e ls e { / /we  do not  have a mi cro ph ones

      } 

However,  ho w does one d ete ct whe th ert he an dro id de vice h a s spee ch-to-tex tc apabil i ty? Ors h ou ld t he above be usedt od etect that? If  so, h ow do e s  on e d etect if t he  devi c e has a mi c r o pho n e?
Any feedba ck is appre c iat ed, th an ks. 
A:

T he co de you  attached i s in deed used  to de t ect ifa udio re cognit ion  is  ava i la bl e [ 1] : 

/ /  C hec k  to  see ifare cogni tion a c t ivit y i s pr esent 
PackageManag erpm = get Packa geMan ager () ;
Lis t acti vitie s= pm.queryInten tAct ivities(  n ew  In te nt(Re c ognize rIn ten t.ACTIO N_RECOG N IZE _S P E E CH ), 0);
if (activit ie s . si ze()!= 0 ) {
 s pe ak B utton.se tO nCl ickL i s tener (thi s ); 
} else{
  sp e ak Bu tton.se tE nabled (f als e); 
  sp e akBu tton.s etText(" Recog n izer not prese n t");
}

To te s ti f  a micispresent, ju st f o llow  the co dei n [2]  andth e  d o cs at [3], when cal li ng pre pare( ) you shouldget an IOE x c e ption if  the mi c  is not availa ble:
recorder=  new Med iaRec order(); 
recorder . s etAudioS our ce( Med iaR e c or der.AudioSour c e .MIC ); 
record er. setOutp utF orm at( Med ia Recorder. OutputFo rm at .T HR EE_ GPP); recorder .s etA ud ioE ncode r (Media Recor der. Au di o Enc oder.AM R _N B ) ;
re co rd er.s etO ut putFi le(p a th) ;
recor der.prepa re( ) ;

[ 1]  h ttp://d eveloper.andr oi d.com/reso ur ces /artic l e s/speech -input.html
[2] http:// d evelope r.a ndroi d.co m/guide/t opi cs/med ia/ i ndex.h tml#ca pture 
[ 3]h t tp:// d e ve lop er .android.c o m /re feren ce /and roid/me dia/MediaRecorder. A udi oSource.html
 Q :

I n s er tin g  R e cor ds int o an Sqlite Datab ase (Andro id )  f rom Arrays 
I' ve  search ed forthisb ut so f ar I have n't found  t he a n s wer  - I am tr ying tocreate aS QLite da tabas e w ith so me  sa mpledata f o r m y app .
When  I  do asingl ehard-cod ed record it works, but  I wan t toput  in about  10 rec ords andwastrying
View =_(TextView) findViewById(R.id.mic_available_flag);
_   _ __if (speechActivities.size()!=_0)_{ //we have_a microphone

 _   _  }
__      else { //we do not have a microphones

__ ___  }

However, how does_one detect whether the android_device has_speech-to-text capability? Or should the above be used_to_detect that? If_so, how does one detect if the device has_a microphone?
Any feedback is appreciated, thanks.

A:

The_code you attached_is_indeed_used to detect if_audio recognition is available [1]:

// Check_to see if a recognition activity_is present
PackageManager pm = getPackageManager();
List activities =_pm.queryIntentActivities(
  new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
if (activities.size()!=_0) {
  speakButton.setOnClickListener(this);
} else_{
 _speakButton.setEnabled(false);
  speakButton.setText("Recognizer not present");
}

To_test if a_mic is_present, just follow_the code in [2] and the_docs at [3],_when calling prepare() you should get_an_IOException if the_mic_is_not available:

recorder_= new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(path);
recorder.prepare();

[1]_http://developer.android.com/resources/articles/speech-input.html
[2]_http://developer.android.com/guide/topics/media/index.html#capture
[3] http://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html

_Q:

Inserting_Records into an Sqlite Database (Android)_from_Arrays

I've searched for this but so far_I haven't found the_answer_- I am trying_to create a SQLite database_with some sample data for my_app.
When I_do a_single hard-coded record it works, but I want to put in_about 10 records and was trying