I am working on validation of two edit text fields in my login page and little change in my idea. I need to show textview above this field if the user left field e1 without entering text and goes to e2. Any help is appreciated.
Here is my code:
import android.app.Activity;
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.TextView;
import android.widget.Toast;
;
public class LoginActivity extends Activity {
EditText usernameText;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.loginpage);
Button login = (Button) findViewById(R.id.loghomebutton);
Button newuser = (Button) findViewById(R.id.lognewuserbutton);
EditText usernameText = (EditText)this.findViewById(R.id.emaileditlog);
EditText passwordText = (EditText)this.findViewById(R.id.pwdeditlog);
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent myIntent = new Intent(v.getContext(),
SettingsActivity.class);
startActivityForResult(myIntent, 0);
overridePendingTransition(R.anim.fadeout, 0);
}
});
newuser.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent myIntent = new Intent(v.getContext(),
RegisterActivity.class);
startActivityForResult(myIntent, 1);
overridePendingTransition(R.anim.fadeout, 0);
}
});
}
}
in XML add a textview above the edittext.. set textviews
android:visibility="GONE"then in java code do this..