Android:通过多个活动传递字符串数组

Android: Passing String Array over Multiple Activities

我试图通过大约 3 类 传递一个字符串数组,最终将数组 [1] 的内容打印到文本视图。我一直在使用我的 arraylists 来实现这一点,它工作正常。出于某种原因,我无法让它与一个可怜的字符串数组一起工作。这就是我正在做的。

字符串数组的来源 Activity:

private String [] decisionInput = new String[1];

 textData = etShouldI.getText().toString();

            if (!textData.matches("")){

            decisionInput[0] = (String.valueOf(textData));

                test.setText(decisionInput[0]); //TEST WORKS

               //CREATE BUNDLE
                Bundle bundle = new Bundle();
                bundle.putStringArray("decision", decisionInput);

                //SEND BUNDLE DATA
            Intent intent = new Intent(this,Pro.class);
                intent.putExtras(bundle);
                startActivity(intent);}

在我的下一个 Activity 中,我有以下内容,以便接收数据,并将其发送到下一个 Activity,依此类推...

  String[] dPasser = new String[1];

@ONCREATE

//BUNDLE RECEIVER
   Bundle bundle = getIntent().getExtras();
    dPasser = bundle.getStringArray("decision");


    thisText.setText(String.valueOf(dPasser));  //TV currently returns null... 

@ONCLICK

//SEND DECISION DATA TO NEXT ACTIVITY
 Intent intent = new Intent(this, Next.class);
            Bundle b = new Bundle();
            b.putStringArray("decision", dPasser);
            intent.putExtras(b);

            startActivity(intent);

我做错了什么 $%@& 伙计们?

您将下面的代码放在一个名为 data 的文件中,然后在您的代码中通过调用 data.array

来使用它
public class data {
     public String[] array = new String[1];
}

但是只要传递一个 String[] 就不需要 bundle。

简直

intent.putExtra("stringArray".String[]);

并通过

获取
this.getIntent().getStringArrayExtra("stringArray")