본문 바로가기

전체 글310

Android] Targeting s+ (version 31 and above) requires that one of flag_immutable or flag_mutable 대응 / 안드로이드 12 https://developer.android.com/about/versions/12/behavior-changes-12?hl=ko 동작 변경사항: Android 12를 타겟팅하는 앱 | Android Developers Android 12를 타겟팅하는 앱에 영향을 주는 Android 12의 변경사항을 알아봅니다. developer.android.com 0 대신 PendingIntent.FLAG_MUTABLE를 추가한다. val pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_MUTABLE) https://onedaycodeing.tistory.com/159 안드로이드 12 PendingIntent 이슈 및 대응 .. 2022. 6. 16.
Android] Retrofit2로 데이터받아오기 Retrofit : Retrofit is a REST Client for Java and Android Retrofit uses the OkHttp library for HTTP requests. Retrofit쓰는 이유 Http개발을 빠르고 쉽게한다 통신 속도가 빠르다 . Json 구조의 데이터를 쉽게 가져올 수 있다. >> 서버와 통신하기 위한 라이브러리로 사용하면 서버와 통신 작업이 편해진다. 사용법 1. 라이브러리 추가 2. 권한 설정 >> 인터넷 권한 3. 데이터 모델 클라스 생성 >> @SerialzedName JSON으로 serialize 될 때 매칭되는 이름을 명시하는 목적으로 사용 @Expose object 중 해당 값이 null일 경우, json으로 만들 필드를 자동 생략해 준다. 4... 2022. 5. 16.
Android Studio] Api 키 숨기기 #gitIgnore API키 같은 중요 정보는 Git에 올리기 조심스럽다. 그래서 gitIgnore를 사용한다 gitIgnore에는 local.properties가 자동으로 들어가있다. local.properties서 api키를 추가해준다 Properties properties = new Properties() properties.load(project.rootProject.file('local.properties').newDataInputStream()) android { defaultConfig { ... buildConfigField "String", "API_KEY", properties["api_key"] } app 수준 gradle에 properties 정의해주고 buildConfigField에도 api키를 적어.. 2022. 5. 11.
Android] 키보드 보이기 숨기기 #windowSoftInputMode Activity 실행시 키보드가 바로 나타나게 하고 싶었다. manifest에서 해당 activity의 windowSoftInputMode 설정하면 끝. android:windowSoftInputMode="stateVisible" adjustUnspecified, adjustNothing도 가능하다. editText도 같은 방식으로 적용가능하다. 하지만 text가 여러개 있을때는 focus에 대한 설정이 따로 있어야할거 같다. 역시 문서에 친절하게 나와있다. Android 개발자 | Android Developers 애플리케이션의 시각적 사용자 인터페이스 일부를 구현하는 활동(Activity 서브클래스)을 선언합니다. 모든 활동은 매니페스트 파일의 {@code} 요소로 나타내야 합니다. 여기에 선언되지 .. 2022. 5. 5.
Android] 설정화면 구성하기 #preference 설정화면 구성하는 PreferenceFragment가 deprecate되서 찾아보았다. https://developer.android.com/guide/topics/ui/settings 설정 | Android 개발자 | Android Developers 참고: 이 가이드에서는 AndroidX Preference 라이브러리를 사용하는 방법에 대해 설명합니다. Android 10부터 플랫폼 android.preference 라이브러리에 대한 지원이 중단됩니다. 설정에서는 사용자가 애플리 developer.android.com 1. gradle에 implementation 'androidx.preference:preference-ktx:1.2.0' 추가해주고 2. res 아래 xml 폴더 만들어서 pref를 .. 2022. 5. 3.
날씨 앱 3] OpenWeather // 공공데이터포털 https://openweathermap.org/ Сurrent weather and forecast - OpenWeatherMap Leaving everything behind, people are fleeing conflict in Ukraine. They need shelter, food, and water. When you subscribe to our service, you can join us to help with donation of just of 20. Openweather will add 40 to each donation and send it to Disastrou openweathermap.org { "coord": { "lon": 127.0317, "lat": 37.5663 }, .. 2022. 4. 28.