私のアプリは、標準の .PNG と下位互換性のあるカスタム .PNG ファイルを作成しましたが、私のアプリが特別な .PNG を (デフォルトのギャラリーではなく) 認識できるようにしたいと考えています。画像を作成した後、カスタム MIME タイプで登録しようとしましたが、まだ通常の PNG としてスキャンされています。
File file = new File("/mnt/sdcard/custom.png");
//now scan the file into the content database
MediaScannerConnection.scanFile(this,
new String[] { file.toString() }, new String[] { "image/x-custom" },
new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
Log.i("ExternalStorage", "Scanned " + path + ":");
Log.i("ExternalStorage", "-> uri=" + uri);
ContentResolver cr = getContentResolver();
String mime = cr.getType(uri);
//mime returns image/png, not image/x-custom :(
}
Android にカスタム MIME タイプを認識させたり、アプリに拡張 .PNG を認識させたりする方法についてのアイデアはありますか?