분류 전체보기
-
[Android] 문자열(String)로 resource ID 얻기Android 2021. 8. 13. 11:09
getIdentifier를 이용하여 리소스 이름, 타입, 패키지명을 파라미터로 넘겨 얻을 수 있음 kotlin val resourceID = resources.getIdentifier("확장자제외이름", "drawable", packageName) ex ) drawable 안에 있는 test.png 파일의 리소스 아이디를 가져올 때 val testImageID = resources.getIdentifier("test", "drawable", packageName)
-
[Kotlin] 비밀번호 정규식Android 2021. 8. 9. 20:31
숫자, 문자, 특수문자 중 2가지 포함(6~15자) ^(?=.*[a-zA-Z0-9])(?=.*[a-zA-Z!@#$%^&*])(?=.*[0-9!@#$%^&*]).{6,15}$ fun isPasswordFormat(password: String): Boolean { return password.matches("^(?=.*[a-zA-Z0-9])(?=.*[a-zA-Z!@#\$%^&*])(?=.*[0-9!@#\$%^&*]).{6,15}\$".toRegex()) }
-
[Navigation] popUpTo, popUpToInclusive 정리Android 2021. 8. 3. 10:06
popUpTo는 BackStack에서 어디까지 이동할 것인지 결정하는 속성 popUpToInclusive는 popUpTo로 지정한 fragment까지 pop 시킬 것인지 정하는 속성 ex) fragment1 -> frgment2 -> frgment3 -> frgment4 fragment3에서 fragment4로 이동하는 액션을 아래처럼 만들었다고 가정하면 fragment4에서 popBackStack() 시 fragment2로 이동함 만약 app:popUpToInclusive="true" 였다면 fragment1로 이동함