How can I load a new RecycleView?

0

Hello, people

I need a help! I'm using RecycleView with Retrofit my service is already returning a json and I'm already displaying everything correctly.

But when I click on an item I want to reload this recycleview with other data.

What is better to open a new activity with this data or develop a routine to reload this same recycleview with the data from the other service?

If second best solution is how can I do this?

public class TeleAdapter extends RecyclerView.Adapter<TeleAdapter.MyViewHolder> {

private List<Tele> Tele;
private Context context;

public TeleAdapter(List<Tele> Tele, Context context){
    this.Tele = Tele;
    this.context = context;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.Tele_categoria_item, parent,false);
    return new MyViewHolder(view);
}

@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
    holder.Name.setText(Tele.get(position).getName());
    holder.Email.setText(Tele.get(position).getUrl());
    final String music = Tele.get(position).getUrl();


}

@Override
public int getItemCount() {
    try {
        return Tele.size();
    }
    catch(Exception ex) {
        ex.printStackTrace();
    }
    return Tele.size();
}


public class MyViewHolder extends RecyclerView.ViewHolder{

    TextView Name,Email;
    String music;
    public MyViewHolder(View itemView) {
        super(itemView);
        Name = (TextView)itemView.findViewById(R.id.name);
        Email = (TextView)itemView.findViewById(R.id.email);


        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {


            }
        });

    }
}

}

    
asked by anonymous 25.10.2018 / 21:39

0 answers