일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 17837
- 제어반전
- github
- 프로그래머스
- Algorithm
- broadcastreceiver
- 두 동전
- 단축키
- goland
- 안드로이드
- ubuntu
- 데이터전달
- insert
- spring
- 16197
- Jenknis
- service
- IntelliJ
- 백준
- Java
- intent
- vscode
- activity
- 데이터
- mysql
- data
- Android
- 알고리즘
- 큐빙
- git
- Today
- Total
목록intent (3)
해보자
Service → Activity ____Service.java 1 2 3 4 Intent intent = new Intent(getApplicationContext(), ____Activity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("id", id); startActivity(intent); ____Activity.java 1 2 Intent a_intent= getIntent(); String id = intent.getStringExtra("id");
BroadcastReceiver → Service ___Receiver.java Intent intent = new Intent(context, ____Service.class); intent.putExtra("id", id ); this.context.startService(intent); ___Service.java @Override public int onStartCommand(Intent intent, int flags, int startId) { String id = intent.getStringExtra("id"); return super.onStartCommand(intent, flags, startId); }
Activity → BroadcastReceiver ____Activity.java intent = new Intent(this, ____Receiver.class); String id; intent.putExtra("id", id); sendBroadcast(intent); ____Receiver.java @Override public void onReceive(Context context, Intent intent) { String id = intent.getStringExtra("id"); }