0
I would like to know how to use a different layout with the scheme below, If I am in Activity A showing Layout 1, if I am in Activity B show Layout 2, I saw that it is done with viewType , but I could not understand how viewType works, if you can explain how it works I thank you. in my case just have to change even the layout the rest is all the same.
public class RecyclerViewTeste extends RecyclerView.Adapter<RecyclerViewTeste .MyViewHolder> {
    private List<Blog> mQuestionList;
    Context mContext;
    class MyViewHolder extends RecyclerView.ViewHolder {
        View mView;
        TextView title,desc,nome,data,uid,cont,mRetes;
        ImageView mExpand;
        CircleImageView mCirclePerfil;
        MyViewHolder(View view) {
            super(view);
            mView = view;
            mContext = mView.getContext();
            title = (TextView) view.findViewById(R.id.post_title);
            desc = (TextView) view.findViewById(R.id.post_desc);
            nome = (TextView) view.findViewById(R.id.post_username);
            data = (TextView) view.findViewById(R.id.datarow);
            uid = (TextView) view.findViewById(R.id.uid);
        }
        public void setFtperfil(Context ctx, String ftperfil) {
            CircleImageView post_perfil = (CircleImageView) mView.findViewById(R.id.imagemPerfil);
            Picasso.with(ctx).load(ftperfil).into(post_perfil);
        }
    }
    public RecyclerViewClashOfClans(List<Blog> mQuestionList) {
        this.mQuestionList = mQuestionList;
    }
    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.blog_row_cliente, parent, false);
        return new MyViewHolder(itemView);
    }
    @Override
    public void onBindViewHolder(MyViewHolder holder, final int position) {
        final Blog blog = mQuestionList.get(position);
        holder.title.setText(blog.getTitle());
        holder.desc.setText(blog.getDesc());
        holder.nome.setText(blog.getNome());
        holder.data.setText(blog.getData());
        holder.uid.setText(blog.getId_post());
        holder.setFtperfil(getApplicationContext(), blog.getFoto());
        holder.mView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent singleBlogIntent = new Intent(mContext, BlogSingleActivityClash.class);
                singleBlogIntent.putExtra("blog_id", blog.getId_post());
                mContext.startActivity(singleBlogIntent);
            }
        });
    }
    @Override
    public int getItemCount() {
        return mQuestionList.size();
    }
}
The layout of the list only would change, or change also the objects that would be shown, in case the mQuestionList?
– Grupo CDS Informática
in case only the layout, it turns out that I use the same code 5 times in my app only it is presented in different ways depending on where the user is, I just want to decrease codicing lines same...
– Wallace Roberto