i don't know how to complete this cood to show the favorites list - android

Good Morning

I would like to add favorite list to my app, could anyone please help me to complete this code!!

i did't receive any error, but the page is empty.

Any help at all is great.

thanks in advance!

FavoritesActivity.java (the code here i don't know how to complete it)

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);

}

}

and here is the the FavoritesAdapter.java

public class FavoritesAdapter extends RecyclerView.Adapter {

private Context context;

private List favoritesList;

public FavoritesAdapter(Context context, List favoritesList)...

Read More »

By: StackOverFlow - Sunday, 17 June

Related Posts