i am very new to android so i havent tried much. this is what i have
so far. ignore the extra imports. i have been experimenting a bit with
this class. i need it to be so that when i click on one of the options
in the spinner i can then click on a button below the spinner that
will start downloading a pdf file depending on what is selected. so
far i can get the spinner to show up and i can select an option but i
cant figure out how to configure the button. i know i need if
statements but im confused how to work them with this project. also
the pdf files are all online already. this is the link to the first
pdf that will be downloaded if the first option is selected.
http://centro.org/Spring%202011%20Schedules/236.pdf thank you so much
for your help and if you can help me through this i will make sure to
include you in credits for my project.
THIS IS THE CLASS FILE FOR THE ACTIVITY THAT HAS THE SPINNER.
cnycentro.java
package com.centro.swiftkaytech;
import java.lang.reflect.Array;
import android.R.array;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.AbsSpinner;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.Toast;
public class cnycentro extends Activity {
Button button1 = (Button) findViewById(R.id.button1);
Spinner spinner = (Spinner) findViewById(R.id.spinner);
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cnycentro);
Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<CharSequence> adapter =
ArrayAdapter.createFromResource(this, R.array.routes,
android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
}
}
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
THIS IS THE XML R.layout.array.routes
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="routeprompt">choose a route</string>
<string-array name="routes">
<item>AUBURN-SYRACUSE-236-Auburn/38-Auburn-Elbridge/138-Auburn-
Taunto</item>
<item>BALDWINSVILLE LAKELAND-82-Baldwinsville/182-
Baldwinsville-Indian Springs</item>
<item>CAMILLUS-36-West Genessee-Camillus Commons/136-Camillus/
236-Auburn</item>
<item>CAROUSEL CENTER-50-Carousel Center via I-81/150-Regional
Transportation center via I-81/550-Carousel Center</item>
<item>CARRIER AND NEW VENTURE GEAR-22-James-Carrier/122-James-
Carrier-NVG-East Syracuse</item>
<item>CENTRAL SQUARE-388-Central Square</item>
<item>CICERO NORTH SYRACUSE-88-North Syracuse/188-N. Syracuse-
Cicero/288-N. Syracuse-Central Square</item>
<item>CONNECTIVE CORRIDOR-443-Connective corridor/543-
Connective Corridor</item>
<item>COURT INDUSTRIAL PARK-152-Court-Industrial park</item>
<item>COURT-PARK ST.-52 Court-Park-Shop City</item>
<item>DRUMLINS-340-SU-Drumlins</item>
<item>EAST COLVIN-72-Townsend/172-East Colvin</item>
<item>E. SYRACUSE AND SHOPPINGTOWN-23-James-E. syracuse/123-
James-E. Syracuse-Walmart/223-James-E. Syracuse- shoppingtown/323-
James-Minoa</item>
<item>EASTWOOD AND SUNNYCREST-20-James-Lamson/120-James-Midler/
21-James-Sunnycrest/121-James-Sunnycrest ext</item>
<item>ERIE BLVD EAST-E. FAYETTER-DEWITT-68-E. Fayette
Westmoreland/168-E. Fayette- Erie Blvd- Shoppingtown</item>
<item>FAYETTEVILLE MANLIUS-62-Fayetteville/162-Manlius via 690-
Widewaters/262-Manlius-E. Genesee/262x-Manlius xpress via 481</item>
<item>FRANKLIN SQUARE-CAROUSEL CENTER-550-Carousel Center</
item>
<item>GRANT BLVD-80-Grant Blvd/180-Grant Blvd-Taft-Dunlap</
item>
<item>HENRY CLAY-86-Henry clay/186-Henry clay- Wetzel rd/286-
Henry Clay-Wetzel rd</item>
<item>LE MOYNE COLLEGE-776-Le Moyne-Carousel Shuttle/876-Le
Moyne-Shoppintown Shuttle</item>
<item>LIVERPOOL-MORGAN RD-48-Liverpool-Morgan-Avon-Gramplain/
148-Liverpool-Morgan-Great Northern/248-Liverpol-Morgan-Seneca Mall</
item>
<item>LIVERPOOL ROUTE 57-46-Lverpool-Route 57-Great Norther/
246-Oswego/246x-Oswego Xpress</item>
<item>MATTYDALE WOLF-84-Mattydale/184-Mattydale-Allen rd</
item>
<item>MIDLAND-VALLEY-54-Midland-Matson/154-Midland-Seneca/254-
Midland-Valley drive</item>
<item>NOB HILL-140SU-Thurber/240-SU-Nob Hill</item>
<item>NORTH SALINA AND BUCKLEY-16-N. Salina- RTA/116-N.
Salina-7th N. st./ 216-N. Salina-Electronics PKWAY</item>
<item>OSWEGO-246-Oswego</item>
<item>PARK HILL-58-Parkhill-Carrier/158-Parkhill-Exeter</item>
<item>SALT SPRINGS-76-E. Genessee-Salt Springs/176-E. Genessee-
Salt Springs-shoppingtown/276-E. Fayette-Salt Springs</item>
<item>SHOPPER EXPRESS-692-Shoppingtown Mall</item>
<item>SOLVAY-74-Solvay-Milton/274-Solvay-Avery-Bailey/374-
Solvey-Avery-Elm Hill</item>
<item>SOUTH AVENUE-26-S. Ave-Elmwood/126-S. Ave-Comunity
Hospital/226-S.Ave -OCC/226x-S.Ave-OCC Express/326-S.Ave-High Acres/28-
S.Ave-Valley Dr.-Comunity Hospital/128-S.Ave-Valley dr-OCC</item>
<item>SOUTH SALINA-NEDROW-10-S.Salina-Brighton/110-S.Salina-
Valley Plaza/210S.Salina-bernadine/310-S.Salina-Valley/410-Nedrow/410x-
Nedrow Express</item>
<item>SYRACUSE UNIVERSITY HILL-HOSPITALS-40-S.U.</item>
<item>TULLY/LAFAYETTE EXPRESS-510-Tully-Lafayette</item>
<item>WESTCOTT-30-SU via Irvinag/130-SU-Westcott-Nottingham HS/
230-SU-Westcott/330-SU-Westcott-Jamesville Rd/430-E. Genessee-
Jamesville rd/530-SU-Westcott-Shoppingtown</item>
</string-array>
</resources>
On Mar 5, 12:08 pm, TreKing <[email protected]> wrote:
> On Thu, Mar 1, 2012 at 8:05 AM, Kevin Haines <[email protected]> wrote:
> > I just don't know how to configure the button.
>
> Why not? Can you be a bit more specific? What have you tried? What doesn't
> work?
>
> -------------------------------------------------------------------------------------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en