Пытаюсь изучить запросы по http. Сейчас появляется одна ошибка
The method
getText()
is undefined for the type String
Не могу понять почему:
public class LoginPage extends Activity {
private static final String Login = "login";
private static final String Password = "password";
public void OnCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_layout);
final EditText account = (EditText) findViewById(R.id.editText1);
final EditText loginIn = (EditText) findViewById(R.id.editText2);
EditText password = (EditText) findViewById(R.id.editText3);
ProgressBar progress = (ProgressBar) findViewById(R.id.progress);
Button butlogin = (Button) findViewById(R.id.button1);
butlogin.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getBaseContext(),
"Please wait, connecting to server.", Toast.LENGTH_LONG)
.show();
try {
String accountValue = URLEncoder.encode(account.getText()
.toString(), "UTF-8");
String loginValue = URLEncoder.encode(loginIn.getText()
.toString(), "UTF-8");
String password = URLEncoder.encode(password.getText()
.toString(), "UTF-8");
HttpClient Client = new DefaultHttpClient();
String URL = "http://" + accountValue + ".megaplan.ru/"
+ loginValue + "&password" + password;
try {
String SetServerString = "";
HttpGet httpget = new HttpGet(URL);
ResponseHandler<String> responseHandler = new BasicResponseHandler();
SetServerString = Client.execute(httpget,
responseHandler);
} catch (Exception e) {
e.printStackTrace();
} finally {
}
} finally {
}
}});}}
Ошибка возникает в этой строчке:
String password = URLEncoder.encode(password.getText().toString(), "UTF-8");