I have 3 fragments 1 fragmentListArticles ... in this fragment I obtain data from a webservice and fill a Recycler View .. when clicking on an item it takes me to the second fragment fragmentDynamicPurchase in this I confirm an order and fill a tableLayout in a third frgment fregmentListaCarrito ...... until all right there but when I return from the fragmentListaCarrito to the fragment fragmentListArticles with the articles listed the third fragment is seen above the first ...
fragmentListArticles @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflar el diseño de este fragmento
View view = inflater.inflate(R.layout.fragment_fragmento_listar_articulos, container, false);
lstRecycler = (RecyclerView) view.findViewById(R.id.lstRecycler);
contruirRecycler(view);
return view;
}
public void buildRecycler (View view) {
Utilidades.OP="lista";
lstRecycler = (RecyclerView) view.findViewById(R.id.lstRecycler);
if(Utilidades.visualizacion==Utilidades.LIST){
lstRecycler.setLayoutManager(new LinearLayoutManager(this.getContext()));
}
else{
lstRecycler.setLayoutManager(new GridLayoutManager(this.getContext(),2));
lstRecycler.setHasFixedSize(true);
}
obtenerArticulos();
}
/ OnClick del recycler /
ArticulosImagenUrlAdapter adapter = new ArticulosImagenUrlAdapter(lstArticulos,getContext());
adapter.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
/*String codigo=lstArticulos.get(lstRecycler.getChildAdapterPosition(v)).getCodigo();
String articulo=lstArticulos.get(lstRecycler.getChildAdapterPosition(v)).getArticulo();
String precio=lstArticulos.get(lstRecycler.getChildAdapterPosition(v)).getPrecioV();*/
Utilidades.articulo = lstArticulos.get(lstRecycler.getChildAdapterPosition(v)).getArticulo();
Utilidades.codigo = lstArticulos.get(lstRecycler.getChildAdapterPosition(v)).getCodigo();
Utilidades.precio = Integer.parseInt(lstArticulos.get(lstRecycler.getChildAdapterPosition(v)).getPrecioV());
Utilidades.imagen = lstArticulos.get(lstRecycler.getChildAdapterPosition(v)).getRuta_imagen();
Fragment fragment = new FragmentoDinamicoCompra();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.contenedor, fragment);
transaction.addToBackStack(null);
transaction.commit();
// Toast.makeText(getActivity(),"Selección: "+ lstArticulos.get(lstRecycler.getChildAdapterPosition(v)).getRuta_imagen(),Toast.LENGTH_LONG).show();
}
});
/ when I click on the product, it opens the following fragment /
When pressing the add button to the cart, a tableLayout is filled in the third fragment shown below
When I return this fragment to the list .. the list stays that way