Posts

Showing posts from November, 2025

Save ListView as Pdf file

Image
1. On the page containing the ListView listview1 , Button savePdf , and an EditText edittext1 (This is for entering the file name). 2. Create a String variable filename . 3. In Activity, add Import event and add following imports: import java.nio.charset.StandardCharsets; import android.content.ContentValues; import android.content.Context; import android.net.Uri; import android.os.Build; import android.os.Environment; import android.provider.MediaStore; import android.widget.Toast; import android.graphics.pdf.PdfDocument; import java.io.IOException; import java.io.OutputStream; 4. Create a more block savePdfToDownloads [PdfDocument document][String filename] Here PdfDocument is a custom parameter. To add it, More Block -- Custom Parameter -- parameter: m.PdfDocument , variable: document . Put following codes in this more block: Uri pdfUri = null; OutputStream outputStream = null; try { ContentValues contentValues = new ContentValues(); contentVa...