I try to study requests on http. Now there is one error

The method getText() is undefined for the type String

I can not understand why:

 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 { } }});}} 

An error occurs in this line:

 String password = URLEncoder.encode(password.getText().toString(), "UTF-8"); 

    1 answer 1

    You have 2 variables of different types with the same name.

     String passwordStr = URLEncoder.encode(password.getText().toString(), "UTF-8"); 

    should work