if-else structure not working in android?

Aug 7 2015 11:32 PM
The if else structure is not setting correct url even though location and category parameters  
 are correctly parsed.
 
private void initView(String location,String category) {
// show progress dialog
dialog = ProgressDialog.show(this, "", "Loading...");
String url;
if(location.toString()=="Jaipur" && category.toString()=="Gardner")
url = "http://192.168.186.1/apps_jaipur_gardner.php";
else if(location.toString()=="Jaipur" && category.toString()=="Mason")
url = "http://192.168.186.1/apps_jaipur_mason.php";
else if(location.toString()=="Jaipur" && category.toString()=="Carpenter")
url = "http://192.168.186.1/apps_jaipur_carpenter.php";
else if(location.toString()=="Jaipur" && category.toString()=="Plumber")
url = "http://192.168.186.1/apps_jaipur_plumber.php";
else
url = "http://sid429.hostei.com/appsonline.php";
Log.d(TAG,location);
Log.d(TAG,category);
Log.d(TAG,url);
FetchDataTask task = new FetchDataTask(this);
task.execute(url);
}

Answers (1)