Android Question Webview data to text file

Rookie

Member
Licensed User
Longtime User
Webview data to text file

I use a webview to display filtered data from a table.How can I get that same data saved to a text file or sms message body?
Managed to get a single record but not with multiple records.

B4X:
Code:
Sub ShowTableTrip
    Private Query As String
 
    Query = "SELECT  Passenger.Name AS Passenger,Destination.Name AS Destination, date(Trip.Date / 1000, 'unixepoch') AS Date, Trip.Amount as Payment "
    Query = Query & " FROM Trip, Passenger, Destination"
    Query = Query & " WHERE Passenger.rowID = Trip.PassengerID AND Destination.rowID = Trip.DestinationID "
 
    If Starter.FilterActive = True Then
        Query = Query & Starter.FilterQuery
    End If
    wbvTable.LoadHtml(Utils.ExecuteHtml(Starter.SQL1, Query, Null, 0, True))
 
    ReadDataBaseIDs
End Sub



'Reads the table rowIDs in the IDList for each table
Sub ReadDataBaseIDs
    Private Row As Int
 
 
    Starter.TripIDList.Initialize        'initialize the ID list
    'We read only the ID column and put them in a List
    Cursor1 = Starter.SQL1.ExecQuery("SELECT rowID FROM Trip")
 
    If Cursor1.RowCount > 0 Then                                'check if entries exist
        Starter.TripIDList.Initialize                        'initialize the ID list
        For Row = 0 To Cursor1.RowCount - 1
            Cursor1.Position = Row                                    'set the Cursor to each row
            Starter.TripIDList.Add(Cursor1.GetLong2(0))        'add the ID's to the ID list
        Next
    Else
        ToastMessageShow("No items found", False)
    End If

    Starter.PassengerIDList.Initialize        'initialize the ID list
    Cursor1 = Starter.SQL1.ExecQuery("SELECT rowID FROM Passenger")
    If Cursor1.RowCount > 0 Then                                'check if entries exist
        Starter.PassengerIDList.Initialize                        'initialize the ID list
        For Row = 0 To Cursor1.RowCount - 1
            Cursor1.Position = Row                                    'set the Cursor to each row
            Starter.PassengerIDList.Add(Cursor1.GetLong2(0))        'add the ID's to the ID list
        Next
    Else
        ToastMessageShow("No items found", False)
    End If
 
    Starter.DestinationIDList.Initialize        'initialize the ID list
    Cursor1 = Starter.SQL1.ExecQuery("SELECT rowID FROM Destination")
    If Cursor1.RowCount > 0 Then                                'check if entries exist
        Starter.DestinationIDList.Initialize                        'initialize the ID list
        For Row = 0 To Cursor1.RowCount - 1
            Cursor1.Position = Row                                    'set the Cursor to each row
            Starter.DestinationIDList.Add(Cursor1.GetLong2(0))        'add the ID's to the ID list
        Next
    Else
        ToastMessageShow("No items found", False)
    End If
 
    Cursor1.Close                                            'close the cursor, we don't need it anymore
End Sub

'Routine from the DBUtils demo program, equivalent to the Click event
Sub wbvTable_OverrideUrl (Url As String) As Boolean
    'parse the row and column numbers from the URL
    Private values() As String
    values = Regex.Split("[.]", Url.SubString(7))
    Private  Row As Int
    Row = values(1)
    Starter.SelectedTripID = Starter.TripIDList.Get(Row)
    Starter.smsTable = Starter.TripIDList
    UpdateSelectedItem

    Return True 'Don't try to navigate to this URL
End Sub
 

Rookie

Member
Licensed User
Longtime User
Receiving the data from DBUtils.ExecuteHtml but it shows the webview layout in the message box.
Please assist to receive the data only.
 

Attachments

  • upload_2019-1-29_9-24-37.png
    upload_2019-1-29_9-24-37.png
    162.4 KB · Views: 160
Upvote 0
Top