64804

How open default gallery app

Question:

I know it is asked before and I have tried:

Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("video/*, images/*"); startActivity(intent);

But in my Samsung S2 it opens the gallery in selection mode (if I click an item it closes the gallery app). I just wish to open the gallery in normal mode so I can click images and videos and watch them and that is it!

I wasted too much hours for this.... Please help me!

Answer1:

Use

Intent intent = new Intent(Intent.ACTION_VIEW);

<strong>Reason</strong>

<blockquote>

Activity Action: Display the data to the user. This is the most common action performed on data -- it is the generic action you can use on a piece of data to get the most reasonable thing to occur. For example, when used on a contacts entry it will view the entry; when used on a mailto: URI it will bring up a compose window filled with the information supplied by the URI; when used with a tel: URI it will invoke the dialer.

Output: nothing.

</blockquote>

Answer2:

<blockquote>

I just wish to open the gallery in normal mode so I can click images and videos and watch them and that is it!

</blockquote>

There are countless "gallery" apps, both pre-installed on devices and available for download from the Play Store. There is no requirement for any of them to expose some specific Intent to show "normal mode", even assuming that the app has something that would correspond to "normal mode".

In other words, there is no reliable way to do what you seek.

Answer3:

This works for me:

Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/*"); startActivity(intent);

Also check this link:

<a href="http://indyvision.net/2010/03/android-using-intents-open-files/" rel="nofollow">Using Intents to Open Files</a>

Answer4:

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

Font: <a href="https://stackoverflow.com/a/6016311/2652124" rel="nofollow">https://stackoverflow.com/a/6016311/2652124</a>

Recommend

  • How do you import pygame libraries into Eclipse's pydev?
  • unable to import library project in android studio
  • svg-android imageview not working
  • Angularjs hide and show according to screen size responsive
  • EditText is covered by Keyboard
  • PHP multiple file uploads
  • Less Conflicting Session Manager for Zope 2
  • Better Indy for Dephi 2007
  • Cannot save model when using ember render helper
  • VBA Excel, loop through variables
  • Android cannot disable cut copy paste
  • Bootstrap (v3.3.4) glyphicons not displayed in IE when refresh page (F5)
  • Clear fused location provider's location for testing
  • Calculate time difference in hh:mm:ss with simple javascript/jquery
  • Trying to get the char code of ENTER key
  • URLConnection doesn't work since API 10 and higher?
  • Implementing “partial void” in VB
  • Using Sax parsing to edit and write XML in VB6
  • Sending HTML Form Data to Spring REST Web Service
  • Does Mobilefirst provide a provision to access web services directly?
  • Debug.DrawLine not showing in the GameView
  • Yii2: Config params vs. const/define
  • Unity3D & Android: Difference between “UnityMain” and “main” threads?
  • Installing Hadoop, Java Exception about illegal characters at index 7?
  • Illegal mix of collations for operation for date/time comparison
  • Different response to non-authenticated users and AJAX calls
  • ActionScript 2 vs ActionScript 3 performance
  • what is the difference between the asp.net mvc application and asp.net web application
  • To display the title for the current loaction in map in iphone
  • Traverse Array and Display in markup
  • How to set the response of a form post action to a iframe source?
  • embed rChart in Markdown
  • Authorize attributes not working in MVC 4
  • unknown Exception android
  • Busy indicator not showing up in wpf window [duplicate]
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF