【问题标题】:Android open gallery app安卓开放图库应用
【发布时间】:2013-10-17 20:14:29
【问题描述】:

我有一个按钮可以打开 android 图库应用。我用代码

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(
 "content://media/internal/images/media")); 
 startActivity(intent); 

对于 Android>=2.3 可在此处找到:Open Gallery App in Android

我的问题:当用户从我的应用程序打开图库并离开图库(主页按钮、共享图像等)时,该图库将在用户下次打开我的应用程序时显示(无需单击按钮)。

如何避免打开我的应用时在我的应用中显示图库?图库应该只在单击按钮时显示一次,但下次我的应用程序出现在前面时不会显示。

【问题讨论】:

    标签: android button gallery


    【解决方案1】:

    根据您的要求,您最好的选择是告诉 Android 不要将图库保存在您的任务历史记录中。这样,当他们离开 Gallery 活动时,它不会出现在任务的历史堆栈中。通过在你的意图上设置一个标志来做到这一点。

    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://media/internal/images/media")); 
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    startActivity(intent);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-07
      • 1970-01-01
      • 2011-09-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多