【问题标题】:How to speed up image viewing with android "Cooliris" gallery?如何使用 android “Cooliris” 库加快图像查看速度?
【发布时间】:2011-07-18 02:27:05
【问题描述】:

我在 Nexus S 上运行 2.3(但针对 2.2 编写代码),并且图像需要很长时间才能显示在默认的 cooliris 库中。这就是我尝试显示图像的方式:

Uri imageIdentifier = getImageUriOnFilesystem();
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(imageIdentifier, "image/jpeg");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Activity.this.startActivity(intent);

最后,画廊从黑屏到显示我的图像需要 5 到 10 秒,这太长了,让我觉得我做错了什么。有没有更好的方法可以在不需要安装其他图库的情况下在图库中显示图像?

【问题讨论】:

  • 显然问题是由于没有为图像编制索引,因此cooliris 库在启动时在渲染之前进行了完整的媒体扫描。 (对不起,我无法将此添加为答案,没有足够的代表或其他东西。)

标签: android android-gallery cooliris


【解决方案1】:

您可以在获取新图像时将它们添加到媒体索引中,这可能会减少图库应用程序的启动时间。

Intent i = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
i.setData(imageIdentifier));
sendBroadcast(i);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-03
    • 1970-01-01
    • 1970-01-01
    • 2015-09-07
    • 2016-11-20
    • 2015-01-09
    相关资源
    最近更新 更多