0

I have a Adapter. And I'm listing the data in a fragment. in a listing; 4 buttons, profile photo and text view. Can I just shuffling buttons with collection.shuffle();?

public class PostAdapter extends  RecyclerView.Adapter<PostAdapter.ViewHolder> {
    public Context mContext;
    public List<Posts> mPosts;

    private FirebaseUser firebaseUser;

    public PostAdapter(Context mContext, List<Posts> mPosts) {
        this.mContext = mContext;
        this.mPosts = mPosts;
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.all_posts_layout, viewGroup, false );
        return new PostAdapter.ViewHolder(view);
    }
}
daedsidog
  • 1,732
  • 2
  • 17
  • 36
chapter
  • 89
  • 1
  • 7
  • If you have a List – Bö macht Blau Dec 17 '18 at 21:11
  • In the application, a user creates a post in the form of a question and I just want to shuffle the answers(buttons). @0X0nosugar – chapter Dec 17 '18 at 21:16
  • answered already @ https://stackoverflow.com/questions/50494504/how-to-show-random-data-every-time-in-recyclerview-from-arraylist + https://stackoverflow.com/questions/15300497/shuffling-an-adapter – jesses.co.tt May 05 '20 at 21:36

0 Answers0