Commit 1788d15b authored by Willard's avatar Willard

Fix wrong dish being opened when selecting from a filtered list

parent a1ee6884
...@@ -35,7 +35,7 @@ public class DishAdapter extends BaseAdapter { ...@@ -35,7 +35,7 @@ public class DishAdapter extends BaseAdapter {
@Override @Override
public long getItemId(int position) { public long getItemId(int position) {
return position; return filteredDishes.get(position).getId();
} }
@Override @Override
......
...@@ -72,7 +72,7 @@ public class NavDrawerActivity extends AppCompatActivity implements NavigationVi ...@@ -72,7 +72,7 @@ public class NavDrawerActivity extends AppCompatActivity implements NavigationVi
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent i = new Intent(NavDrawerActivity.this, DishViewActivity.class); Intent i = new Intent(NavDrawerActivity.this, DishViewActivity.class);
Dish d = dishes.get(position); Dish d = adapter.getItem(position);
i.putExtra("ID", d.getId()); i.putExtra("ID", d.getId());
i.putExtra("NAME", d.getName()); i.putExtra("NAME", d.getName());
i.putExtra("PRICE", d.getPrice()); i.putExtra("PRICE", d.getPrice());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment