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