How to compare this:
search.setName(hits.getJSONObject(i).getString("name"));
with:
text.toString()
Can you help me please?
This is my code
final Query query = new Query(text.toString())
.setHitsPerPage(50);
index.searchAsync(query, new CompletionHandler() {
@Override
public void requestCompleted( @Nullable JSONObject content, @Nullable AlgoliaException error) {
try {
list.clear();
JSONArray hits = content.getJSONArray("hits");
for (int i =0; i < hits.length(); i++) {
Model search = new Model();
search.setName(hits.getJSONObject(i).getString("nome"));
search.setCity(hits.getJSONObject(i).getString("city"));
search.setcountry(hits.getJSONObject(i).getString("country"));
list.add(search);
}
searchAdapter.notifyDataSetChanged();
} catch (JSONException e) {
e.printStackTrace();
}
}
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…