I use the following code to search mine Data Browser. Columns Locationand Weather, and a class - Nowcast. If mine Data Browserhas New York in it and the weather "sunny", TextView showWeatherdisplays "The weather in New York is sunny".
However, if I am looking for Los Angeles and it is not in Data Browser, it displays "The weather in Los Angeles is null", whereas it does not have to enter the condition ifat all according to the code. What am I doing wrong?
public void getData(){
searchText = searchTextView.getText().toString();
ParseQuery<ParseObject> query = ParseQuery.getQuery("Nowcast");
query.whereEqualTo("Location", searchText);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> object, ParseException e) {
if (e == null) {
for (ParseObject weatherObject : object) {
weatherData = weatherObject.getString("Weather");
}
showWeather.setText("The weather in " + searchTextToString + " is " + weatherData);
} else {
Toast.makeText(NowcastSearch.this, "No such location found",Toast.LENGTH_LONG).show();
}
}
});
}
source
share