본문 바로가기

프로그래밍

[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")가 반환된다. 더보기
[android] google analytics 에 대해 알게 된 것들. Dispatch1. dispatch는 analytics.xml의 ga_dispatchPeriod 값을 세팅하면된다.2. ga_dispatchPeriod 의 단위는 sec다.3. dispatch는 Dispatcher class(Abstract)에 의해 실행되고, 한번에 최대 40개의 hit을 불러온다.4. Dispatch는 http 통신이다. 5. Dispatch는 for 반복에 의해 순차적으로 진행된다.6. Dispatch는 pending 된다. Log1. Log는 LogLevel에 따라 보여진다.2. v3 에서 Default level 은 warning이다. 더보기
[android] google Analytics google analytics google analytics를 처음 접했을때는 이걸 어떻게 해야하는지 감도 않오고, api는 수시로 바뀌고 method들은 시도때도없이 deplicate되어서 뭐가 뭔지 감도 잘 안왔다.그런데 막상 알아가보면 너무나도 간단하다. 1. 뭐할때 쓰나 - 특정 View(activity)에 대한 표시 - 특정 Event에 대한 표시 2. 범위는? - app version(androidmanifest.xml에 있는 version code) - 기기 모델 - os version - 등등 3. 어디서 보면되나 http://www.google.com/analytics/ android reference : https://developers.google.com/analytics/devgui.. 더보기
[android] listView의 touch 순서를 바꾸고자 할때 보통은 listview -> child item 순서인데descendantFocusability 로 해결가능본문Defines the relationship between the ViewGroup and its descendants when looking for a View to take focus.Must be one of the following constant values.ConstantValueDescriptionbeforeDescendants0The ViewGroup will get focus before any of its descendants.afterDescendants1The ViewGroup will get focus only if none of its descendants want it.. 더보기