@SuppressLint("NewApi")
public boolean isValid(String UName,String Pswd)
{
String msg="";
try {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
DefaultHttpClient httpClient = new DefaultHttpClient();
URI uri = new URI("http://10.0.2.2:13514/Service1.svc/IsValidUser?userid="+UName+"&password="+Pswd);
HttpGet httpget = new HttpGet(uri);
HttpResponse response = httpClient.execute(httpget);
HttpEntity entity = response.getEntity();
BufferedReader in = new BufferedReader(new InputStreamReader(entity.getContent()), 65728);
msg = in.readLine();
if(msg.contains("success")){
return true;
}
else
{
return false;
}
}
catch(Exception ex)
{
Log.v("Tag","error"+ex.getMessage());
return false;
}
}
and Dont forget to add
<uses-permission android:name="android.permission.INTERNET" />
in Manifeast file