Saturday, March 31, 2012

[android-developers] Re: Hello Everyone, i have a small Question.about Text_to_Speech activity.

Hello Anirudh,

the thing is that i am using two activities, so the string is getting
dispatched from the first activity...the string is an array list but
since for some reason, the list is not getting carried to the second
activity and used in the TTS method i converted the array list to a
string by using the method tostring().


so basically my problem would be solved if i know why the array list
has to be converted to a string before getting dispatched...


the part of my code which dispatch the string form the first activity
to the second is :

if (BluetoothDevice.ACTION_FOUND.equals(action)) {
// Get the BluetoothDevice object from the Intent
BluetoothDevice device =
intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
// If it's already paired, skip it, because it's been
listed already
if (device.getBondState() !=
BluetoothDevice.BOND_BONDED) {
mNewDevicesArrayAdapter.add(device.getName());
x=device.getName();


fromLat.add(x);


}
// When discovery is finished, change the Activity title
} else if
(BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
setProgressBarIndeterminateVisibility(false);
setTitle(R.string.Scanning_is_Over);


Bundle bundle = new Bundle(1);
String b=fromLat.toString();

bundle.putString("fromLat",b);
Intent intent1=new
Intent(AllthepiecesActivity.this,ttsActivity.class);
intent1.putExtras(bundle);
startActivity(intent1);
startActivityForResult(intent1, 2);


and the TTS code is:

Bundle extras = this.getIntent().getExtras();
final String fLat=extras.getString("fromLat");
inputText.setText(fLat);

and

if (text!=null && text.length()>0) {
Toast.makeText(ttsActivity.this, "Saying: " + text,
Toast.LENGTH_LONG).show();
tts.speak(text, TextToSpeech.QUEUE_ADD, null);
}
// to go to the first activity.
Intent i=new Intent(ttsActivity.this,AllthepiecesActivity.class);
startActivity(i);

On Mar 31, 4:32 pm, Anirudh Loya <loya.anir...@gmail.com> wrote:
> Use If else.. !! When there is braces it shouldnt speak out !
>
>
>
>
>
>
>
>
>
> On Sat, Mar 31, 2012 at 5:23 PM, Soyer <mblack...@gmail.com> wrote:
> > Hello everyone,
>
> > I am using a Text_To_Speech in my application, which is detecting
> > bluetooth signal and give it as a vocal feedback, the application is
> > perfectly working, is just the given list of devices are given in
> > brackets hence the text_to_speech is saying: Left Bracket,.......,
> > Right bracket.
>
> > I wonder if there is a way to remove the brackets ?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscribe@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
>
> Thank you****
>
> Anirudh Loya | Android Developer**
>
> Desk: +9140-30681824 | Mobile: +91*9246561265*
>
> *Love your Job but don't Love your company, Because you may not know when
> your company stops loving you.--  Voice Of Love*

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment