ECn Categories > Non-Existent Result Notification (NRN) > Non-existent Notification of Problem when Performing an Action (NNPPA)
The app does not show any result or message indicating that the action carried out by the user was not performed successfully because of a connectivity problem . It seems that nothing happened.
Amount of Issues | App List |
---|---|
31 | (A8) iFixit, (A15) WordPress, (A21) Omni Notes, (A25) Twidere para Twitter, (A26) Opengur, (A30) Earth viewer, (A31) Open Weather, (A35) PAT Track, (A36) Stepik, (A37) Runner Up, (A38) Wake You In Music, (A39) Habitica, (A45) Kontalk Messenger, (A46) Open Food, (A50) Kickstarter |
Subcategories
Non-existent Notification of an Issue while Downloading Content (NNDC) »
The app does not show anything indicating that the required content is being downloaded. It seems that nothing happened.
Examples
Good Weather
The following code snippets show the classes and files that are involved in the generation of the previuos issue.
In order to see how this error is generated, we need to review the complete flow event. First, we see the Search activity that handles the search event. On the “onCreate” method at line 55 it can be seen the method call to “setupSearchView”.
app/src/main/java/org/asdtm/goodweather/SearchActivity.java
protected void onCreate(@Nullable Bundle savedInstanceState) {
((GoodWeatherApp) getApplication()).applyTheme(this);
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
}
setContentView(R.layout.activity_search);
setupActionBar();
55. setupSearchView();
So, when this method is called, some configurations are made, nevertheless the most important lines are 78 and 84, where are defined the actions executed when the user make a query, both implementations call the “filter” method from the “SearchCityAdapter” variable called “mSearchCityAdapter”.
app/src/main/java/org/asdtm/goodweather/SearchActivity.java
private void setupSearchView() {
SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE);
SearchView searchView = (SearchView) findViewById(R.id.search_view);
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setIconified(false);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
78. mSearchCityAdapter.getFilter().filter(query);
return true;
}
@Override
public boolean onQueryTextChange(String newText) {
84. mSearchCityAdapter.getFilter().filter(newText);
return true;
}
});
}
Now, we can see the implemtation of the “SearchCityAdapter” class that is inside the “SearchActivity”
app/src/main/java/org/asdtm/goodweather/SearchActivity.java
private class SearchCityAdapter extends RecyclerView.Adapter<SearchCityHolder> implements
Filterable {
However, the important code snippet of this class is were the query are performed. So, starting at line 159, the filtering is defined. For this, a new “Filter” element is created, because of this the “performFilter” is override. In this method at line 166 the query is send to “getCity” method from “CityParser” class. It worth noting that the result retrieved by that method is send to the adapter in order to show it to the user.
app/src/main/java/org/asdtm/goodweather/SearchActivity.java
public Filter getFilter() {
return new Filter() {
@Override
protected FilterResults performFiltering(CharSequence charSequence) {
FilterResults filterResults = new FilterResults();
166. List<CitySearch> citySearchList = CityParser.getCity(charSequence.toString());
filterResults.values = citySearchList;
filterResults.count = citySearchList != null ? citySearchList.size() : 0;
return filterResults;
}
Finally, when the “getCity” method is called, a new request is build using a base url from the api where the cities are retrieved. Nevertheless at line 34 a validation that there is connection is made, but as it is known the device has no connection to internet. Therefore, at line 35 a “null” value is send as response. Then, as the response is a null object the adapter will not show any result and as it can be seen at all the flow event shown in these snippets there is no notification shown to the user if there are no results. This will cause the user to think there are no cities that matchs the query performed.
app/src/main/java/org/asdtm/goodweather/utils/CityParser.java
public static List<CitySearch> getCity(String query) {
List<CitySearch> citySearchList = new ArrayList<>();
CitySearch city;
HttpURLConnection connection = null;
try {
URL url = getUrl(query);
connection = (HttpURLConnection) url.openConnection();
if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
return null;
}