Android Question [Closed] Content Chooser Greyed out text.

Roger Daley

Well-Known Member
Licensed User
Longtime User
Hi All

I am exporting a SQLite as CSV to external memory. Using Content Chooser for saving to SDCard all existing files are greyed out, including the existing CSV files.
Is there an option to have the CSV files shown as valid when choosing where to save?


Regards Roger
 

Roger Daley

Well-Known Member
Licensed User
Longtime User
I think I may be using the wrong terms causing confusion.
I'm attempting to use the TextEditor code as a template/framework to transfer different types of files between internal and external memory.
PNG working OK both ways, CSV internal to external OK. [Too busy to finish.]
Both have the issue of showing all existing files greyed out and not responsive.
When the TextEditor is ready to save, the list of existing files are greyed except for text files. Text file names are the normal black and are responsive. IE Tap on one and name of the file to be saved is changed.
How do I get other file types to conform with text files at the point of saving?

Regards Roger
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
Erel

Said Code below.

B4X:
'Exporting data to CSV file.
Sub BtnExpSiteList_Click
    'Creates a CSV file in DirInternal from SQLite DB   
    Private listosites As List
    Private ExportFile As StringUtils
    
    If File.Exists(File.Dirinternal&"/ABT/", "") = False Then File.MakeDir(File.Dirinternal&"/ABT/", "")
    If File.Exists(File.Dirinternal&"/ABT/", "expsitelist.csv") Then File.Delete(File.Dirinternal&"/ABT/", "expsitelist.csv")
    
    'Create List from SQL1
    listosites = DBUtils.ExecuteMemoryTable(SQL1, "SELECT * FROM sites", Null, 0)
    If listosites.Size > 0 Then       
        ExportFile.SaveCSV(File.Dirinternal&"/ABT/", "expsitelist.csv", ",", listosites)
        CSVpexport_click
    Else
        toast.Show("No sites in list.  No export.")
        Return   
    End If   
End Sub

Sub CSVpexport_click
    'Converts CSV file to Byte array and streams to SDCard
    
    Private b2() As Byte = File.ReadBytes(File.Dirinternal&"/ABT/", "expsitelist.csv")
    Private input As InputStream
    toast.Initialize(pnlABDispLatLng)
    toast.VerticalCenterPercentage = 18
    toast.DurationMs = 2000
    
    input.InitializeFromBytesArray(b2, 0, b2.Length)
    Wait For (FileHandler1.SaveAs(input, "text/csv", "SQL.csv")) Complete (success As Boolean)
    
    If success Then
        toast.Show("Data exported successfully")
    Else
        toast.Show("Data not exported")
    End If
    kb.HideKeyboard
End Sub

Regards Roger
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
Erel,


CSV:
Tried multiple MIMEs, all hightlight the related files including image/png.
*/* highlights all files
text/* highights html, txt and csv files.
*/csv did not work.
text/csv highlights nothing.

PNG:
A similar Sub to save png files [ie Screen shots] has much the same issue. The MIME image/png does not cause png files to be highlighted but changing the MIME to text/csv highlights the csv files.

Regards Roger
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…