본문 바로가기

전체 글

(32)
[안드로이드] AppBar 구현하기 AppBar 가 무엇인지 고유명사 - AppBar는 현재 화면의 타이틀을 포함하고, 위 그림에서 볼 수 있는 좋아요(하트 버튼) 버튼, 검색 버튼, 더보기 버튼 등 현재 화면에서 사용자가 할 수 있는 다양한 action을 담고 있는 막대 모양의 뷰이다. - 안드로이드에서 App bar라고 하는 것은Material Design에서 정의하는 상단의 바를 말한다. App bar의 각 명칭 1. Container 2. Navigation icon (optional) 3. Title (optional) 4. Action items (optional) 5. Overflow menu (optional) App bar라고 하는 것은 앞에서 말한 대로 Material Design의 디자인 명칭이고, 실제 구현되는 건 A..
레트로핏 onFailure: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ 2021-09-28 17:17:32.391 21102-21102/com.leebbr.blabla E/WritingActivity: onFailure: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ 이 에러는 서버로 부터 전달 받은 타입과 내가 예상한 타입이 맞지 않아서 발생하는 문제다 라고 한다..
[Android][Java] 채팅목록에 새로운 메시지 업데이트 하기 채팅목록에 새로운 메시지 업데이트 하기 로직 - 채팅서버에서 메시지 수신 - 수신받은 메시지 JDBC로 서버에 저장 - 채팅서버 -> 서비스로 메시지 전달 - 서비스 : 수신스레드로 메시지 받는다. if(내가 받는거라면, 내가 채팅방이 아니라면) { 인텐트로 채팅리스트 프래그먼트로 데이터 전달 받은 메시지의 방번호와 해당하는 곳에 채팅리스트에 add 해주고 갱신해준다. }
Non-static method 'show_notification(java.lang.String, java.lang.String, java.lang.String, java.lang.String)' cannot be referenced from a static context 에러 : Non-static method 'show_notification(java.lang.String, java.lang.String, java.lang.String, java.lang.String)' cannot be referenced from a static context 번역 : non-static 메서드 'show_notification(java.lang).문자열, 자바랑.문자열, 자바랑.문자열, 자바랑.문자열)'은 정적 컨텍스트에서 참조할 수 없습니다. 원인 : static인 스레드 안에 non-static인 show_notification 이 들어가 있어서 그런거 같다. 해결방법 : 1) show_notification 메소드를 static으로 바꾼다? -> 아예 수신스레드가 작동을 안한..
[Android][Java] RecyclerView 스크롤 마지막 position 얻기 채팅 구현할 때 채팅방에 있을 때 마지막으로 읽은 곳으로 리사이클러뷰 포커스를 맞춰주고 싶은데 어떻게 할까.. 하다가 onStop 될 때, 마지막 positon 쉐어드에 현재 있던 room번호를 key값으로 저장하고 해당 룸에 들어오면 방번호 저장한거로 onStart에 마지막 position 저장한거 불러와서 포커스 맞춰주기 했다. 생각보다 쉬웠는데 어떻게 구현해야 할 지, 삽질을 엄청헀당... public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); // 화면에 조금이라도 보이게되는 마지막 아이템의 포지션을 출력합니다. lastVisibleItemPosition = (..
[Android][Java] 리사이클러뷰 스크롤 부드럽게 내리기 layoutManager.smoothScrollToPosition(recyclerView, new RecyclerView.State(),lastVisibleItemPosition_if); layoutManager.smoothScrollToPosition(recyclerView, new RecyclerView.State(),recyclerView.getAdapter().getItemCount());
[Android][kotlin] Kotlin 코드를 Java 코드로 보기 안드로이드에서 코틀린으로 작성한 코드는 JVM으로 자바 바이트 코드(Java Bytecode)로 변환되어 동작한다고 한다. 안드로이드 스튜디오에서 코틀린(Kotlin)으로 작성한 코드를 자바(Java) 코드 형태로 보고 싶을 경우 1. Tools > Kotlin > Show Kotlin Bytecode 메뉴로 접근 2. 또는 cmd + shift + A (Mac) / ctrl + shift + A (Windows) 단축키 후 > Kotlin Bytecode 3. 위 과정을 거치게 되면 오른쪽에 Kotlin Bytecode 사이드 바가 생기는데 변환하고자 하는 파일에서 Decompile 버튼을 클릭한다. 4. 버튼을 클릭하게 되면 자바로 변환된 코드가 생성되어 코드를 확인할 수 있다. 위 같은 과정으로 자..
[Android][Java] Waiting for a blocking GC ProfileSaver 채팅 작동 느림 2021-08-30 23:49:14.966 24618-24649/com.leebbr.blabla I/m.leebbr.blabl: Waiting for a blocking GC ProfileSaver 2021-08-30 23:49:14.974 24618-24649/com.leebbr.blabla I/m.leebbr.blabl: WaitForGcToComplete blocked ProfileSaver on ProfileSaver for 8.510ms 채팅전달이 잘 안되다가 잘 될 때 이런게 나왔다.. 검색해 보니 https://www.py4u.net/discuss/619107 Android I/zygote64:Waiting for a blocking GC ProfileSaver I'm having this ..
[Android][Java] StringBuilder + 로 글자 더해주는 대신에 이거쓰면 좋을 것 같다 StringBuilder s = new StringBuilder(); s.append("aaa"); s.append("sdfsd"); System.out.println(s); 결과 : aaasdfsd
JDBC 튜토리얼 https://www.tutorialspoint.com/jdbc/index.htm JDBC Tutorial JDBC Tutorial JDBC API is a Java API that can access any kind of tabular data, especially data stored in a Relational Database. JDBC works with Java on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX. Why to Learn JDBC? JD www.tutorialspoint.com