[android-developers] Re: Hello Everyone, Is there anyway we can pass a listView from one activity to another

2012-04-01 Thread Soyer
Hello there,

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 Apr 1, 5:02 pm, lbendlin  wrote:
> Normally a listview is fed by an adapter. There is nothing stopping you
> from using the same adapter in different activities.
>
>
>
>
>
>
>
> On Sunday, April 1, 2012 8:53:45 AM UTC-4, Soyer wrote:
>
> > I am trying to pass a list view from one activity to another and use
> > it as a Text_to_speech.
>
> > I converted the list view to a string (Using toString()) in the first
> > activity and did work, but it's not so convenient since i can't
> > manipulate the elements in the list(I can't use them)...i thought of
> > convert the String back to a listview but i thing no such method can
> > do that.
>
> > Any ideas ?

-- 
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


[android-developers] Re: Hello Everyone, Is there anyway we can pass a listView from one activity to another

2012-04-01 Thread lbendlin
Normally a listview is fed by an adapter. There is nothing stopping you 
from using the same adapter in different activities.

On Sunday, April 1, 2012 8:53:45 AM UTC-4, Soyer wrote:
>
> I am trying to pass a list view from one activity to another and use 
> it as a Text_to_speech. 
>
> I converted the list view to a string (Using toString()) in the first 
> activity and did work, but it's not so convenient since i can't 
> manipulate the elements in the list(I can't use them)...i thought of 
> convert the String back to a listview but i thing no such method can 
> do that. 
>
>
>
>
> Any ideas ? 
>

-- 
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