Show Mobile Navigation
Latest In

jueves, 9 de febrero de 2023

Nele - febrero 09, 2023
public void createPdf(View v) { PDDocument document = new PDDocument(); PDPage page = new PDPage(); document.addPage(page); PDFont font = PDType1Font.HELVETICA; PDPageContentStream contentStream; try { // Define a content stream for adding to the PDF contentStream = new PDPageContentStream(document, page); // Write Hello World in blue text contentStream.beginText(); contentStream.setNonStrokingColor(15, 38, 192); contentStream.setFont(font, 12); contentStream.newLineAtOffset(100, 700); contentStream.showText("Hello World"); contentStream.endText(); // Load in the images InputStream in = assetManager.open("falcon.jpg"); InputStream alpha = assetManager.open("trans.png"); // Draw a green rectangle contentStream.addRect(5, 500, 100, 100); contentStream.setNonStrokingColor(0, 255, 125); contentStream.fill(); // Draw the falcon base image PDImageXObject ximage = JPEGFactory.createFromStream(document, in); contentStream.drawImage(ximage, 20, 20); // Draw the red overlay image Bitmap alphaImage = BitmapFactory.decodeStream(alpha); PDImageXObject alphaXimage = LosslessFactory.createFromImage(document, alphaImage); contentStream.drawImage(alphaXimage, 20, 20 ); // Make sure that the content stream is closed: contentStream.close(); // Save the final pdf document to a file String path = root.getAbsolutePath() + "/Created.pdf"; document.save(path); document.close(); tv.setText("Successfully wrote PDF to " + path); } catch (IOException e) { Log.e("PdfBox-Android-Sample", "Exception thrown while creating PDF", e); } }

domingo, 29 de enero de 2023

Efecto puerta

Nele - enero 29, 2023

jueves, 12 de enero de 2023

Prueba

Nele - enero 12, 2023
import android.os.Bundle; import android.widget.Button; import androidx.appcompat.app.AppCompatActivity; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button1 = findViewById(R.id.button1); Button button2 = findViewById(R.id.button2); Button button3 = findViewById(R.id.button3); } }
Editor's Choice