如何通过 Intent 检索和分离数组中传递的多个数据从一个 Activity 到另一个

How to retrieve and separate multiple data passed in an array from One Activity to another via Intent

我无法在接收中分离通过数组一起传递的两个数据元素Activity

我已经通过相同的 Intent Extra 将 material 数据和价格数据传递给另一个 activity。我已经成功地接收到 recieving Activity 中的数据并发布到 Textview 字段。这样它看起来像这样,"Chicken wings 1000" 在屏幕上。但是我想将这两条数据分开到同一屏幕上的两个不同的 Textview 字段。问题是我无法将两者与阵列分开。我的代码如下

发送中Activity

Cursor category1 = controller.categotyforGroupedLv();
        Cursor itemListCategory;
        listDataHeader = new ArrayList<>();
        listHash = new HashMap<>();

        if (category1.getCount() == 0) {
           category1.moveToFirst();

        }

                 while (category1.moveToNext()) {
                listDataHeader.add(" " + category1.getString(1));


                itemListCategory = controller.getFPMsster(category1.getString(1));   

                List<String> listDataItem = new ArrayList<>();
                if (itemListCategory.getCount() != 0) {
                    while(itemListCategory.moveToNext()) {
                        listDataItem.add(" " + itemListCategory.getString(3)+ " " + itemListCategory.getString(4));

意图是

 mIntent = new Intent(OrderTakingScreen.this,
                        OrderTakingScreen2_OrderDetails.class);

                               mIntent.putExtra("keyName", listHash.get(listDataHeader.get(groupPosition)).get(childPosition));

在接收Activity我有

 TextView menuChoice = (TextView) findViewById(R.id.menuchoice);
    String data = getIntent().getExtras().getString("keyName");
    menuChoice.setText(data);  

在 "KeyName" 变量中,我将 "Chicken Wings 1000" 打印到 TextView 字段。我希望能够将它们分开并将 "Chicken Wings" 打印到一个 TextView 屏幕并将“1000”打印到不同的 TextView 字段

如果这是每个字符串的模式:
表示最后一条数据是一个数字或者一个单词
然后可以通过找到最后一个 space char:

的索引来分开它们
String text = "Chicken wings 1000";
String item1 = text.substring(0, text.lastIndexOf(' '));
String item2 = text.substring(text.lastIndexOf(' ') + 1);
System.out.println("item1 = " + item1);
System.out.println("item2 = " + item2);

将打印

item1 = Chicken wings
item2 = 1000