1

i would like to know how to send an ArrayAdapter that i'm filling in one activity, to a ListActivity display it.

The program itself searches for bluetooth devices around and fills the ArrayAdapter with it's names, then i would like to sent the created list to a ListActivity so the user can select one.

Thanks

Nemesis
  • 1,138
  • 1
  • 14
  • 29

2 Answers2

3

Check this How do I pass data between Activities in Android application?. It will be better not to send the ArrayAdapter via Intent but to send only the data (ArrayList or even String[]) and then to construct the ArrayAdapter in the new Activity.

Community
  • 1
  • 1
Mojo Risin
  • 8,136
  • 5
  • 45
  • 58
  • thanks, I've created in the end the String[] and passed it in an intent. I was just wondering if it was possible to do the same with a ArrayAdapter directly. – Nemesis Jul 21 '11 at 07:47
1

You can take a look at this which explains how to pass a int[] across activities through Intent.putExtra(). Another option is that you would make the data that you want accessible by the other activity as public static so the other activity could just access it freely.

Community
  • 1
  • 1
A. Abiri
  • 10,750
  • 4
  • 30
  • 31