Skip to content

Do you know how can I convert ParticleTextView object into GIF? #11

@keval-gangani

Description

@keval-gangani

Hi Yasic,

I have been tried below logic on button click event to generate GIF from ParticleTextView object but it saves file as Jpeg. Please review below image and background coming in black color.

Can you please give some hint to save ParticleTextView object into GIF? It would be very helpful.

public void onClick(View view) {
particleTextView1.buildDrawingCache();
Bitmap image=particleTextView1.getDrawingCache();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
AnimatedGifEncoder encoder = new AnimatedGifEncoder();
encoder.start(bos);
encoder.addFrame(image);
encoder.finish();
byte[] array = bos.toByteArray();
//File output = new File( "abc.gif");
File path = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
File file = new File(path,"DemoPicture.gif");
path.mkdirs();
try (FileOutputStream fos = new FileOutputStream(file.getPath())) {
fos.write(array);
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

particletext

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions