목록전체 글 (1352)
오늘도 공부
Posted on May 18, 2013 by Max AlleyI wrote a post about how to create and style the TabHost component in Android. Not surprising they have recently depreciated this widget in favor FragmentTabHost so I figured I’d run through the same examples as I did with TabHost just to document it. Most of this is taken from the SDK examples. UPDATE: Since FragmentTabHost does not offer an icon option, I hav..
public static String implode(String separator, String... data) { StringBuilder sb = new StringBuilder(); for (int i = 0; i to not add separator at the end if (!data[i].matches(" *")) {//empty string are ""; " "; " "; and so on sb.append(data[i]); sb.append(separator); } } sb.append(data[data.length - 1].trim()); return sb.toString(); }You can use it likeSystem.out.println(implode(", ", "ab", " "..
출처 ㅣ http://tigerwoods.tistory.com/31안드로이드 Study 목차가기 예제 프로젝트 다운로드 023_Preferences_01.zip 1. 환경설정 개요 (Preferences) 안드로이드 플랫폼은 Data를 저장하는 방법으로 환경설정(이하 Preferences), 파일, Local DB, 네트워크를 제공한다. 그 중 Preferences는 가장 간단하게 정보를 저장하는 방법(mechanism)을 제공하며, App이나 그 컴포넌트 (Activity, Service 등)의 환경 설정 정보를 저장/복원하는 용도로 사용된다. ▌Preferences의 형태▐안드로이드에서 Preferences는 ListView의 형태로 표현되며 쉬운 Preferences의 구현을 위해 Preferenc..
출처 : https://plus.google.com/+SewonAnn/posts/Cmk3ue55iJK 카톡 스타일의, 화면 꺼진 상태에서도 푸시가 오면 알림창을 띄우는 기능을 구현해야 했다. 처리 절차는 다음과 같다. 1. 푸시를 받았는데 화면이 꺼져있다면 2. 락 스크린 위로(!) 특정 액티비티를 실행한다. 3. 이 액티비티에서 원하는 액션을 수행한다. (대게 '보러가기' / '닫기' 수준이겠지) 1번에선 화면이 꺼져있는지 여부를 확인해야 하고, 이는 다음과 같이 확인할 수 있다. public static boolean isScreenOn(Context context) { return ((PowerManager)context.getSystemService(Context.POWER_SERVICE)).is..
/* * 파일명 : Calendar.js * 원본출처 : 인터넷(원작자 알수 없음. 있다면 메일 주시기 바랍니다.) * 수정자 : 손대관(pinerest@naver.com) * 프로그램 설명 : createPopup을 이용한 달력 출력 자바스크립트. * 2008. 2. 7 : CSS의 분리, 코드 최적화, 버그 수정 및 프로젝트에 적합하게 하기 위해 수정작업이 있었습니다. * 2008. 2 .16 : IE6에서 주석으로 야기되는 오류로 인해 모든 주석 삭제. 주석버전은 메일주시면 드리겠습니다. * 2008. 2. 18 : 변수 명 규격화 * 2008. 2. 20 : 날짜 형식 8자리에서 10자리로 변경 * 2008. 2. 25 : IE6에서 오류로 인해 GetObjectTop, GetObjectLeft함..
출처 : http://crowjdh.blogspot.kr/2013/11/v3.htmlCh1. 준비0. Android SDK Manager -> Extras -> Google Play Billing Library 다운받고 설치한다.1. Google Play Developer Console 여기로 가서 내 앱 추가 - Prepare Store Listing 상태로 추가.2. /extras/google/play_billing/IInAppBillingService.aidl 파일을 프로젝트의 com.android.vending.billing 에 복사한다.3. /extras/google/play_billing/samples/TrivialDrive/src/com/example/android/trivialdrivesa..
츌처 : http://stackoverflow.com/questions/13991301/android-maps-api-v2-draw-circle// 1. some variables: private static final double EARTH_RADIUS = 6378100.0; private int offset; // 2. convert meters to pixels between 2 points in current zoom: private int convertMetersToPixels(double lat, double lng, double radiusInMeters) { double lat1 = radiusInMeters / EARTH_RADIUS; double lng1 = radiusInMeters ..
먼저 리스트뷰에서는 다음처럼 설정한다.예) listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); 그러면 이제 체크 상태를 ListView가 관리하게 된다. 그런데, custom view를 쓰면 ListView가 그 안에 있는 뷰 중 Checkable이 있으면 checked 상태를 바꾼다. 이 점을 이용하면 checkbox와 연동하게 할 수 있다. getView에서는 checkbox를 다음과 같이 설정한다. 안드로이드의 ListView에서는 focusable 뷰가 포함되어 있으면 onItemClick을 비롯한 여러 가지 ListView의 기본 동작이 안 먹는다. 그래서 CheckBox에서 focusable을 빼는 것. 그러면 리스트의 항목을 클릭할 때 check..
//Uri에서 이미지 이름을 얻어온다. final Uri selectImageUri = intent.getData(); final String[] filePathColumn = {MediaStore.Images.Media.DATA}; final Cursor imageCursor = this.getContentResolver().query(selectImageUri, filePathColumn, null, null, null); imageCursor.moveToFirst(); final int columnIndex = imageCursor.getColumnIndex(filePathColumn[0]); final String imagePath = imageCursor.getString(columnIndex)..
출처 : http://snowbora.tistory.com/421그동안 안드로이드에서의 Bitmap 이미지 관련해서 많은 글을 남겼는데, 거의 최종 버전에 가까운 글입니다. 관련글은 [안드로이드] URL을 이용해서 이미지 다운로드 하기 [안드로이드] URL을 이용해서 이미지 다운로드 하기 (멀티 쓰레드 이용) [안드로이드] 이미지 로딩할 때 메모리 초과할 경우(bitmap size exceeds VM budget) [안드로이드] Bitmap 이미지를 파일로 저장하기 [안드로이드] 특정 폴더에서 오래된 파일 삭제하기 이며, 관련글도 차례로 보는게 더 도움이 되실겁니다. 기본적인 뼈대는 구글 블로그에 공개되어 있는 멀티 쓰레드를 이용한 이미지 다운로드 소스입니다. 여기에 URL을 이용한 파일 캐싱 기능과 이..