Hi cbraun75, One thing i want to know that, you are declaring the "ArrayAdapter". but where Array has called? if array is called by locations.length, then why its not calling by R? Means , i want say like the bellow line:
ArrayAdapter<CharSequence> adapter1 = ArrayAdapter.createFromResource( this, R.array.*abcd*, android.R.layout.simple_spinner_item); So in the abcd place, the name of the array has to be called, right? please give me explanation. Thanks, Dolan. On Tue, May 20, 2008 at 5:20 PM, cbraun75 <[EMAIL PROTECTED]> wrote: > > Hi rahul, > > have experimented yesterday with that ... should look like this > > .... > > public void onCreate(Bundle icicle) { > super.onCreate(icicle); > setContentView(R.layout.main); > > spinner = (Spinner) this.findViewById(R.id.spinner1); > map = (MapView) findViewById(R.id.map); > mc = map.getController(); > > ArrayAdapter<CharSequence> adapter = new > ArrayAdapter<CharSequence>(this, > android.R.layout.simple_spinner_dropdown_item); > for (int i = 0; i < locations.length; i++) > adapter.addObject(locations[i][0]); > > > > adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); > spinner.setAdapter(adapter); > spinner.setOnItemSelectedListener(selectListener); > gotoSelected(); > } > /* > * You need this function to select a spinner > */ > private OnItemSelectedListener selectListener = new > OnItemSelectedListener() { > public void onItemSelected(AdapterView parent, View v, int > position, > long id) { > gotoSelected(); > } > public void onNothingSelected(AdapterView arg0) {} > }; > > /* > * This function is to get the value of the selected spinner row > * from the array initialized at top. To get the position of the > selected spnner > * getSelectedItemPosition() is called > */ > public void gotoSelected() { > int pos = spinner.getSelectedItemPosition(); > } > .... > > On 20 Mai, 09:13, "dolan kundu" <[EMAIL PROTECTED]> wrote: > > Hi rahul, > > > > Create an array xml and use ArrayAdapter by spinner. put all the values > in > > the array xml. > > > > Thanks, > > Dolan. > > > > On Tue, May 20, 2008 at 10:55 AM, rahul <[EMAIL PROTECTED]> wrote: > > > > > I'm trying to acess xml file(web service) for movie ticket system..... > > > i want to add all movie name fetched from xml into spinner.... > > > how to add those... > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---