0

I'm currently developing an android app, that converts normal gif-files to videos. But after some research I didn't find any good examples or hints. I've seen some existing apps, that have that functionality, so I'm sure there is a way, but in my opinion the most apps are inconsistent and buggy. Does anyone have an example, how it's done?

Regards Marc

1 Answer 1

1
class ACT_GIF_MOV extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setView(); } void setView() { InputStream stream = null; try { stream = getAssets().open("animation.gif"); } catch (IOException e) { e.printStackTrace(); } GifMovieView view = new GifMovieView(this, stream); setContentView(view); } class GifMovieView extends View { private Movie mMovie; InputStream mStream; long mMoviestart=0; public GifMovieView(Context context, InputStream stream) { super(context); mStream = stream; mMovie = Movie.decodeStream(mStream); } @Override protected void onDraw(Canvas canvas) { canvas.drawColor(Color.TRANSPARENT); super.onDraw(canvas); final long now = SystemClock.uptimeMillis(); if (mMoviestart == 0) { mMoviestart = now; } final int relTime = (int)((now - mMoviestart) % mMovie.duration()); mMovie.setTime(relTime); mMovie.draw(canvas, 10, 10); this.invalidate(); } } } 
Sign up to request clarification or add additional context in comments.

1 Comment

Hi @Eu.Dr. Tanks for the tipp. I already implemented that, but how can I save the Movie object in the internal storage?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.