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