pin is the edittext object. compare the value of the pin "pin.getText().toString()" to compare the value that u expect
On Tue, Mar 6, 2012 at 12:45 AM, ~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 -- 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

