Firstly to make tts  work in your current activity use   init()  function
which initializes the tts engine for  you in the current  activity .

 secondly you can include the speak function in the onListItenClick()   ,
in which you can get the exat position where it was  cllicked  and get the
text from the array list by passing the position as the index.

Cheers

Tarun


On Mon, Apr 2, 2012 at 9:11 PM, Soyer <mblack...@gmail.com> wrote:

> thanks a lot mate. that worked, i have to resolve the TTS issue now,
> do have any idea about the second part of my thread(Regarding the
> TTS)? i think the tts doesn't accept list view, so i thought of making
> use of a loop to go through the different elements in the list....so
> in this way i can manipulate these elements as well for a better
> result...
>
> for(int i=0; i<=fLat.lastIndexOf(fLat);i++){
>
>          System.out.println("=============================38"+flat[i]);
>  }
>
>
> so i tried the above loop to print out the elements separately (Just
> to see this works) but as we know the syntax of flat[] is for an array
> whilst flat is an arraylist....
>
> any ideas about this matter ?
>
> On Apr 2, 5:36 pm, tarun sablok <tarun.sab...@gmail.com> wrote:
> > You have to use  * flat  = getIntent().
> > getStringArrayListExtra("fromLat");  * to get the  arraylist which has
> been
> > passed  and not  create a new  Intent object to get the list.
> > *
> > *
> > *Cheers *
> > *Tarun*
> > *
> > *
> > *
> > *
> >
> >
> >
> >
> >
> >
> >
> > On Mon, Apr 2, 2012 at 3:43 PM, Soyer <mblack...@gmail.com> wrote:
> > > Sorry i don't know if i am getting you properly, but this one is
> > > different then the other, i found the method how to pass a list from
> > > one activity to another but still for some reason it's not being
> > > passed and it's returning null.
> >
> > > Don't be so hasty to comment before understanding the thread
> > > properly !!!
> >
> > > On Apr 2, 12:03 pm, Zsolt Vasvari <zvasv...@gmail.com> wrote:
> > > > Why spam the list with a new thread?  Your previous one is just
> below.
> > >  If
> > > > you do this, NOBODY is going to help you.
> >
> > > > On Monday, April 2, 2012 5:52:35 AM UTC+8, Soyer wrote:
> >
> > > > > Hello everyone,
> >
> > > > > i posted a question about passing a listview from one activity to
> > > > > another and this is what i did so far..
> >
> > > > > the first activity is this:
> >
> > > > >   Bundle bundle = new Bundle(1);
> >
> > > > >                 bundle.putStringArrayList("fromLat", fromLat);
> >
> > > > >                         Intent intent1=new
> > > > > Intent(piecesActivity.this,ttsActivity.class);
> >
> > > > >                         intent1.putStringArrayListExtra("fromLat",
> > > > > fromLat);
> >
> > > > >                         startActivity(intent1);
> > > > >                                startActivityForResult(intent1, 2);
> >
> > > > > in The Second Activity is:
> >
> > > > >  ArrayList <String>fLat = new ArrayList<String> ();
> >
> > > > > Intent intent=new Intent();
> > > > >  fLat=intent.getStringArrayListExtra("fromLat");
> >
> > > > > System.out.println("=============================38"+fLat);
> >
> > > > > and in the second activity i am trying to make the list as a
> > > > > text_to_speach:
> >
> > > > >         @Override
> > > > >                 public void onClick(View v) {
> >
> > > > >                       if (fLat!=null && ((CharSequence)
> > > fLat).length()>0)
> > > > > {
> > > > >                    Toast.makeText(ttsActivity.this, "Saying: " +
> fLat,
> > > > > Toast.LENGTH_LONG).show();
> > > > >                    tts.speak(fLat, TextToSpeech.QUEUE_ADD, null);
> > > > >                       }
> >
> > > > > i don't know why the second activity is giving me
> NullPointerException
> > > > > (the fLat is returning Null) and the .speak method is not
> accepting a
> > > > > list view... :S
> >
> > > > > I really need an advice...any Idea will be very appreciated.
> >
> > > --
> > > 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+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> --
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to