【发布时间】:2019-11-25 20:21:19
【问题描述】:
在匹配时,我需要将数组索引的所有元素传递给另一个活动。这就是我所拥有的......
Intent LocationReview = new Intent(v.getContext(), ReviewActivity.class);
// iterate through array
for (int i = 0; i < locationReview.size(); i++) {
int locationID = locationReview.get(i).id;
int currentID = Integer.parseInt(tvId.getText().toString());
// compare id no. at index i of array
if ((locationReview.get(i).id == Integer.parseInt(tvId.getText().toString()))) {
// if match set putExtra array to locationReview.get(i)
**LocationReview.putParcelableArrayListExtra("locationReview", locationReview.get(i));**
itemView.getContext().startActivity(LocationReview);
} else {
Log.e("VerticalAdapter", "no matcon on locationReview");
}
}
if 语句比较 locationReview 数组中的 id 元素。如果该元素与文本视图中的字符串匹配,我需要 i 的数组索引及其所有元素,将其添加为可行数组并作为 Extra 添加到我的意图中。
【问题讨论】:
标签: java android arrays parcelable