Android 52

안드로이드 리사이클러 뷰 구분선 및 색상 RecyclerView divider color

아주 간단하다.아래 처럼 넣어 주면, 색깔까지 완벽하게! DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mContext,LinearLayoutManager.VERTICAL); dividerItemDecoration.setDrawable(mContext.getResources().getDrawable(R.drawable.recyclerview_divider)); mRecyclerView.addItemDecoration(dividerItemDecoration);아래는 recyclerview_divider.xml

안드로이드 동적 컬러리스트 적용 ColorStateList setTextColor

color/a.xml ColorStateList colorStateList = null; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { colorStateList = context.getResources().getColorStateList(R.color.a, context.getTheme()); } else { colorStateList = context.getResources().getColorStateList(R.color.a); } textView.setTextColor(colorStateList) 요렇게 하면, 간단하게 컬러 리스트를 동적으로(programmatically) 적용 할 수 있다.

안드로이드 BroadcastReceiver ANR

브로드 캐스트 리시버 에서는 10 초 이내에 모든 작업을 완료 해야함. 그렇지 않으면 시스템이 죽여 버리거나, ANR을 발생 시킨다. 1. onReceive 에서 최대한 간결하게 코드를 처리 한다.1.1 다른 서비스로 리턴 시킨다.1.2 또는 goAsync()를 사용 하여 타임아웃을 연장 한다. 아래는 구글의 설명이다. /** * This can be called by an application in {@link #onReceive} to allow * it to keep the broadcast active after returning from that function. * This does not change the expectation of being relatively * responsive to..

Error : BinderProxy@ is not valid; is your activity running?

android.view.WindowManager$BadTokenException: Unable to add window — token android.os.BinderProxy@ is not valid; is your activity running? 보통 프로그래스 다이얼로그 띄우려고 하는데 발생 한다. 구글에서는 이런 에러를 이렇게 정의 하고 있다. 이 비정상 종료는 대개 앱에서 이전에 완료된 활동을 컨텍스트로 사용하여 대화상자를 표시하려고 시도하여 발생합니다. 예를 들어 활동이 종료되면 대화상자를 표시하려고 시도하는 AsyncTask를 트리거하지만 사용자가 작업이 완료되기 전에 활동에서 뒤로 이동하면 발생할 수 있습니다. 띄우려는 곳이 액티비티가 아니라면if(!((Activity) context).is..