일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- android
- podinit
- Dialog
- cocoapod
- viewmodel
- livedata
- Button
- prolificinteractive/material-calendarview
- backgroundTint
- RestAPI
- addTextChangedListner
- editText
- springboot
- calendar
- 리눅스
- PostgreSQL
- DialogFragment
- Today
- Total
목록일단기록 (27)
코코딩딩

오류전문 /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..

예전에 스프링 프레임워크로 만들었던 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..
제한시간을 두어 2분이 경과하면 메세지를 출력하는 기능을 구현하고자 한다. MainActivity Timer를 이용해 1초마다 int time의 값을 -1 씩 해 TextView(timeTv)에 출력하는 방법으로 타이머를 구현하였다. 타이머를 실행하는 부분은 timer.schedule(TaskCreate(),1000,1000); 인데 중간의 1000은 앱이 실행하자마자 바로 시간초가 진행되 1초의 딜레이를 준 것이며 마지막 1000이 1초마다 실행되는 부분이다. 안드로이드는 메인쓰레드 에서만 화면을 그릴 수 있기 때문에 runOnUiThread를 통해 textView의 값을 set 할 수 있다. 타이머가 2분이 되기 전에 화면을 이동 하더라도 타이머가 돌고있기 때문에 화면을 벗어날 때 timer.canc..