2015-08-24 42 views

回答

0

我爲此實現了一個插件。這裏是一些代碼來獲取圖像路徑:

private static void processImageFromGallery(Intent intent) { 
    Uri selectedImage = intent.getData(); 
    String[] filePathColumn = { MediaStore.Images.Media.DATA }; 

    Cursor cursor = UnityPlayer.currentActivity.getContentResolver().query(selectedImage, filePathColumn, null, 
      null, null); 
    cursor.moveToFirst(); 

    int columnIndex = cursor.getColumnIndex(filePathColumn[0]); 
    String filePath = cursor.getString(columnIndex); 
    cursor.close(); 
} 
+0

這是爲奇巧?這不適用於kitkat版本。 :( –

+0

我不太確定,那是我之前實現的,最近還沒有測試過。也許這有助於:http://stackoverflow.com/questions/19834842/android-gallery-on-kitkat-returns-different -uri換意向行動得到內容 –