일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- PostgreSQL
- prolificinteractive/material-calendarview
- cocoapod
- springboot
- addTextChangedListner
- Dialog
- 리눅스
- backgroundTint
- Button
- podinit
- viewmodel
- DialogFragment
- android
- RestAPI
- editText
- calendar
- livedata
- Today
- Total
목록전체 글 (31)
코코딩딩

오류전문 /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/user_interface/error_report.rb:34:in `force_encoding': can't modify frozen String (FrozenError) from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/user_interface/error_report.rb:34:in `report' from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:66:in `report_error' from /Library/Ruby/Gems/2...
무조건 editText를 입력해야 하는 화면에서 바로 키보드가 열리는 동작을 구현하려면 다음과 같은 코드를 사용하면 된다. //name이라는 id를 가진 editText를 자동 선택해서 키보드가 열리게함 binding.name.requestFocus(); imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); // 다음 화면 이동 했을 때 및 pause같은 동작을 했을 때도 키보드가 뜨기 때문에 키보드 숨기는 코드 추가 @Override protected void ..
editText의 변화를 감지해 특정 조건을 만족하면 editText를 비어있는 상태로 만들고 싶어 setText(""); 를 했더니 무한 루프에 빠지는 버그가 발생했다. 해결하기 위해 다음과 같은 코드를 추가해 주었다. binding.pwEt.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChan..

public class main { public static void main(String[] args) { System.out.println("만나이 계산 : "+getAge(1995,5,26)); } public static int getAge(int birthYear, int birthMonth, int birthDay) { Calendar current = Calendar.getInstance(); int currentYear = current.get(Calendar.YEAR); int currentMonth = current.get(Calendar.MONTH) + 1; int currentDay = current.get(Calendar.DAY_OF_MONTH); System.out.println..

자바에서 시간 관련 클래스는 Date, Calendar, Time이 있는데 Date, Calendar 는 java.util 패키지에 있고 LocalTime ,LocalDate, LocalDateTime 은 java.time 패키지 안에 있다. 그런데 안드로이드에서 time 패키지를 사용하려고 하면 특정 버전 이하의 api 일 때 사용이 불가능하기 때문에 Calendar를 이용해 시간 관련 처리를 하고자 한다. public static void main(String[] args) { // 캘린더 Calendar cal = Calendar.getInstance(); // 캘린더에서 년 월 일 가져오기 System.out.println("지금 년도는 : "+cal.get(Calendar.YEAR)); Syst..
안드로이드에서 버튼을 누르면 새로운 activity로 이동 하는 등의 화면 전환을 하려면 다음과 같다. Intent intent = new Intent(getApplicationContext(),testActivity.class); startActivity(intent); 이렇게 하면 testActivity에 해당하는 화면이 뜨게된다. 데이터를 주고받기 위해서는 다음과 같다. // 데이터 담아서 보내기 Intent intent = new Intent(getApplicationContext(),testActivity.class); intent.putExtra("test","1"); intent.putExtra("test2","0"); startActivity(intent); //데이터 호출하기 getInt..

editText 위에 버튼을 올려서 구현하려면 다음과 같다. 위와 같이 구성을 했을 경우 버튼 2의 visibility를 "gone"으로 설정해주면 아래와 같이 버튼 1이 오른쪽으로 붙는다.

editText에 사용자가 텍스트를 입력할 때 자신이 editText를 클릭한 상태라는 것을 잘 알도록 하기 위해 색상을 변경하고, editText의 최소 길이 조건을 달성 했을 때 버튼이 활성화 되게 구현하고자 한다. 안드로이드에서 editText를 보면 기본 밑줄처리가 되어 있는데 이는 아래 코드와 같이 backgroundTint 를 설정해주면 색상을 변경할 수 있다. 자주 보는 editText들은 텍스트를 입력하기 위해 클릭상태(Focus)가 되면 활성화 되어 있다는 느낌을 받기 위해 색상을 변경하는 경우가 많은데 이는 아래와 같이 자바코드에서 backgroundTint를 변경하게 해주면 된다. setOnFocusChangeListener는 유저가 클릭을해 focus상태가 되있는지를 읽는 liste..
배열은 데이터를 나열해서 인덱스에 대응하도록 구성한 데이터구조 이다. 배열은 같은 종류의 데이터를 효율적으로 관리하기 위해 사용하며 데이터를 순차적으로 저장할 때 사용한다. 배열의 장점은 인덱스번호를 알고 있다면 빠른 접근이 가능하고 첫 데이터의 위치에서 상대적인 위치로 데이터를 접근한다는 장점이 있다. 단점은 데이터의 추가와 삭제의 어려움이 있고 사전에 최대 길이를 지정해야 한다. 배열의 읽기 읽기는 자료 구조의 특정 위치를 찾는 것이며 배열에서는 인덱스의 값을 찾는 것을 말한다. 배열에서 읽기는 인덱스의 시작 즉 0번인덱스의 메모리 주소를 바탕으로 하나씩 증가하는 값이기 때문에 원하는 인덱스의 번호로 바로 접근할 수 있어 빠르게 읽을 수 있다. public class Main { public stat..

예전에 스프링 프레임워크로 만들었던 restapi를 springboot로 구현하고자 한다. 결과적으로 봤을 때 boot가 설정할 부분이 더 적기 때문에 더 간편하게 구현할 수 있다. spring-boot, mybatis, postgresql 프로젝트 생성하기 spring starter project 를 이용해 maven 프로젝트를 만들어준다. 사용할 dependency는 다음과 같다. 1. spring boot devtools 2. spring web 3. jdbc api 4. myBatis framework 5. postgresql driver mapper,service등의 패키지를 만들때 경로는 기본 application 파일이 있는 위치를 신경써주어야 한다. 예를들어 com.example.apiex..