Hi Jai, Below this sample it ll work f9 now. go though once.. u ll understand.
package com.self; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.EditText; public class DummyActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } public void buttonClicked(View v) { EditText pin = (EditText) findViewById(R.id.edittext1); Log.v("EditText", pin.getText().toString()); // int pinno = Integer.parseInt(pin.getText().toString()); if (pinno != 0) { Log.d("TAG", ""+pinno); // } else Log.d("TAG", ""+pinno); // } } <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="button1" android:id="@+id/imagebutton1" android:onClick="buttonClicked" /> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/edittext1" android:inputType="number" /> </LinearLayout> Thanks and Regards, S.Seshu. s.seshu143(at)gmail(dot)com On Mar 6, 12:15 am, "~JAI~" <jayakarthik2...@gmail.com> 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en