본문 바로가기

프로그래밍/Android 짜투리 지식

[android] google analytics froyo 문제 Lollipop 버전에서 Google Analytics가 죽는 문제가 발생16797-16885/kr.co.tictocplus E/AndroidRuntime﹕ FATAL EXCEPTION: GAThread Process: PID: 16797 java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.google.android.gms.analytics.service.START (has extras) } at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1674) at android.app.ContextImpl.bindServiceCommon(Con.. 더보기
[android] google advertising id 이번에 google ads library가 google play service library와 합쳐지면서 추가적으로 Google Advertising Id의 사용이 권장되었다.때문에 gid를 사용하기 위해서는 안쓰던 google play service library를 추가해야한다.여기서 문제가 발생할 수 있는데. 바로 dex overflow이다.이걸 해결하기 위해 다음과 같은 방법이 제시 된다.- multiple dex- project.properties에 dex.force.jumbo=true- multidex support library 사용 참고 ☞ https://developer.android.com/tools/building/multidex.html- android studio dex increa.. 더보기
[android] dex index google play service 추가 시 dex index 초과 오류[2014-06-03 16:56:23 - Dex Loader] Unable to execute dex: Cannot merge new index 66570 into a non-jumbo instruction![2014-06-03 16:56:23 - TestApplication] Conversion to Dalvik format failed: Unable to execute dex: Cannot merge new index 66570 into a non-jumbo instruction! compile 시 dex table의 갯수가 2^16(65536)개 인데, 초과하면 dex loader에서 오류 발생. indexoverflow와 같은.. 더보기
[android] 한줄 팁 1. TextView 의 말줄임 위치 설정android:ellipsize="end"end / middle / start / none / marquee 2. 2.3 이하에서 dialog가 배경 테두리를 가질 경우 삭제dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); 3. bitmap recycle 시 유의사항 (14.06.13)bitmap을 recyle했다면 모든 참조를 끊어라.imageView 참조bitmap 전달인자 4. 서로다른 Notification은 서로다른 context를 써라.같은 context로 다른 Notification을 생성한다면 처음에 생성한 notificatio.. 더보기
[android] get resource id by String 내장된 resource를 가져오려면 약속된 key로 가져오게 된다. 가장 보편적으로 쓰는것이 파일이름이 image.jpg인 drawable에 대해 ImageView.setImageResource(R.drawable.image); 하지만 key를 모를경우, String으로 해당 resource를 찾아올 수 있다. private static Drawable getResource(String resName, Context context) throws NameNotFoundException { Context resContext = context.createPackageContext(context.getPackageName(), 0); Resources res = resContext.getResources(); .. 더보기
[android] ImageView Matrix android에서 사진을 회전시켜야 할 때가 있다.이때까지 내가 찾은 방법은 3가지 1. bitmap을 회전시킨다. (Bitmap)2. View를 회전시킨다. (Canavs)3. 카메라의 위치를 바꾼다. (Opengl) 여기서 1번에 대해서도 2가지 방법이 있다.1. bitmap을 회전시켜 bitmap을 재생성한다.2. bitmap을 회전시키지만 따로 저장하지 않는다. 여기서 판단의 기준이 되는건 역시나 메모리물론 요즘 OS가 좋아지고 힙 메모리도 좋아져서 왠만한 메모리 사용은 허용된다. 하지만 그렇다고 메모리를 막 쓸 수는 없다. 혹시나 모를 기근에 대비하자. 때문에 나는 처음에 bitmap을 재 생성해서 다루던 코드를 matrix로 view만 회전시키는 방법으로 바꿨다.이렇게 하면 적어도 bitmap.. 더보기
[android] [API] dropbox 1. About Dropbox APIEditDropbox Api에 대해2. androidManifest.xml Edithttps://www.dropbox.com/developers/sync/sdks/androi3. APIsEdita. sync. https://www.dropbox.com/developers/sync/docs/android b. core. https://www.dropbox.com/developers/core/docs c. datastore. https://www.dropbox.com/developers/datastore/tutorial/android core를 사용하면 됨4. app registerEdithttps://www.dropbox.com/developers/apps 5. star.. 더보기
java.lang.UnsupportedOperationException java.lang.UnsupportedOperationExceptionoccur : GLES20CANVAS.clipPath()reason : 기기가 하드웨어 가속을 지원하지 않음solution : ImageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); reference : 1. https://plus.google.com/+SewonAnn/posts/UMDdYQVgXbA2. http://stackoverflow.com/questions/7401319/use-hardwareacceleration-flag-with-canvas-clippath 더보기
[android] Kitkat 에서 바뀐 내용들.. android 4.4에서 큰 변화가 일어났다.갑자기 잘 되던게 안되기 시작했다. 그래서 바뀐 것 중 알아낸 것을 나열해봅니다. 1. Document Provider의 등장- picasa 처리 중 발견- Content Provider에서 media의 meta들을 가져오려다 보니 못가져옴.- 뒤져보니 Document Provider라는게 생겼다 함.- (Content Provider, Document Provider) 이 둘의 연관성은 아직 못찾음 2. getRunningTasks()의 변화- home key 또는 home key 롱 탭 시 기존에는 runningTask에 luncher / 실행중인 앱 리스트의 package가 등록이 됐다.- 하지만 이제는 안된다. - 이걸로 뭔가를 해놨다면 다른 방법을 찾.. 더보기
[android] 사진 찍은 후 사진 정보 onActivityForResult로 받기 카메라를 호출 하는 intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(PATH);startActivityForResult(intent, REQ_CODE_CAPTURE_NEW_PICTURE); 여기서 주의 할 점은 android.provider.MediaStore.EXTRA_OUTPUT주면 onActivityResult의 intent 가 null안주면 onActivityResult에 bitmap 인 intent.getExtras().get("data")가 반환된다. 더보기