Android Question Open as / Open with...

GMan

Well-Known Member
Licensed User
Longtime User
In some Apps i see this kind of "function":
i.e. if i click on a file in a databrowser i can then select (in a new little window called OPEN AS) with choices like TEXT, IMAGE, EXPLORER etc etc.
When i have selected one, a new window with depending apps, which are installed on my device, is opened).

Is this an internal function or are that handmade screens ?

BEST of all: is there a customizable lib ?
 

GMan

Well-Known Member
Licensed User
Longtime User
Sure...here a sample with an Audio File.
In the 1st screen i click AUDIO, in the next one one of my installed apps for that type of file.




If done with the TEXT choice, some installed Editors will be presented
 
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
Thx, i will give it a try.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
The first screen is a custom dialog specific to this app. The second screen is the standard intent chooser dialog that appears when you send an intent. You can force it to show by calling Intent.WrapAsIntentChooser.


I do not find a way to open a file based on its extension and even to list the apps that are able to open "that" file.

I have initialized the Intent like this:

i.Initialize (i.ACTION_VIEW, "file://" & FullFilename)
FullFilename contains the path and file name.

I have tried using WrapAsIntentChooser but without success.

Must I set the "setType" of the Intent after a "Select Case Extension"?
 
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
with the ContenChooser it works this way:
B4X:
    Dim CC As ContentChooser
    CC.Initialize("CC")   
    CC.Show("text/*", "Choose Text")
'    CC.Show("image/*", "Choose image")
'    CC.Show("audio/*", "Choose audio file")
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User


I'm afraid of having to use something like:

B4X:
Select Case Extension
  Case "jpg", "png"...
      i.SetType...
  Case "txt", "doc"...
      i.SetType...
  Case "3gp", "mp4"...
      i.SetType...
End Select
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…