본문 바로가기

Android

NDK 에서 string 처리 NDK 에서 c 파일과 cpp 파일간의 string 처리가 약간 다른데 다음과 같다.c view plaincopy to clipboardprint?jint Java_com_example_ffmpeg_MoviePlayView_openMovie(JNIEnv *env, jobject thiz, jstring filePath) { const jbyte *str; int result; str = (*env)->GetStringUTFChars(env, filePath, NULL); result = openMovie(str); (*env)->ReleaseStringUTFChars(env, filePath, str); return result; } cpp view plaincopy to clipboardprint?js.. 더보기
SMS list Intent Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setType("vnd.android-dir/mms-sms"); startActivity(intent); 더보기
Calling a Java Method from Native Code http://journals.ecs.soton.ac.uk/java/tutorial/native1.1/implementing/method.html JAVA -> native 는 간단하지만 native -> JAVA 로 호출하기 위해서는 특정의 룰을 따라야 한다 그에 대한 기본적인 형태는 다음과 같다. /* * Copyright (c) 1995-1997 Sun Microsystems, Inc. All Rights Reserved. * * Permission to use, copy, modify, and distribute this software * and its documentation for NON-COMMERCIAL purposes and without * fee is hereby granted pro.. 더보기
한글 자소 분리 https://www.google.co.kr/search?q=%ED%95%9C%EA%B8%80%EC%9E%90%EC%86%8C%EB%B6%84%EB%A6%AC&oq=%ED%95%9C%EA%B8%80%EC%9E%90%EC%86%8C%EB%B6%84%EB%A6%AC&aqs=chrome..69i57.1914j0&sourceid=chrome&ie=UTF-8#newwindow=1&q=%ED%95%9C%EA%B8%80%EC%9E%90%EC%86%8C%EB%B6%84%EB%A6%AC+getJaso // ㄱ ㄲ ㄴ ㄷ ㄸ ㄹ ㅁ ㅂ ㅃ ㅅ ㅆ ㅇ ㅈ ㅉ ㅊ ㅋ ㅌ ㅍ ㅎ private final static char[] ChoSung = { 0x3131, 0x3132, 0x3134, 0x3137, 0x3138, 0x3.. 더보기
Bitmap 비율 대로 이미지 크기 조정하기 private Rect screenSize = new Rect(0, 0, 0, 0); bitmapSize = new Rect(0, 0, player.getBitmapWidth(), player.getBitmapHeight()); float h = player.getBitmapHeight(); int oldY = screenSize.bottom; if (player.getBitmap() == null) { Log.e(TAG, "null bitmap"); sendMessage(ON_ERROR, null); return ; } int newY = (int)(h * getRatioScale(player.getBitmap(), surfaceWidth)); int gap = (oldY - newY) / 2; scr.. 더보기
팝업 메뉴의 스타일 변경 - How to set the background of Android PopupMenu to White [duplicate] 팝업 메뉴의 스타일 변경http://stackoverflow.com/questions/16878662/how-to-set-the-background-of-android-popupmenu-to-whiteFor instance, try something like this: @style/PopupMenu.MyAppTheme And then on the style itself: @drawable/popup_menu_bg_color 더보기
Call & SMS & Chaton intent Call & SMS & Chaton intent Intent intent; if (v.getId() == call.getId()) { intent = new Intent(Intent.ACTION_DIAL); //Uri.parse("tel:" + TelNumber)); getContext().startActivity(intent); } else if (v.getId() == sms.getId()) { intent = new Intent(Intent.ACTION_VIEW); //intent.putExtra("sms_body", "The SMS text"); intent.setType("vnd.android-dir/mms-sms"); getContext().startActivity(intent); } else.. 더보기
메뉴 키 얻기 Android 4.x 이상이 되면서 메뉴키가 사라지고 ActionBar 위주로 코딩이 되어 있음에도 불구하고 메뉴키를 요구하는 클라이언트가 존재 하므로 이를 위해서 메뉴키를 받아다가 ActionBar 에 PopupMenu 를 호출하게 해야 한다. 이를 위한 코드 이다. @Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_MENU) { // Call your a menu event return true; } return super.onKeyUp(keyCode, event); } 더보기
ScrollView 에 최하단 확인 int vExtent = computeVerticalScrollExtent(); int vOffset = computeVerticalScrollOffset(); int vRange = computeVerticalScrollRange(); if ((vRange - vExtent) == vOffset) { // do not scrolling to bottom } 더보기
java.util.ConcurrentModificationException HashMap 을 이용하여 코딩 중에 다음과 같은 오류가 발생 하였다. 해결책을 찾아보니http://stackoverflow.com/questions/602636/concurrentmodificationexception-and-a-hashmapTry using a ConcurrentHashMap instead of a plain HashMapConcurrentHashMap 을 이용하니 이상없이 잘 된다. 더보기