일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- intent
- mysql
- 두 동전
- Android
- data
- 백준
- Algorithm
- vscode
- 알고리즘
- 데이터전달
- IntelliJ
- 16197
- 안드로이드
- github
- spring
- Jenknis
- 데이터
- Java
- service
- insert
- 프로그래머스
- 단축키
- 제어반전
- activity
- ubuntu
- broadcastreceiver
- goland
- 17837
- git
- 큐빙
- 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..