what happens esque I want to make like a search engine from my EditText in the layout view, that shows me a reciclerView with a cardView I want that when writing something, my recycler view shows me the results comparing the data of the Array with those of the Edit text and show me the results in the recycle view, like a search engine, I would really appreciate it, if you can leave me a ducumentation or a response, attach my code
package com.willfer.harold.willfer.FragmentPrincipal;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;
import com.android.volley.toolbox.Volley;
import com.willfer.harold.willfer.Adaptadores.AdaptadorMarcas;
import com.willfer.harold.willfer.EstructuraDatos.DatosMarcas;
import com.willfer.harold.willfer.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.net.URLDecoder;
import java.util.ArrayList;
public class fragment1 extends Fragment {
RecyclerView contenedor;
EditText buscador;
ArrayList<DatosMarcas> listaMarcas;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment, container, false);
listaMarcas = new ArrayList<DatosMarcas>();
contenedor = (RecyclerView)view.findViewById(R.id.contenedor);
buscador = (EditText)view.findViewById(R.id.buscador);
contenedor.setHasFixedSize(true);
LinearLayoutManager layout = new LinearLayoutManager(getContext());
layout.setOrientation(LinearLayoutManager.VERTICAL);
contenedor.setLayoutManager(layout);
String url = "http://www.willfer.com/WebServices/ConsultarMarcas.php";
RequestQueue hiloConsulta2 = Volley.newRequestQueue(getContext());
JsonArrayRequest consulta2 = new JsonArrayRequest(url, new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
try {
contenedor.setAdapter(new AdaptadorMarcas(listaMarcas));
for(int i = 0; i < response.length(); i++){
JSONObject c = (JSONObject)response.getJSONObject(i);
String idMarca = c.getString("IdMarca");
String nombreMarca = c.getString("NombreMarca");
String fotoMarca = URLDecoder.decode(response.getJSONObject(i).getString("ImagenMarca"));
listaMarcas.add(new DatosMarcas(idMarca, nombreMarca, fotoMarca));
}
}catch (JSONException e){
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
hiloConsulta2.add(consulta2);
return view;
}
public static Fragment newInstance(String text) {
fragment1 f = new fragment1();
Bundle b = new Bundle();
b.putString("msg", text);
f.setArguments(b);
return f;
}
}