일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 알고리즘
- broadcastreceiver
- goland
- 16197
- 큐빙
- intent
- activity
- 두 동전
- Algorithm
- mysql
- Jenknis
- ubuntu
- 안드로이드
- git
- spring
- 제어반전
- 17837
- 데이터전달
- 데이터
- 백준
- Java
- vscode
- insert
- Android
- IntelliJ
- data
- 프로그래머스
- github
- 단축키
- service
- Today
- Total
목록데이터 (2)
해보자
A Activity → B Activity A Activity Intent outIntent = new Intent(getApplicationContext(), ActivityB.class); outIntent.putExtra("data_1", data1); outIntent.putExtra("data_2", data2); setResult(RESULT_OK, outIntent); finish(); B Activity Intent intent = getIntent(); int data1 = intent.getExtras().getInt("data_1"); int data2 = intent.getExtras().getInt("data_2");
A Fragment → Activity → B Fragment A Fragment Bundle bundle = new Bundle(); bundle.putString("data_1", (String)data1); bundle.putString("data_2", (String)data2); (MainActivity)getActivity()).setFragment(bundle, BFragment.newInstance()); MainActivity public void setFragment(Bundle bundle, Fragment fragment) { Fragment ft = getSupportFragment().beginTransaction(); fragment.setArguments(bundle); ft..