When i had more than one SurfaceView you are right it was not working good. However this is not the case here. I have one SurfaceView and a canvas The drawing to the canvas are working perfectly with Bitmaps and one animated gif. When I add the second agif looks like the Movie.DecodeStream(is) is not working.....
Maybe the problem is more clear now. On Jun 22, 10:04 pm, Anm <[email protected]> wrote: > Generally, anything with more than one Surface view is apt to break. > I've seen this issue with camera previews and media players in the > same layout > > I don't think it was architected to share the render buffer. > > On Jun 21, 2:03 am, AndroidDev1 <[email protected]> wrote: > > > > > > > > > Hi, > > I am using a SurfaceView and a Thread to draw animated gif on a canvas > > and its working perfectly. > > Once I try to draw my second animated gif, I'm getting 2 animated > > gifs > > with the last animinated gif aniation. > > like my second Movie.DecodeStream(is) override the first Movie. > > > The result of the code below is 2 animated gif with movie2 animation > > Please advise what can be the problem. > > Thanks in advance > > > code: > > > Thread constructor: > > InputStream is > > is = mRes.openRawResource(R.drawable.animated_gif1); > > Movie movie1 = Movie.decodeStream(is); > > try { > > is.close(); > > } catch (java.io.IOException e) { > > /* do nothing. > > If the exception happened on open, moov will > > be null. > > If it happened on close, moov is still valid. > > */ > > } > > > is = mRes.openRawResource(R.drawable.animated_gif2); > > Movie movie2 = Movie.decodeStream(is); > > try { > > is.close(); > > } catch (java.io.IOException e) { > > /* do nothing. > > If the exception happened on open, moov will > > be null. > > If it happened on close, moov is still valid. > > */ > > } > > .... > > .... > > .... > > > doDraw(Canvas c) { > > .... > > > long now = android.os.SystemClock.uptimeMillis(); > > if (mMovieStart == 0) { // first time > > mMovieStart = now; > > } > > > int dur = movie1.duration(); > > if (dur == 0) > > dur = 1000; > > > int relTime = (int)((now - mMovieStart) % dur); > > movie1.setTime(relTime); > > movie1.draw(canvas, 100, 100); > > > int dur = movie2.duration(); > > if (dur == 0) > > dur = 1000; > > > relTime = (int)((now - mMovieStart) % dur); > > movie2.setTime(relTime); > > movie2.draw(canvas, 100, 100); -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

