*/Android 18

[안드로이드] AWS Rekognition API 사용하기

[Amazon Rekognition 이미지에서 텍스트 감지 (nodejs)] https://sssbin.tistory.com/185 이번엔 Rekognition API를 안드로이드에서 사용해보려고 한다. (사실 1년 전에 했던 프로젝트다...) 사용자가 카메라로 사진을 찍으면 S3 버킷에 업로드한 후 Rekognition을 수행한 결과를 반환하도록 할 것이다. ✅ AWS 설정 - IAM 계정, S3 버킷 새성 (위 링크 참고) - Amazon Cognito 자격 증명 풀 생성 - 로그인 기능 X -> 인증되지 않은 자격 증명에 대한 액세스 활성화 (Unauth) - Cognito 권한 부여 - IAM > 역할 > Cognito 자격 증명 풀 생성할 때 만들어진 역할 선택 (Unauth) > 권한 추가 -..

*/Android 2023.04.08

[안드로이드] 서버 통신 시 예외 처리가 제대로 안 될 때

안드로이드에서 예외 처리를 해주지 않으면 애플리케이션이 죽어버리기 때문에 예외 처리는 꼭 해줘야 한다. 근데 자꾸 응답 코드는 실패로 들어오는데, response가 성공으로 처리되어서 한 시간동안 헤맸다... ▼ 처음 코드 class PostNewClubService(val newClubInterface: PostNewClubInterface){ private val retrofit: GroupRetrofit = ApplicationClass.sRetrofit.create(GroupRetrofit::class.java) fun tryPostNewClub(clubInfo: GroupNewRequest){ retrofit.postNewClubReq(clubInfo).enqueue(object : Callba..

*/Android 2023.03.09

[안드로이드] 디자인 패턴 정리 (MVC, MVP, MVVM)

MVC 패턴 ① 구조 - Model: 애플리케이션에서 사용되는 데이터와 그 데이터를 처리하는 부분 - View: 사용자에게 보여지는 부분 (UI) - Controller: 사용자의 입력을 받고 처리하는 부분 ② 동작 1. 사용자의 이벤트가 Controller로 들어온다. 2. Controller에서 이를 확인하고 Model에서 데이터를 업데이트한다. 3. Controller는 Model을 나타낼 View를 선택한다. 4. View는 Model로부터 데이터를 받아 UI를 갱신한다. ③ 단점 - View와 Model 사이의 의존성이 커진다. -> 유지보수가 어려움 MVP 패턴 ① 구조 - Model: 애플리케이션에서 사용되는 데이터와 그 데이터를 처리하는 부분 - View: 사용자에게 보여지는 부분 (UI)..

*/Android 2023.03.09

[안드로이드] 가로 달력 커스텀 (SingleRowCalendar)

https://github.com/miso01/SingleRowCalendar GitHub - miso01/SingleRowCalendar: Android library for horizontal single row calendar. With this library, you aren't attached to Android library for horizontal single row calendar. With this library, you aren't attached to library built-in UI. You can create really beautiful and customizable UI and use selection features... github.com 완성본부터..! 사용법, 예제는..

*/Android 2023.03.08

[안드로이드] Activity, Fragment LifeCycle

1. Activity LifeCycle onCreate() - 필수적으로 구현해야 한다. - 액티비티가 처음 생성되었을 때 호출된다. (딱 한 번만 호출된다.) - XML, 멤버 변수 정의, 일부 UI 구성 등을 설정한다. onStart() - 활성 상태에 들어가면 호출된다. - 액티비티가 화면에 제대로 표시되기 직전에 호출된다. (나갔다가 들어오면 또 호출된다.) - 주로 UI를 관리하는 코드를 초기화한다. - 빠르게 완료되고 바로 onResume()을 호출한다. onResume() - 액티비티가 사용자와 상호작용이 가능해질 때 호출된다. - 어떤 이벤트가 발생하여 앱에서 포커스가 떠날 때까지 이 상태에 머무른다. - 생명주기 구성요소가 포그라운드에서 사용자에게 보이는 동안 실행해야 하는 모든 기능을 ..

*/Android 2023.03.06

[안드로이드] Activity, Fragment 간 데이터 주고받기 2

액티비티 -> 액티비티/프래그먼트 https://sssbin.tistory.com/212 [안드로이드] Activity, Fragment 간 데이터 주고받기 Activity -> Activity // LoginActivity (온클릭리스너 안에) Intent intent = new Intent(getApplicationContext(), MainActivity.class); intent.putExtra("nickname", res.getMessage()); startActivity(intent); // MainActivity (온크리에이트 안에) Int sssbin.tistory.com 이번엔 Fragment Result API를 이용하여 프래그먼트 -> 액티비티/프래그먼트 를 다뤄보려고 한다! Frag..

*/Android 2023.02.19

[안드로이드] Retrofit, Shared Preferences 객체 싱글톤 패턴으로 사용하기

Shared Preferences, Retrofit과 같은 객체들은 싱글톤 패턴으로 앱이 실행될 때 한번만 생성해놓고 사용하는 것이 효율적이다. (+ 데이터베이스 등등) // 앱이 실행될때 1번만 실행 class ApplicationClass : Application() { val API_URL = "-" // 전역변수 companion object { lateinit var prefs: SharedPreferences lateinit var sRetrofit: Retrofit } // 앱이 처음 생성될 때 override fun onCreate() { super.onCreate() prefs = applicationContext.getSharedPreferences("prefs", MODE_PRIVAT..

*/Android 2023.02.19

[안드로이드] Activity, Fragment 간 데이터 주고받기

Activity -> Activity // LoginActivity (온클릭리스너 안에) Intent intent = new Intent(getApplicationContext(), MainActivity.class); intent.putExtra("nickname", res.getMessage()); startActivity(intent); // MainActivity (온크리에이트 안에) Intent intent = getIntent(); String username = intent.getStringExtra("nickname"); Activity -> Fragment // MainActivity binding.btnWatch.setOnClickListener(new View.OnClickListen..

*/Android 2022.10.21