Android : what does editable mean?

on Friday, August 15, 2014


what editable means in this code?


private boolean checkPassword(Editable uname, Editable passwd) {


and why I have to put it there? because when I removed it, it causes an error


heres the full code



package course.examples.helloWorldWithLogin;

import java.util.Random;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class LoginScreen extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.loginscreen);

final EditText uname = (EditText) findViewById(R.id.username_edittext);
final EditText passwd = (EditText) findViewById(R.id.password_edittext);
final Button loginButton = (Button) findViewById(R.id.login_button);

loginButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if (checkPassword(uname.getText(), passwd.getText())) {
Intent helloAndroidIntent = new Intent(LoginScreen.this,
HelloAndroid.class);
startActivity(helloAndroidIntent);
} else {
uname.setText("");
passwd.setText("");
}
}
});
}

private boolean checkPassword(Editable uname, Editable passwd) {
// Just pretending to extract text and check password
return new Random().nextBoolean();
}
}

0 comments:

Post a Comment