This is the code for registration class, when I click register button nothing happens.
Please help so that I can do this..

Take a look at the code you have in the click handler you added (near the beginning) to the button. This click handler is near the bottom of the file:

@Override
public void onClick(View v) {
   Button login = (Button) findViewById(R.id.btnRegister);
   login.setOnClickListener(this);
}

Notice that all you do here is grab this exact same button, and set the exact same click listener back into it. This is why it appears to do nothing.

The actual code that attempts to log in is in the click listener you add to the *TextView*:

TextView reg = (TextView) findViewById(R.id.link_to_login);
reg.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {

etc.


Not sure why you added a click listener to the TextView - it appears you may have got a little mixed up about how you want your interface to work. To start with, to try and help make your code a little easier to follow, I recommend two things:

1. Move the code that attempts the login from the body of the click listener you added to the TextView into a separate method of the class, called doLogin() or something similar. For now, don't add the click listener to the TextView - you can sort out that additional functionality later.

2. Don't make the RegisterActivity implement ClickListener - instead, be consistent and add an anonymous click listener to the button (to replace the one you add at the moment at the start of onCreate() ). From that onClick() method, get it to attempt the login (and yes, I deliberately didn't specify exactly how, to give you a chance to examine the revised code and try and work it out for yourself).

See if you can repair your code from that.


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

Reply via email to