Italian Stampare una List (ListView)

RobyLaga

Member
Licensed User
Buongiorno,
sono un "praticone" (Hobbista, hobby, passatempo), vorrei sapere se è possibile trovare il codice (anche a pagamento) per poter stampare una List generata da un file in una cartella del Cellulare.
Non so se sono chiaro.
 

Attachments

  • PreLista01.bas
    39.7 KB · Views: 259

Star-Dust

Expert
Licensed User
Longtime User
Non sei chiaro abbastanza, cos'è un praticone?

Stampare si intende in una stampante .
Hai un file di testo in una cartella del dispositivo e la vuoi inviare alla stampante?
 

Star-Dust

Expert
Licensed User
Longtime User
Ma la lista è una ListView o è in un file?

La devi stampare.o condividere con Whatsapp?
 

Star-Dust

Expert
Licensed User
Longtime User
Se devi condividere con WhatsApp usa la.libreria Social Share

Tieni conto che con Android 6 devi prendere accorgimenti per condividere un file fra app. File nelle cartelle interne non si possono condividere e la root principale non è più accessibile
 
Last edited:

RobyLaga

Member
Licensed User
Ma la lista è una ListView o è in un file?

La devi stampare.o condividere con Whatsapp?


Eccomi,
allora, da un file esterno(residente sulla memoria del cellulare) genero una ListView (Private ListViewArt33 As ListView) che la vedo con una Type ListViewData33(FirstRow33 As String, SecondRow33 As String) questa lista, genera delle righe di "prodotti" che ho precedentemente inserito, per intendersi, tipo un preventivo da mandare ad un cliente, e fin qui ok!, una volta completata e quindi pronta per essere spedita,
vorrei spedirla per email, oppure generare un PDF(per poi spedirlo manualmente ma è un'operazione più lenta), oppure mandarla per WhatApp ...

 

RobyLaga

Member
Licensed User
Sono talmente ignorante che non saprei come implementarlo .... nel mio codice

Using an Email object you can create an intent that holds a complete email message.
You can then launch the email application by calling StartActivity. Note that the email will not be sent automatically. The user will need to press on the send button.
Example:
Dim Message As Email
Message.To.Add("[email protected]")
Message.Attachments.Add(File.Combine(File.DirRootExternal, "SomeFile.txt"))
StartActivity(Message.GetIntent)

qui d'accordo, il file SomeFile.txt lo mando con una e-mail ... però io devo mandare "porzioni" di FILE ... non il file completo,
in quel file, ho voci che non posso spedire .... tutte insieme...
 

Star-Dust

Expert
Licensed User
Longtime User
Ho letto un pò il tuo codice, è una gran confusione..... comunque ecco come puoi mandare un email

B4X:
Dim Testo as String=CreaText(File.ReadList(File.DirRootExternal, "VideoCam12/ListResults10.txt"))
    Dim Testo As String= "Ciao"
    Dim em As Email

    em.Subject="LISTA"
    em.Body=Testo
    em.To.Add("[email protected]")
    StartActivity(em.GetIntent)

La sub CreaText, serve a caricare il file e trasformarlo in un testo simile ala listView:
B4X:
Sub CreaText(Lista As List) As String
    Dim Txt As String =""

    For i = 0 To 999
        'creo un mini array con tutte le parti della riga esaminata
        Dim stringArray() As String = Regex.Split("\|",Lista.get(i))
       
        Txt=Txt & stringArray(11) & CRLF
        Txt=Txt & stringArray(0) & " - " & stringArray(2) & " - " & stringArray(4) & " : " & stringArray(16) & CRLF
        Txt=Txt & "_____________________________________________________" & CRLF
    Next
   
    Return Txt
End Sub
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Se devi mandare su WhatsApp fai cosi:
B4X:
Dim Testo as String=CreaText(File.ReadList(File.DirRootExternal, "VideoCam12/ListResults10.txt"))
Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW, $"https://api.whatsapp.com/send?text=${Testo}"$)
StartActivity(Intent1)

CreaText già te l'ho inserito nel post precedente. Adesso il lavoro è tutto tuo
 

RobyLaga

Member
Licensed User
Se devi mandare su WhatsApp fai cosi:
B4X:
Dim Testo as String=CreaText(File.ReadList(File.DirRootExternal, "VideoCam12/ListResults10.txt"))
Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW, $"https://api.whatsapp.com/send?text=${Testo}"$)
StartActivity(Intent1)

CreaText già te l'ho inserito nel post precedente. Adesso il lavoro è tutto tuo

ti ho mandato un acconto .... (accontino :) )
 

RobyLaga

Member
Licensed User
Ho letto un pò il tuo codice, è una gran confusione..... comunque ecco come puoi mandare un email

B4X:
Dim Testo as String=CreaText(File.ReadList(File.DirRootExternal, "VideoCam12/ListResults10.txt"))
    Dim Testo As String= "Ciao"
    Dim em As Email

    em.Subject="LISTA"
    em.Body=Testo
    em.To.Add("[email protected]")
    StartActivity(em.GetIntent)

La sub CreaText, serve a caricare il file e trasformarlo in un testo simile ala listView:
B4X:
Sub CreaText(Lista As List) As String
    Dim Txt As String =""

    For i = 0 To 999
        'creo un mini array con tutte le parti della riga esaminata
        Dim stringArray() As String = Regex.Split("\|",Lista.get(i))
      
        Txt=Txt & stringArray(11) & CRLF
        Txt=Txt & stringArray(0) & " - " & stringArray(2) & " - " & stringArray(4) & " : " & stringArray(16) & CRLF
        Txt=Txt & "_____________________________________________________" & CRLF
    Next
  
    Return Txt
End Sub

Se devi mandare su WhatsApp fai cosi:
B4X:
Dim Testo as String=CreaText(File.ReadList(File.DirRootExternal, "VideoCam12/ListResults10.txt"))
Dim Intent1 As Intent
Intent1.Initialize(Intent1.ACTION_VIEW, $"https://api.whatsapp.com/send?text=${Testo}"$)
StartActivity(Intent1)

CreaText già te l'ho inserito nel post precedente. Adesso il lavoro è tutto tuo


una gran confusione ? :-(
 

Star-Dust

Expert
Licensed User
Longtime User
E una sub che ti ho scritto sopra, la devi solo copiare nel tuo codice
 

RobyLaga

Member
Licensed User
upload_2019-3-14_17-38-59.png
 

Star-Dust

Expert
Licensed User
Longtime User
Copia questo sotto
B4X:
Sub CreaText(Lista As List) As String
    Dim Txt As String =""

    For i = 0 To 999
        'creo un mini array con tutte le parti della riga esaminata
        Dim stringArray() As String = Regex.Split("\|",Lista.get(i))
      
        Txt=Txt & stringArray(11) & CRLF
        Txt=Txt & stringArray(0) & " - " & stringArray(2) & " - " & stringArray(4) & " : " & stringArray(16) & CRLF
        Txt=Txt & "_____________________________________________________" & CRLF
    Next
  
    Return Txt
End Sub
 
Top