0

I'm currently following an tuto on developing on android studio and i'm stuck with a problem : when I click on my item, i want to get to another intent but it is not working and I cannot figure it out. Here is my code

private void loadMenu(){
     adapter = new FirebaseRecyclerAdapter<Category,MenuViewHolder>(Category.class,R.layout.menu_item, MenuViewHolder.class, category) {
        @Override
        protected void populateViewHolder(final MenuViewHolder viewHolder, Category model, int position) {
            viewHolder.txtMenuName.setText(model.getName());
            Picasso.with(getBaseContext()).load(model.getImage())
                    .into(viewHolder.imageView);
            final Category clickItem = model;
            viewHolder.setItemClickListener(new ItemClickListener() {
                @Override
                public void onClick(View view, int position, boolean isLongClick) {
                    Toast.makeText(Home.this, ""+clickItem.getName(), Toast.LENGTH_SHORT).show();
                    Intent foodList = new Intent(Home.this, FoodList.class);
                    foodList.putExtra("CategoryId", adapter.getRef(position).getKey());
                    startActivity(foodList);

                }
            });
        }
    };

    recycler_menu.setAdapter(adapter);
}

It would be really cool if you guys can help me. Thanks a lot

Vincent Tng
  • 145
  • 4
  • 12

0 Answers0