전체 글 127

시간(Time) 관련 함수 및 처리 방법

시간(Time) 관련 함수 및 처리 방법 * 현재 시간 얻기long time = System.currentTimeMillis(); * 날짜 및 시간 출력SimpleDateFormat dateTime = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss"); String str = dateTime.format(new Date(time));시간 설정시 hh는 12시간으로 표시, HH는 24시간으로 표시 * 시간 비교Date date1 = new Date(System.currentTimeMillis()); Date date2 = new Date(System.currentTimeMillis()); if(date1.compareTo(date2) < 0) { System.out.printl..

타이틀바 없애기, 상태바 없애기, Full Screen 모드 만들기

타이틀바, 상태바 없애기. Full Screen 모드 만들기 1. Manifest 파일에서 없애는 방법* 타이틀바 없애기* 타이틀바, 상태바 모두 없애기 2. 코드상에서 없애는 방법 - onCreate()에서 setContentView()를 호출하기 전에 아래 함수 호출* 타이틀바 없애기requestWindowFeature(Window.FEATURE_NO_TITLE);* 상태바 없애기getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);* 타이틀바, 상태바 모두 없애기setTheme(android.R.style.Theme_NoTitleBar_Fullscreen); ..

JNI/자바 배열을 C배열로 변환하는 방법

JNI/자바 배열을 C배열로 변환하는 방법 * 변환함수반환값 함수원형 jboolean* (*GetBooleanArrayElements)(JNIEnv*, jbooleanArray, jboolean*) jbyte* (*GetByteArrayElements)(JNIEnv*, jbyteArray, jboolean*) jchar* (*GetCharArrayElements)(JNIEnv*, jcharArray, jboolean*) jshort* (*GetShortArrayElements)(JNIEnv*, jshortArray, jboolean*) jint* (*GetIntArrayElements)(JNIEnv*, jintArray, jboolean*) jlong* (*GetLongArrayElements)(JNIE..

JNI/네이티브 코드에서 자바 메서드 호출 방법

JNI/네이티브 코드에서 자바 메서드 호출 방법 JNIEXPORT void JNICALL Java_com_example_helloworld_HelloWorld_call (JNIEnv* env, jobject obj) { jclass cls = (*env)->GetObjectClass(env, obj); // 이름이 "func01"인 함수를 찾음, 함수 타입은()V jmethodID metID = (*env)->GetMethodID(env, cls, "func01", "()V"); if (funcM == 0) { printf("Can't find func01!\n"): } else { printf("Find func01!\n"); (*env)->CallVoidMethod(env, obj, metID ); ..

JNI/네이티브 변수 타입 비교 표

JNI/네이티브 변수 타입 비교 표 android-ndk-/platforms/android-/arch-arm/usr/include/jni.h 파일 참고 자바 네이티브 타입 Type Signature 설명 boolean jboolean Z unsigned 8 bits byte jbyte B signed 8 bits char jchar C unsigned 16 bits short jshort S signed 16 bits int jint I signed 32 bits long jlong J signed 64 bits float jfloat F 32 bits double jdouble D 64 bits void void V Object jobject L; String jstring Ljava/lang/Stri..

버튼 눌렸을 때 이미지 변경하기(Selector)

버튼 눌렸을 때 이미지 변경하기(Selector)1. 평상시 보여질 버튼 이미지와 눌렸을 경우 보여질 버튼 이미지를 drawable 폴더에 복사한다. 평상시 : arrow_left_normal.png 눌릴경우 : arrow_left_clicked.png 2. button_selector.xml파일을 아래와 같이 만들어 drawable 폴더에 저장한다. 3. 위에서 작성한 xml파일을 버튼의 배경이미지로 불러서 사용한다.

NDK 에서 로그 출력

NDK 에서 로그 출력 1. 우선 Android.mk에 아래 코드를 추가한다.LOCAL_LDLIBS := -llog 2. 소스 코드에 log.h 파일을 포함해준다.#include 3. 로그코드를 작성한다.__android_log_print(ANDROID_LOG_DEBUG, "TAG", "DEBUG STRING"); * 로그 출력 함수들 __android_log_write 간단한 문자열 출력 __android_log_print printf 처럼 사용 __android_log_vprint va_list를 사용할 수 있음 __androidlog_assert assert와 같음. 디버깅할 때 사용 * __android_log_print 사용시 지정 가능한 로그 유형 ANDROID_LOG_UNKNOWN ANDRO..

System.getProperty()

System.getProperty()System.getProperty() 함수의 인자에 아래 Key를 입력하면 해당하는 문자열을 결과로 얻을 수 있다.KeyMeaning"file.separator"Character that separates components of a file path. This is "/" on UNIX and "\" on Windows."java.class.path"Path used to find directories and JAR archives containing class files. Elements of the class path are separated by a platform-specific character specified in thepath.separator prop..