๋ฐ์ํ
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 |
Tags
- Streamlit๊ธฐ๋ณธ
- ์๋ฐ๊ธฐ์ด
- ํ๋ค์ค๊ณต๋ถ
- ์๋ฐํ๋ก๊ทธ๋๋ฐ
- Matplotlib ๊ธฐ์ด
- ์น๋์๋ณด๋ ์ ์
- ์๋๋ก์ด๋ ์คํ๋์ค
- ์๋ฐ
- RESTful API
- Streamlit๊ธฐ์ด
- serverless
- ์น๋์๋ณด๋ ๊ธฐ์ด
- MySQL
- ์คํธ๋ฆผ๋ฆฟ
- ์๋ฐ์คํฌ๋ฆฝํธ
- Pandas
- streamlit
- ํ์ด์ฌ
- ์๋๋ก์ด๋ ์ฑ ๊ฐ๋ฐ
- JavaScript
- java
- ์๋ฐ๊ณต๋ถ
- ์คํธ๋ฆผ๋ฆฟ ๊ธฐ๋ณธ
- ๋ฐ์ดํฐ๋ฒ ์ด์ค
- ์๋ฐ์คํฌ๋ฆฝํธ ๊ณต๋ถ
- Android
- ํ์ด์ฌ๊ณต๋ถ
- ์๋ฐ์ด๋ณด
- ํ๋ค์ค
- db
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();
}
});
๋ฐ์ํ