我正在开发餐厅应用程序的问题是,每当客户发送订单商品时,酒吧和厨房就有两个柜台,然后将订单分开的不同酒吧和厨房按商品分隔,如何在android应用程序中这样做,请提出任何建议
此概念没有任何代码
<string-array name="bar">
<item>drink_1</item>
<item>drink_2</item>
<item>drink_3</item>
</string-array>
<string-array name="kitchen">
<item>food_1</item>
<item>food_2</item>
<item>food_3</item>
</string-array>
然后针对用户订单上的每个项目,您可以在以下两个字符串数组之一中检查活动是否存在:
String[] bar = getResources().getStringArray(R.array.bar); String[] kitchen = getResources().getStringArray(R.array.kitchen); if (Arrays.asList(bar).contains("First item in user order e.g drink1") { // found a match in bar, send to bar } else if (Arrays.asList(kitchen).contains("First item in user order e.g drink1") { // found a match to kitchen, send to kitchen } else { // does not match }