본문 바로가기
[android] DB 를 update 혹은 insert 할 떄 주의해야 할 것 ( thread ) android, DB 를 update 혹은 insert 할 떄 주의해야 할 것 ( thread ) DB 에 write ( update or insert ) 를 할 때 2개의 다른 thread 에서 동시에 진행한다면 한 thread 에서는 실패한다. 하나가 끝나기를 기다리는 것이 아니라 바로 fail 한다. ( synchronized 와 같이 wait 상태가 아니다. )경우에 따라서는 Exception 을 내뱉는 것이 아니라, 그냥 log 에 기록하는 것이 전부이기도 하다. 이것은 singleton synchronize database instance 로 해결할 수 있다. 덧붙여 Provider 역시 multi thread 에서 접근할 수 있기 때문에 open provider의 경우 이에 대한 대처를 꼭 .. 2014. 3. 13.
[android] how to apply actionBarStyle and android:actionBarStyle both? android, how to apply actionBarStyle and android:actionBarStyle both? android developer reference 문서를 보면,actionbar 에 custom style 을 적용하면서 compatibility 이슈를 동시에 해결하려면android:actionBarStyle 과 actionBarStyle 을 동시에 적용할 것을 설명해준다. 하지만, Eclipse 에서 실제로 적용해보면 인식할 수 없다는 xml error 가 발생한다. 이는 다음과 같이 해결할 수 있다. 1. tools 라는 name space 를 정의해준다. xmlns:tools="http://schemas.android.com/tools" 2. android:actionBar.. 2014. 3. 5.
[android] viewpager fragment visibility check. android, viewpager fragment visibility check. 2가지 방법이 있다 : setMenuVisibility, setUserVisibleHint 하나는 setMenuVisibility 를 override 하여 전달되는 visible 값을 체크하는 것이다.ViewPager 의 해당 페이지의 fragment 가 focus 되면 해당 함수가 불린다. @Override public void setMenuVisibility(final boolean visible) { super.setMenuVisibility(visible); if (visible) { ... } } 두번째는 setUserVisibleHint 를 override 하여 isVisibleToUser 값을 체크하는 것이다... 2014. 3. 4.
[android] PagerTitleStrip example android, PagerTitleStrip example PagerTitleStrip? ViewPager 안에 들어가 ActionBar 의 Tab 과 비슷한 효과를 낼 수 있는 녀석을 이야기한다. xml java FragmentPagerAdapter{private static final String[] titles = { "Page 1", "Page 2", "Page 3", "Page 4" }; @Overridepublic CharSequence getPageTitle(int position) { return titles[position];}} actionbar, Android, android.support.v4.view.PagerTitleStrip, android.support.v4.view.View.. 2014. 2. 26.
[android] 왜 MediaStore.ACTION_VIDEO_CAPTURE 를 실행하면 activity 의 oncreate 가 다시 불리는가? [android] 왜 MediaStore.ACTION_VIDEO_CAPTURE 를 실행하면 activity 의 oncreate 가 다시 불리는가? Activity 의 onCreate 가 다시 불린다는 것은, activity 가 destroy 되고 recreate 된다는 이야기하는 것인데,보통 activity가 recreate 되는 경우는 config change 의 경우로 볼 수 있다. 기본적으로 동영상 촬영의 경우 orientation 이 가로모드 ( landscape mode ) 가 되기 때문에,portrait mode 로 activity 를 유지하던 경우에는 orientation 이 돌아가 recreate 의 경로를 타게 된다.따라서 이를 방지하기 위해서라면 manifest 의 MediaStore... 2014. 2. 23.
[android] how to remove checkbox image or replace to other images. android, how to remove checkbox image or replace to other images. How to remove checkbox image. android:button="@null" How to replace checkbox image. android:button="@null"android:drawableLeft="@drawable/icon_selector" @null, androi:drawableBottom, androi:drawableLeft, androi:drawableRight, androi:drawableTop, Android, android:button, Button, how to remove checkbox image, how to replace checkbox.. 2014. 2. 19.
[android] getSupportFragmentMaanger 를 통해 MapFragment 를 불러올 경우. android, getSupportFragmentMaanger 를 통해 MapFragment 를 불러올 경우. 1. xml 에 class 관련된 정의가 있어야 함. class="com.google.android.gms.maps.SupportMapFragment" 2. MapFragment 가 아닌 SupportMapFragment 로 받아와야 함. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById( R.id.map ); Android, CLASS, class 정의, class="com.google.android.gms.maps.SupportMapFragment", com.goog.. 2014. 2. 19.
[android] Parcelable vs Serializable android, Parcelable vs. Serializable Serializable 은 Java 만 아는 사람이라면 쉽게 알 수 있는 serialization 방법.그냥 Serializable 을 implementation 만 해주면, serialize 가 필요한 순간에 알아서 serialze 해주는 편리한 marker interface. 그러나, mobile 시대가 강림하면서 등장한 유망한 어린이(?) 가 있으니 그는 바로 Parcelable.이 녀석은 IPC ( Inter Process Communication ) 에 최적화된 녀석으로.Serialize 보다 속도가 빠르다.물론, 해야 하는 일은 Serialize 보다 훨씬 많다.직접 serialize 되어야 할 녀석들을 선별해서 그것을 쓰고 읽.. 2014. 2. 15.
[android] soft input ( keyboard ) visibility 판단 android, soft input ( keyboard ) visibility 판단 private static final int SOFT_INPUT_MINIMUM_HEIGHT = 300; ViewGroup.getViewTreeObserver().addOnGlobalLayoutListener( new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { mIsSoftInputShown = isSoftKeyboardShown( Activity, ViewGroup ); }}); private boolean isSoftKeyboardShown( Activity activity, View containerView ){int decorViewHei.. 2014. 2. 14.
반응형