본문 바로가기
[android] AlertDialog Ok, Cancel button dismiss 방지 코드 안드로이드, AlertDialog Ok, Cancel button dismiss 방지 코드 가끔 AlertDialog 에서 Ok 혹은 Cancel 버튼 등을 눌렀을 때 dialog 를 dismiss 하지 않고 싶을 때가 있다. 대표적인 경우가 dialog 를 통해서 어떤 input 을 받는데 validation 조건을 만족시키지 못해서 다시 입력하라고 할 경우! 이럴 때 OnShowListener 를 이용하여, 필요한 버튼에 OnClickListener 를 내 것으로 걸어주면 된다. final AlertDialog alertDialog = ....; alertDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public v.. 2013. 9. 7.
[android] bitmap 전환 fade in & fade out sample code 안드로이드, bitmap 전환 fade in & fade out sample code 뭐 완벽하며 부드러운 구현은 아니지만, 그래도 image 가 그냥 "확" 바뀌는 어색함을 막기 위해서 fade in, fade out 을 어떻게 이용할 수 있을까 idea 를 제시한다. public class MainActivity extends Activity { private int[] resIds = new int[]{ R.drawable.black, R.drawable.blue };private int index = 0;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentVie.. 2013. 8. 19.
[android] MultipartEntity 내용 print out 안드로이드, MultipartEntity 내용 print out. 이미지파일을 server 에 업로드하거나 할 때는 아파치 ( Apache ) 의 library 에 있는 MultipartEntity 를 이용하면 편하다. 그런데 가끔가다 MultipartEntity 에 내용이 잘 들어가서 전달되는지 궁금하곤 하다. 이럴때는 다음 코드로 MultipartEntity 내용을 print out 할 수 있다. ByteArrayOutputStream bytes = new ByteArrayOutputStream();try {entity.writeTo( bytes );} catch ( IOException e ) {Log.e( TAG, "MultipartEntity print", e );}Log.e( TAG, "Mul.. 2013. 8. 8.
[android] extrernal image file path <-> MediaStore Uri ( conversion ) 안드로이드, external image file path MediaStore Uri ( conversion ) 경우에 따라서 Uri 와 File 을 전환해야 할 경우가 생긴다. external file path >Cursor cursor = getContentResolver().query( Uri.parse"content://media/external/images/media/1" ), null, null, null, null );cursor.moveToNext(); // 예외처리는 생략했습니다. 실제 코드에서는 예외처리를 잘 해주세요.String path = cursor.getString( cursor.getColumnIndex( "_data" ) );Uri uri = Uri.fromFi.. 2013. 8. 5.
[android] camera take and crop ( 사진 찍으면서 crop 까지 하기 ) 안드로이드, 사진 찍으면서 crop 까지 하기 갤러리로부터 이미지 선택하며 크롭하는 방법. Camera 로 사진을 찍으면서 Crop 까지 하는 sample code. private static final int REQUEST_CODE_PROFILE_IMAGE_CAPTURE = 545;private static final int REQUEST_CODE_PROFILE_IMAGE_CROP = 2103; private static final String TYPE_IMAGE = "image/*";private static final int PROFILE_IMAGE_ASPECT_X = 3;private static final int PROFILE_IMAGE_ASPECT_Y = 1;private static fina.. 2013. 8. 5.
[android] Gallery 로부터 사진 Crop 하며 Pick 하기 sample code. 안드로이드, Gallery 로부터 사진 Crop 하며 Pick 하기 sample code. 사진 찍으면서 크롭까지 하는 샘플 코드. Gallery 혹은 iPhone 용어로 Album 에서부터 Image ( 사진 ) 을 Crop 하며 Pick 하는 방법에 대한 Sample Code 를 제공한다. private static final int REQUEST_CODE_PROFILE_IMAGE_PICK = 545; private static final String TYPE_IMAGE = "image/*";private static final int PROFILE_IMAGE_ASPECT_X = 3;private static final int PROFILE_IMAGE_ASPECT_Y = 1;private static.. 2013. 8. 3.
[Java] Locale Based Date Format Sample Code. Java, Locale Based Date Format Sample Code. 요런 포맷을 얻고 싶다면.. 2013년 6월 30일 일요일오전 1:43 아래코드를 통해 dateFormat 과 timeFormat 을 각각 얻어서 출력시키면 된다.! Date now = new Date( System.currentTimeMillis() );DateFormat dateFormat = DateFormat.getDateInstance( DateFormat.FULL, Locale.getDefault() );DateFormat timeFormat = DateFormat.getTimeInstance( DateFormat.SHORT, Locale.getDefault() ); Date, date format, DateForm.. 2013. 7. 31.
[android] Webview 에 custom font 적용하기 안드로이드, Webview 에 Custom font 적용하기 구글링 해 본 결과, 안드로이드 2.1 버전에서는 버그로 이 방법이 적용 안 된다고 한다. 먼저 font file( TTF ) 은 asset 폴더에 넣는다. 안드로이드 폰트에 대해 알고 싶나요? 여기를 클릭! private void initView(){WebView webView = new WebView( this );setContentView( webView );String meta = "";String style = ""String body = "감자! Strong 감자! Bold 감자! 그냥"; String head = "";String htmlContents = "" + head + body + ""; webView.loadDataWit.. 2013. 7. 18.
[jQuery/Tutorial] Selector 를 통해 Element 선택하기. Selector 를 통해 Element 선택하기. [이전강좌] DOM의 Attributes 사용하기. jQuery 는 CSS3 가 제공하는 selector 대부분을 지원하고, 이외의 특별한 selector 들도 제공한다. ID 로 선택하기 $("#myID"); Class 이름으로 선택하기 $(".myClass"); Attribute 값으로 선택하기 $("a[href='newHtml.html']"); CSS 복합 selector 로 선택하기 $("#myID ul.myClass li"); Pseudo-selector $("a.external:first"); // external 이라는 class 를 가진 첫번쨰녀석$("tr:odd"); // tr 의 홀수번째 녀석들. $("#myForm:input") // .. 2013. 7. 17.
반응형