본문 바로가기

전체 글305

Android] 파일 용량 / bitmap 용량 구하기 파일 정보 가져오기 | Android 개발자 | Android Developers 이 페이지는 Cloud Translation API를 통해 번역되었습니다. 파일 정보 가져오기 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. 클라이언트 앱이 콘텐츠 URI가 있 developer.android.com Cursor returnCursor = getContentResolver().query(bitmapUri, null, null, null, null); int sizeIndex = returnCursor.getColumnIndex(OpenableColumns.SIZE); returnCursor.moveToFirst(); long fileSize = returnCursor.getL.. 2024. 3. 22.
89] 프로그래머스 x 사이의 개수 Kotlin class Solution { fun solution(myString: String): IntArray { var answer = mutableListOf() var splitStr = myString.split('x') for (str in splitStr) { answer.add(str.length) } return answer.toIntArray() } } class Solution { fun solution(myString: String): IntArray { var answer: IntArray = intArrayOf() var list = myString.split("x") for (i in list) { answer += i.length } return answer } } class Solu.. 2023. 12. 15.
88] Kotlin 프로그래머스 문자열 바꿔서 찾기 https://school.programmers.co.kr/learn/courses/30/lessons/181864 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr class Solution { fun solution(myString: String, pat: String): Int { val chagedString = myString.replace('A' , 'X').replace('B', 'A').replace('X', 'B') if(chagedString.contains(pat)) return 1 else return 0 } } 2023. 12. 11.
Android] gradle ndk.adbfilters 오류 수정 ndk { abiFilters 'armeabi-v7a' , "arm64-v8a", "x86", "x86_64" } 이렇게 했더니 unexpected tokens 오류가 나와서 수정했다. ndk { abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64") } ndk { abiFilters.add("armeabi-v7a") abiFilters.add("arm64-v8a") } 2023. 11. 12.
88] 프로그래머스 숨어있는 숫자의 덧셈 (1) Kotlin char는 toInt 했을때 int가 반환되지 않는다. char.toString().toInt() 해줘야한다. class Solution { fun solution(my_string: String): Int { var answer: Int = 0 for(i in 0 until my_string.length){ if(my_string[i] in '1' .. '9') { answer += my_string[i].toString().toInt() } } return answer } } https://kotlinworld.com/436 [Kotlin] Char을 Int로 변환하는 세가지 방법 알아보기 : Char to IntChar을 Int로 변환할 때 많은 실수가 생기는 이유 Kotlin은 하나의 자료형을 다.. 2023. 10. 23.
87] 프로그래머스 짝수는 싫어요 kotlin class Solution { fun solution(n: Int): IntArray { val mulist = mutableListOf() for(i in 0 .. n) { if(i%2 == 1) mulist.add(i) } return mulist.toIntArray() } } https://hwan-shell.tistory.com/247 Kotlin] MutableList 기능 설명1. MutableListKotlin의 List에는 List와 MutableList가 있습니다.List는 읽기 전용이며 MutableList는 읽기/ 쓰기가 가능합니다. Kotlin에선 List인 listOf의 사용을 권장하고 있습니다. (코드의 선명함과 안정성 때hwan-shell.tistory.com 2023. 10. 15.