我在一个活动中
ArrayList<ArrayList<String>>
,所以基本上是一个列表列表。
我想完成的是,从活动1向活动2发送这个列表列表,因此我考虑了意图,但似乎无法找到必要的getExtra()。
更准确地说,
questions
包含
Strings
与问题相关,以及中的相应位置
answers
包含该问题的所有选定答案。
public class ReviewActivity extends AppCompatActivity {
ArrayList<String> questions = new ArrayList<>();
ArrayList<ArrayList<String>> answers = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_review);
Intent intent = getIntent();
questions = intent.getStringArrayListExtra("questions");
answers = intent.getStringArrayListExtra("answers");
}
我就是这样把原稿
阵列列表(&L);阵列列表(&L);字符串(>)&燃气轮机;
目的是:
Intent mIntent = new Intent(this, ReviewActivity.class);
mIntent.putExtra("questions", questions);
mIntent.putExtra("answers", answers);
startActivity(mIntent);
代码在行中给出了一个错误
answers = intent.getStringArrayListExtra("answers");
我明白为什么,但我如何才能找到解决办法?
谢谢