title: i don't know how to complete this code to show the favorites list
body: <p>Good Morning</p>
  
  <p>I would like to add favorite list to my app, could anyone please help me to complete this code!!</p>
  
  <p>i did't receive any error, but the page is empty.</p>
  
  <p>Any help at all is great.</p>
  
  <p>thanks in advance!</p>
  
  <p><strong>FavoritesActivity.java (the code here i don't know how to complete it)</strong></p>
  
  <pre><code>public class FavoritesActivity extends AppCompatActivity {
  
      RecyclerView recyclerView;
      RecyclerView.LayoutManager layoutManager;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_favorites);
  
          recyclerView = findViewById(R.id.recycler_favorites);
          recyclerView.setHasFixedSize(true);
  
          LinearLayoutManager myLayoutManager = new LinearLayoutManager(this);
          myLayoutManager.setReverseLayout(true);
          myLayoutManager.setStackFromEnd(true);
          recyclerView.setLayoutManager(myLayoutManager);
  
          loadFavorites();
      }
  
      private void loadFavorites() {
  
          FavoritesAdapter adapter = new FavoritesAdapter
                  (this, new Database(this).getAllFavorites("foodId"));
  
          recyclerView.setAdapter(adapter);
  
      }
  
  }
  </code></pre>
  
  <p><strong>and here is the the FavoritesAdapter.java</strong></p>
  
  <pre><code>public class FavoritesAdapter extends RecyclerView.Adapter&lt;FavoritesViewHolder&gt; {
  
      private Context context;
      private List&lt;Favorites&gt; favoritesList;
  
      public FavoritesAdapter(Context context, List&lt;Favorites&gt; favoritesList) {
          this.context = context;
          this.favoritesList = favoritesList;
      }
  
      @NonNull
      @Override
      public FavoritesViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          View itemView = LayoutInflater.from(context).inflate(R.layout.favorites_item,parent,false);
          return new FavoritesViewHolder(itemView);
      }
  
      @Override
      public void onBindViewHolder(@NonNull FavoritesViewHolder viewHolder, final int position) {
  
          viewHolder.food_name.setText(favoritesList.get(position).getName());
          viewHolder.food_presenter.setText(String.format("%S", favoritesList.get(position).getName()));
          Picasso.with(context).load(favoritesList.get(position).getImage())
                  .into(viewHolder.food_image);
  
          final Favorites local = favoritesList.get(position);
          viewHolder.setItemClickListener(new ItemClickListener() {
              @Override
              public void onClick(View view, int position, boolean isLongClick) {
  
                  //Start New Activity (Description Activity)
                  Intent foodDetails = new Intent(context, FavoritesActivity.class);
                  foodDetails.putExtra("FoodId",favoritesList.get(position).getFoodId()); //Send food ID to new activity
                  context.startActivity(foodDetails);
              }
          });
  
      }
  
      @Override
      public int getItemCount() {
          return favoritesList.size();
      }
  
      public void removeItem(int position){
          favoritesList.remove(position);
          notifyItemRemoved(position);
      }
  
      public void restoreItem(Favorites item, int position){
          favoritesList.add(position,item);
          notifyItemInserted(position);
      }
  
      public Favorites getItem(int position){
          return favoritesList.get(position);
      }
  
  }
  </code></pre>
  
  <p><strong>and here is the Database.java</strong></p>
  
  <pre><code> public List&lt;Favorites&gt; getAllFavorites (String foodId)
      {
          SQLiteDatabase db = getReadableDatabase();
          SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
  
          String[] sqlSelect={"FoodId", "FoodName", "FoodImage", "FoodDescription", "FoodComponents",
              "FoodMenuId", "FoodUserName"};
          String sqlTable = "Favorites";
  
          qb.setTables(sqlTable);
          Cursor cursor = qb.query(db,sqlSelect,"FoodId=?", new String[]{foodId}, null,null,null);
  
          final List&lt;Favorites&gt; result = new ArrayList&lt;&gt;();
          if (cursor.moveToFirst())
          {
              do {
                  result.add(new Favorites(
                          cursor.getString(cursor.getColumnIndex("FoodId")),
                          cursor.getString(cursor.getColumnIndex("FoodName")),
                          cursor.getString(cursor.getColumnIndex("FoodImage")),
                          cursor.getString(cursor.getColumnIndex("FoodDescription")),
                          cursor.getString(cursor.getColumnIndex("FoodComponents")),
                          cursor.getString(cursor.getColumnIndex("FoodMenuId")),
                          cursor.getString(cursor.getColumnIndex("FoodUserName"))
                          ));
              }while (cursor.moveToNext());
          }
          return result;
      }
  </code></pre>