Hi
here's the rest of the code ... from a turorial ...
public class mapapps2 extends MapActivity {
/** kml data found at http://www.satellite-sightseer.com/ */
private String[][] locations = {
{ "Area 51", "-115.800155,37.248040" },
{ "Bill Gates' house", "-122.242135,47.627787" },
{ "Shepshed Dynamo Football Grounds",
"-1.286913,52.774472" },
{ "Michael Jackson's Neverland Ranch",
"-120.088012,34.745527" },
{ "Leaning Tower of Pisa", "10.396473,43.723002" },
{ "Airplane Graveyard", "-110.834026,32.150899" },
{ "Grand Canyon", "-112.298641,36.142788" },
{ "Lake Kariba", "27.990417,-17.235252" },
{ "White House", "-77.036519,38.897605" },
{ "World Trade Center site", "-74.012253,40.711641" },
{ "Las Vegas Strip", "-115.162296,36.133347" }
};
private Spinner spinner;
private MapView map;
private MapController mc; is the first part i have not posted ...
and this is the main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<view class="com.google.android.maps.MapView"
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<Spinner android:id="@+id/spinner1"
android:layout_alignParentTop="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
android:paddingTop="10dip"
android:paddingBottom="10dip"
/>
</RelativeLayout>
This is from a tutorial i found at a website
On 20 Mai, 14:03, "dolan kundu" <[EMAIL PROTECTED]> wrote:
> 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
> > Hi
*/
> > 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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---