samedi 1 août 2015

If not executing with location

I have an if stateement that check to make sure the zip code matches the area that we service but while I am in the zip code I am testing the If does not run. Please tell me what I'm doing wrong

String address = addresses.get(0).getAddressLine(0); // If any additional address line present than only, check with max available address lines by getMaxAddressLineIndex()
            String city = addresses.get(0).getLocality();
            String state = addresses.get(0).getAdminArea();
            String country = addresses.get(0).getCountryName();
            String postalCode = addresses.get(0).getPostalCode();
            String knownName = addresses.get(0).getFeatureName();
            // final TextView mTextView = (TextView) findViewById(R.id.location);
            //mTextView.setText("Latitude "+latitude+" Longitude "+longitude);
            final TextView mAdressTextView = (TextView) findViewById(R.id.addressNum);
            mAdressTextView.setText(address);
            final TextView mStateTextView = (TextView) findViewById(R.id.stateNum);
            mStateTextView.setText(city+ ", "+ state+", " + postalCode);

            if (postalCode == "33331"){
                Intent logoutDone = new Intent(MainActivity.this, Register.class);
                startActivity(logoutDone);
                Log.d("ADebugTag", "Value: " + postalCode);
            }

Aucun commentaire:

Enregistrer un commentaire