-4

I am working on a chat application in which I have to set login Id password credentials from edittext and according to the responce , I have to go further screens.

when I am using the credentials statically, I am getting the response from the webservice

 String url="http://tokerapp.com/ws/get_login.php?username=rc&password=rahul";
                try {
                    String res=CustomHttpClient.executeHttpGet(url);
                    Log.e("$$$$$$$$",res);

but when I am taking credentials from editTexts, It is now giving me proper response.

    tvLogin = (EditText)findViewById(R.id.editUsername);
        tvpass = (EditText)findViewById(R.id.editPassword);
        btnLogin = (Button)findViewById(R.id.btnlogin);

btnLogin.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {

String usrnme = tvLogin.getText().toString().trim();
String psswrd = tvpass.getText().toString().trim();

String url="http://tokerapp.com/ws/get_login.php?username=usrnme&password=psswrd";
                try {
                    String res=CustomHttpClient.executeHttpGet(url);
                    Log.e("$$$$$$$$",res);
anjali
  • 77
  • 1
  • 8

1 Answers1

1
String url="http://tokerapp.com/ws/get_login.php?username=" + usrnme + "&password=" + psswrd;
Petr Duchek
  • 1,203
  • 13
  • 17
  • thanx Petr, One more thing I want to ask to you sir, I am doing this in further coding, is it right?? if(res.equals(0)){ Toast toast = Toast.makeText(getApplicationContext(),"insert the correct id password", 8000 ); toast.show(); } else{ Intent intentLogin = new Intent(LoginPage.this, MainActivity.class); startActivity(intentLogin); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } – anjali Dec 02 '14 at 00:25