我想將arraylist的每個元素或值顯示爲tv.setText。顯示arraylist的每個元素以設置文本
arraylist的值來自1stactivity(第1屏幕),我想將它傳遞給第2個activity(第2屏幕)的tv.setText。
這裏的第一個活動
List<String> class_code = new ArrayList<String>();
class_code.add("test");
class_code.add("test2");
Intent intent = new Intent(1stscreen.this,2nd_screen.class);
intent.putStringArrayListExtra("code", (ArrayList<String>) class_code);
下面的代碼的第二個活動
tv.setText(getIntent().getExtras().getString("code"));
的代碼,但它顯示的ArrayList(測試和測試2)的所有價值,我只想要得到的第一數組列表的值。