I have implemented a parserXML with Listview and cardview, but I do not know how to implement the swiperefreshlayout to refresh the content.
I do not know where to put the code to re-read the xml from my server, I've searched for tutorials but I can not find one to help me with this.
Thanks for your comments, in my class that loads the news I have it like that.
public class fnoticias extends Fragment implements adaptadorNoticia.OnItemClickListener{}
El codigo que ejecuta el parser con el adapter esta asi.
public class TareaDescargaXml extends AsyncTask<String, Void, List<noticia>> {
@Override
protected void onPreExecute() {
// show the progress bar
spinner.setVisibility(View.VISIBLE);
}
@Override
protected List<noticia> doInBackground(String... urls) {
try {
return parsearXmlDeUrl(urls[0]);
} catch (IOException e) {
return null; // null si hay error de red
} catch (XmlPullParserException e) {
return null; // null si hay error de parsing XML
}
}
@Override
protected void onPostExecute(List<noticia> result) {
spinner.setVisibility(View.GONE );
// Actualizar contenido del proveedor de datos
noticia.Ultimas_Noticias = result;
// Actualizar la vista del adaptador
adaptador.notifyDataSetChanged();
}
}
and my layour I have it like that
<android.support.v7.widget.RecyclerView
android:id="@+id/reciclador"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
I hope you can guide me. Greetings.