How a landing page, if the user enters a value in EditView Click Button button will jump to another Activity, if you do not enter a value, not a jump<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
You can determine the value of EditText, if not empty jump, jump if not empty, the definition of an Intent, set to jump in activity, open it with startActivity (Intent), you want to jump into the open The activity of the.
Reply:
If I do not need the account password is blank, it should be how to write conditional statements?
Reply:
Such cases are generally priority,
if (account is empty) {
} Else if (password is blank) {
}
Reply:
Account is empty, do not judge a password, account is not empty, to determine whether the password is blank.
Reply:

Reply:
intent to achieve the source code of how to write the jump
Reply:
public class MyActivity extends Activity {
private EditText edt;
private Button btn;
private String accountNumber;
private String passWord;
@ Override
protected void onCreate (Bundle savedInstanceState) {
/ / TODO Auto-generated method stub
super.onCreate (savedInstanceState);
edt = (EditText) findViewById (R.id.edt);
btn = (Button) findViewById (R.id.button);
btn.setOnClickListener (btnOnClickListener);
accountNumber = edt.getText () toString ();.
passWord = edt.getText () toString ();. / / This refers to the second EditText, I do not write
}
private Button.OnClickListener btnOnClickListener = new Button.OnClickListener () {
@ Override
public void onClick (View v) {
if (accountNumber.equals ("")) {
} Else {
if (passWord.equals ("")) {
} Else {
Intent intent = new Intent ();
intent.setClass (MyActivity.this, otherActivity.class);
startActivity (intent);
}
}
}};
}
Reply:
You should never learned the computer, right?
Reply:
Hey, sad to say, textview.getText! == "", Remember not equal to null
Reply:
Wrong, is textview.getText.toString1 = ""
Reply:
Wrong, is textview.getText.toString! = ""
No comments:
Post a Comment