Newcomers to Java should spend time learning Java before starting in
on Android development.

You appear to be attempting to compare an EditText to the value 0 in
your if() statement. This will not work.

On Mon, Mar 5, 2012 at 2:15 PM, ~JAI~ <[email protected]> wrote:
> hi friends,
>
> i'm new to android. i'm using the code below to create a new intent
> activity based on if condition validation.. but it doesn't work... pls
> help me..
>
>
>
> CODE
>
>
> package com.example.helloandroid;
>
> public class Main extends Activity {
>    /** Called when the activity is first created. */
>    @Override
>    public void onCreate(Bundle savedInstanceState) {
>        super.onCreate(savedInstanceState);
>        setContentView(R.layout.main);
>
>
>        ImageButton next2 = (ImageButton)
> findViewById(R.id.imageButton1);
>        next2.setOnClickListener(new View.OnClickListener() {
>            public void onClick(View view) {
>
>            EditText pin =
> (EditText)findViewById(R.id.editText1);     //value from edit text
>
>                         Log.v("EditText", pin.getText().toString());     //
> this works in log
>
>                                                if (pin.equals(0000)){
>                Intent myIntent = new Intent(view.getContext(),
> home.class);
>                startActivityForResult(myIntent, 1);
>                 }
>                        }
>                    });
>    }
>    @Override
>    public void onBackPressed() {
>        return;
>
>    }
> }
>
>
> the log file gets the value from text box, but the if condition does
> not work.. pls help me.. thanks in advance...
>
> --
> 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



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 2.5
Available!

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