我正在通过创建一个应用程序来练习我的Android技能,该应用程序只是创建SD卡上文件的主屏幕快捷方式,允许Android使用默认应用程序打开它们。
一切都很好并且正常工作,但是当我创建图像的快捷方式时,会发生以下情况
我还应该注意到,当通过另一个文件管理器打开文件时,图库不会显示任何这些祝酒词,但它在显示高分辨率之前确实显示了低缓冲的图像半秒。另请注意,这种行为在几个文件\类型中很明显(无论如何都尝试了jpegs和png)。
这是我对快捷方式本身的意图(路径显然是路径+文件名的字符串):
Intent shortcutIntent = new Intent ();
shortcutIntent.setAction(android.content.Intent.ACTION_VIEW);
File file = new File(path);
Uri uri = Uri.fromFile(file);
MimeTypeMap map = MimeTypeMap.getSingleton();
String mime = map.getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(uri.toString().toLowerCase()));
shortcutIntent.setDataAndType(uri, mime);
打开快捷方式LogCat告诉我:
03-08 19:34:16.431: INFO/ActivityManager(167): Starting: Intent { act=android.intent.action.VIEW dat=file:///sdcard/download/TIMETABLE.png typ=image/png flg=0x14000000 cmp=com.cooliris.media/.Gallery bnds=[15,159][144,269] } from pid 262
03-08 19:34:16.480: INFO/Gallery(1440): onDestroy
03-08 19:34:16.511: INFO/Gallery(1440): onCreate
03-08 19:34:16.621: DEBUG/CacheService(1440): Refreshing Cache for all items
03-08 19:34:16.621: INFO/CacheService(1440): Refreshing cache.
03-08 19:34:16.721: INFO/CacheService(1440): Building albums.
03-08 19:34:16.791: INFO/RenderView(1440): First Draw
03-08 19:34:16.831: INFO/CacheService(1440): Done building albums.
03-08 19:34:16.831: INFO/CacheService(1440): Building items.
03-08 19:34:16.971: INFO/ActivityManager(167): Displayed com.cooliris.media/.Gallery: +498ms
03-08 19:34:17.001: INFO/CacheService(1440): Done building items.
03-08 19:34:17.011: INFO/MediaFeed(1440): Replacing media set 310386146
03-08 19:34:17.011: INFO/MediaFeed(1440): Replacing media set 1506676782
03-08 19:34:17.011: INFO/MediaFeed(1440): Replacing media set -1928128949
03-08 19:34:17.171: DEBUG/dalvikvm(167): GC_EXPLICIT freed 690K, 41% free 5902K/9991K, external 1612K/2124K, paused 109ms
03-08 19:34:17.361: DEBUG/dalvikvm(1083): GC_EXPLICIT freed 175K, 52% free 2678K/5575K, external 0K/0K, paused 35ms
03-08 19:34:18.521: DEBUG/AlarmManagerService(167): Kernel timezone updated to -660 minutes west of GMT
03-08 19:34:18.531: DEBUG/SystemClock(275): Setting time of day to sec=1299573259
03-08 19:34:26.127: ERROR/(1440): Not JPEG: /sdcard/download/TIMETABLE.png
03-08 19:34:26.138: DEBUG/CacheService(1440): Refreshing Cache for all items
03-08 19:34:26.138: INFO/CacheService(1440): Refreshing cache.
03-08 19:34:26.197: INFO/CacheService(1440): Building albums.
03-08 19:34:26.258: INFO/CacheService(1440): Done building albums.
03-08 19:34:26.258: INFO/CacheService(1440): Building items.
03-08 19:34:26.348: INFO/CacheService(1440): Done building items.
03-08 19:34:26.348: DEBUG/CacheService(1440): No items found for album
03-08 19:34:26.348: INFO/GridLayer(1440): Slot changing from -1 to -1
03-08 19:34:26.358: INFO/RenderView(1440): Texture creation fail, glError 1281
03-08 19:34:26.388: WARN/MediaProvider(1083): original media doesn't exist or it's canceled.
03-08 19:34:26.388: INFO/CacheService(1440): Built thumbnail and screennail for 0 in 33
除了没有
之外,jpegs的快捷方式也是如此ERROR/(1440): Not JPEG: /sdcard/download/TIMETABLE.png
线。奇怪的是,这个错误仍然存在,但画廊可以并将打开pngs。
其他一切似乎都很好(例如pdf,音频,视频,文档等等)。
无论如何,任何帮助都会非常有帮助,
干杯, 萨姆
答案 0 :(得分:2)
问题解决了!
未来参考,需要指向 MNT / SD卡/ ... 不 / SD卡/...
奇怪的是,它仍然有效,但画廊感到困惑。