๋ฐ์ํ
Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
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 |
Tags
- MySQL
- ์๋ฐ๊ธฐ์ด
- streamlit
- java
- Pandas
- ํ๋ค์ค๊ณต๋ถ
- ์๋ฐ์คํฌ๋ฆฝํธ ๊ณต๋ถ
- Streamlit๊ธฐ์ด
- ํ์ด์ฌ
- ์๋ฐ๊ณต๋ถ
- ์๋๋ก์ด๋ ์คํ๋์ค
- ์น๋์๋ณด๋ ์ ์
- ์น๋์๋ณด๋ ๊ธฐ์ด
- ์๋ฐ์คํฌ๋ฆฝํธ
- ์คํธ๋ฆผ๋ฆฟ ๊ธฐ๋ณธ
- ํ์ด์ฌ๊ณต๋ถ
- ์๋ฐ์ด๋ณด
- ๋ฐ์ดํฐ๋ฒ ์ด์ค
- serverless
- RESTful API
- ํ๋ค์ค
- ์๋ฐํ๋ก๊ทธ๋๋ฐ
- Streamlit๊ธฐ๋ณธ
- ์๋๋ก์ด๋ ์ฑ ๊ฐ๋ฐ
- ์คํธ๋ฆผ๋ฆฟ
- Flutter
- db
- JavaScript
- Android
- ์๋ฐ
Archives
- Today
- Total
ruriruriya
[Android] ์๋๋ก์ด๋ - ๋ค๋ก๊ฐ๊ธฐ ๋ฒํผ ์ค์ ํ๊ธฐ(getOnBackPressedDispatcher) ๋ณธ๋ฌธ
๐คAndroid/Java
[Android] ์๋๋ก์ด๋ - ๋ค๋ก๊ฐ๊ธฐ ๋ฒํผ ์ค์ ํ๊ธฐ(getOnBackPressedDispatcher)
๋ฃจ๋ฆฌ์ผใ 2023. 12. 27. 16:16๋ฐ์ํ
์๋๋ก์ด๋ ์ฑ์๋ ๋ค๋ก๊ฐ๊ธฐ ๋ฒํผ์ด ์๋ค.
Back ๋ฒํผ ์คํํ๋ ํจ์๋ฅผ ์์ฑํด๋ณด์.
getOnBackPressedDispatcher
onCreate ํจ์ ๋ด์์ ์์ฑํ๋ค.
// Back ๋ฒํผ ๋๋ ์ ๋ ํธ์ถ๋๋ ํจ์
getOnBackPressedDispatcher().addCallback(new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
// ๋ฐฑ๋ฒํผ ๋๋ ์ ๋ ํ๊ณ ์ถ์ ์ฝ๋ ์์ฑ.
// ๋ฉ์ธ Activity๋ก, ๋์ด +10 ๊ฐ ์ถ๋ ฅ
age = age+10;
Intent intent = new Intent();
intent.putExtra("age",age);
setResult(100,intent);
finish();
}
});
๋ฐ์ํ