Don't use == on strings.  Use the equals method.  (pick up a java
book)

Doug

On Dec 15, 8:17 pm, Matt Clark <[email protected]> wrote:
> I am currently writing an application to easily retrieve the bus
> schedule for my school. I have a series of intents and content views
> that get information from the user such as
> Bus From
> Bus To
> Day
>
> The variables are passed to a final intent, where depending on what
> the user has selected it will choose the correct contentview to show
> the user the schedule. The problem that i am having is that i am
> getting a string of say 'equine' and checking it in an if statement to
> see if the sting is indeed 'equine'. The program is skipping right
> over it as if the statement was false, even while debugging. The
> segment in question is below.
>
> locationFrom = getIntent().getExtras().getString("From");
> locationTo = getIntent().getExtras().getString("To");
> locationDay = getIntent().getExtras().getString("Day");
>
> if (locationFrom == "equine") {
>         if (locationTo == "equine") {
>                 //None
>         } else if (locationTo == "gaebe") {
>                 if (locationDay == "monday" || locationDay == "tuesday"
>                                 || locationDay == "wednesday"
>                                 || locationDay == "thursday") {
>                         setContentView(R.layout.equine_gaebe_week);
>                 } else if (locationDay == "friday") {
>                         setContentView(R.layout.equine_gaebe_friday);
>                 } else if (locationDay == "saturday") {
>                         setContentView(R.layout.equine_gaebe_saturday);
>                 } else if (locationDay == "sunday") {
>                         setContentView(R.layout.equine_gaebe_sunday);
>                 }
>         }}else{
>
>         Log.e("ERROR!", locationFrom);
>
> }
>
> When looking in the LogCat i get:
> 12-15 23:10:15.034: ERROR/ERROR!(11489): equine
>
> This is frustrating me as I have no idea what the problem is.... Any
> and all help is greatly appreciated...
> ~Matt

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

Reply via email to