더 쉬운 방법이 있나요? 사용자가 목록 항목을 클릭하면Android 목록 더 쉬운 방법보기
String[] values = new String[] { "1337", "2", "3DPD", "4", "10q",
"10x", "A C?", "AAF", "ADAD", "ADIH", "ADIP", "AEAP", "AFAICR",
"AFAICS"
};
final String[] title = new String[] { "1337", "2", "3DPD", "4", "10q",
"10x", "A C?", "AAF", "ADAD", "ADIH", "ADIP", "AEAP", "AFAICR",
"AFAICS"
};
final String[] content = new String[] {
" From the word Leet, derived from the word elite",
"too, or to",
" 3-Dimensional Pig Disgusting, denotes two dimensions are superior to reality",
"For", "Thank you", "Thanks", "AH! SI?", "As A Friend",
"Another Day Another Dollar", "Another Day In Hell",
" Another Day in Paradise", "As Early As Possible",
"As far as I can recall/remember", " As far as I can see",};
나는 다른 활동, 예를마다 배열에서 정보를 전달해야합니다 : 사용자가 "1337"이름을 가진 항목을 클릭하고 지금은 위치 0 세 배열에서 paramteres을 데려 갈거야 ... 클릭 할 때마다이 작업을 수행해야합니다.
switch (itemPosition) {
case 0:
Intent intent = new Intent(DisplayMessageActivity.this, AboutSlangs.class);
intent.putExtra(TITLE, title[0]);
intent.putExtra(CONTENT, content[0]);
startActivity(intent);
break;
더 쉬운 방법은 없나요?
Class<?>[] target = { ActivityA.class, ActivityB.class, ActivityC.class };
을하고 타일/콘텐츠 배열에 적절하게 위치 :
콘텐츠로 키와 값으로 hashmap이 있습니다. –
배열에 관한 것이 아닌 switch 문에 대해 묻습니다 : D –
매번 다른 활동이 동일하거나 변경됩니다 위치에 따라 다릅니 까? –