본문 바로가기

[Android] 현재 마운트된 SD카드 리스트 public String[] getExternalStorageDirectories() { List results = new ArrayList(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { //Method 1 for KitKat & above File[] externalDirs = getExternalFilesDirs(null); for (File file : externalDirs) { String path = file.getPath().split("/Android")[0]; boolean addPath = false; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { addPath.. 더보기
[Android] uri 패스로 내부저장소 절대경로 찾기. public String getPath(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; // DocumentProvider if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { // ExternalStorageProvider if (isExternalStorageDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final St.. 더보기
[MYSQL] MYSQL 서버에 추가될 INDEX 값 가져오기 $query = "SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = '{Database name}' AND TABLE_NAME = '{Table name}'";$result = mysql_query($query);$tableIdx = mysql_fetch_array($result);$idx = $tableIdx[AUTO_INCREMENT];?>last_insert_id() 나 mysql_insert_id() 의 경우에는 insert 를 하고난 다음에 그 쿼리에 대한 index를 가져온다.그렇기 때문에 INSERT 해야할 시점에 해당 쿼리에 대한 INDEX값을 사용 해야 하는 경우에는 부적합하다. ex ) 댓글, 게시판.위와.. 더보기

반응형