you create repeated the button id two times that's the problem. btnLogin=(Button)this.findViewById(R.id.btnLogin); btnLogin=(Button)this.findViewById(R.id.btnLogin);
On Fri, Jan 27, 2012 at 11:39 AM, newtoandroid <shobana...@gmail.com> wrote: > i tried a simple login page which gets the gps location if the login > condition is satisfied,while running it shows ünfortunately,the > activity has stopped "with an ok button. i have created the avd with > gps support supporting android 4 with google Inc and even set the gps > manually in ddms perspective.here is my launcher activity. > package com.first; > > import android.app.Activity; > import android.content.Context; > import android.content.Intent; > import android.os.Bundle; > import android.view.View; > import android.view.View.OnClickListener; > import android.widget.Button; > import android.widget.EditText; > import android.widget.Toast; > > public class FirstActivity extends Activity { > EditText txtUserName; > EditText txtPassword; > Button btnLogin; > Button btnCancel; > > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > final Context context=this; > > txtUserName=(EditText)this.findViewById(R.id.txtUname); > txtPassword=(EditText)this.findViewById(R.id.txtPwd); > btnLogin=(Button)this.findViewById(R.id.btnLogin); > btnLogin=(Button)this.findViewById(R.id.btnLogin); > btnLogin.setOnClickListener(new OnClickListener() { > > public void onClick(View v) { > // TODO Auto-generated method stub > > > > if((txtUserName.getText().toString()).equals(txtPassword.getText().toString())) > { > > Toast.makeText(FirstActivity.this, "Login > Successful",Toast.LENGTH_LONG).show(); > > Intent i=new Intent(context,com.first.LbsGeocoding.class); > startActivityForResult(i,0); > FirstActivity.this.finish();} else{ > Toast.makeText(FirstActivity.this, "Invalid > Login",Toast.LENGTH_LONG).show(); > } > > } > }); > > > }} > > -- > 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 -- WITH REGARDS ARUN KUMAR P D +91-9663471079 -- 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