본문 바로가기

[Android] Can not perform this action after onSaveInstanceState Fragment를 이동할때 아래와 같은 illegalStateException이 발생할 때가 있다. Fatal Exception: java.lang.IllegalStateExceptionCan not perform this action after onSaveInstanceState 이건 테스트할때 잘 발생하지 않는 이슈라 그냥 넘기기 쉽지만,참고해서 코딩하는 것도 나쁘지 않아 보인다. 이건 Exception은 Activity에서 onSaveInstanceState 함수를 호출된 상태에서 commit 함수를 호출 했을때발생한다고 한다. 1. Activity1 onActivityCreated 에서 commit 호출2. Activity2 로 전환3. Activity1에서 onSaveInstanceState 호.. 더보기
[Android] FileProvider :: android.os.FileUriExposedException File 경로를 Uri로 변경하고자 할 경우 아래와 같이 이용한다. Uri.parse(File 경로) 앱 내부로 이용하는 것은 문제가 없지만,MediaPlayer나 Intent로써 다른 앱으로 값을 전달하고자 할 경우,아래와 같은 Exception이 발생한다. android.os.FileUriExposedException 이 Exception은build.gradle에 targetSdkVersion이 24 이상으로 설정 되어 있을 경우 발생 한다. 그 이유는 앱과 앱간의 파일 공유를 진행할 시, 보안이 강화 되었기 때문이다.이 문제를 해결하기 위해선 FileProvider를 이용하여 임시 권한을 할당해줘야 한다. 1. res/xml/provider_paths.xml xml을 통하여 권한을 주고자 하는 폴더.. 더보기
[iOS] UIScrollView 이동 import Foundation extension UIScrollView { // Scroll to a specific view so that it's top is at the top our scrollview func scrollToView(view:UIView) { if let origin = view.superview { // Get the Y position of your child view let childStartPoint = origin.convert(view.frame.origin, to: self) let bottomOffset = scrollBottomOffset() if (childStartPoint.y > bottomOffset.y) { setContentOffset(bottomOf.. 더보기
[Kotlin] execution failed for task app compiledebugaidl AIDL 파일은 Service와 이벤트 나 데이터를 교환하기 위해 정의하는 파일 입니다. 참고 : http://gogorchg.tistory.com/entry/Android-AIDL-%ED%8C%8C%EC%9D%BC-%EC%98%88%EC%A0%9C AIDL 파일을 사용하고자 할 때, 빌드 중에 아래 와 같은 에러가 보이기도 한다. execution failed for task app compiledebugaidl 아래는 StackOverFlow에 올라와 있는 참고 에러 입니다. Error:Execution failed for task ':library:compileReleaseAidl'. > java.lang.RuntimeException: com.android.ide.common.process.Pro.. 더보기
[Android] scrollview match_parent not working ScrollView 안에 있는 View에 match_parent를 줬는데도 높이가 변경이 되지 않는다. 위 소스를 보면 간단하다. NestedScrollView 안에 TextView가 들어 있다.layout_height 값이 match_parent로 되어 있지만, 아래와 같이 높이가 변경 되지 않았다. 이럴 경우 ScrollView에 속성 하나만 추가해주면 된다. android:fillViewport="true" 위 속성만 추가 해주면 된다.그럼 ScrollView 안에 있는 View를 Strech 해주는 역할을 합니다. 출처: https://stackoverflow.com/a/10211418 참고 하세요. 더보기
[iOS] Use UILabel in UIScrollView with Autolayout UILabel 에 표시할 텍스트 값이 길어질 경우, Scroll을 이용하기도 한다.이럴 경우 UITextView를 이용하면 쉽게 제어가 가능하다. 하지만, UITextView를 사용할 경우 텍스트 세로 정렬이 힘들다.기본적으로 Scroll이 할당되어 있어서 그런 듯 하다. 만약, 텍스트가 짧을 경우는 가운데에 표시 하고텍스트가 길어질 경우 스크롤로 보여주고 싶을 경우는 어떻게 하는게 편할까?? 여러 테스트를 해본 결과, 전 UILabel을 UIScrollView로 감싸는 형태로 했다. 아래가 설정이 가장 중요하다! 1. ScrollView와 Label Bottom을 일치 시킨다. (완전히 일치 시킬 필요는 없ㄷ가.)2. ScrollView와 Label의 Height를 '>=' 로 설정 한다. 혹시 필요하.. 더보기
[iOS] UITextView Scroll to top UITextView를 로드 하고 나서 보면 Scroll이 생성되는 것 까지는 좋지만,하단에 위치 되는 문제점이 발생한다. 그래서 Scroll을 Top으로 이동시키고자 할 경우 여러가지 방법이 있지만 저같은 경우 아래 방법으로 하는 편이 직관적이고 동작도 원활하게 이루어 졌다. let contentHeight = uiTextView.contentSize.height let offSet = uiTextView.contentOffset.x let contentOffset = contentHeight - offSet uiTextView.contentOffset = CGPoint(x: 0,y: -contentOffset) Content 실제 높이 값으로 Offset을 이동 시키는 소스이다.참고하세요. 출처 : h.. 더보기
[Android] HostnameVerifier에 대한 Warning이 떴을 경우 구글 플레이에 앱을 등록할 때 아래와 같은 보안 알림을 받을 수도 있다.이것이 무엇인가?? HostnameVerifier를 안전하게 사용하고 있지 않다는 건데 혹시 소스가 아래와 같은 형태로 되어 있지 않나 확인해보자. try { TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { X509Certificate[] myTrustedAnchors = new X509Certificate[0]; return myTrustedAnchors; } @Override public void checkClientTrusted(X509Certificate[].. 더보기