I developed an activity where load a gif. In my Galaxy S III mini the gif load normaly, but in moto x... =(
The error occurs in line: movie.draw(canvas, 0, 0);
My class Gif extends from View
The code is:
protected void onDraw(Canvas canvas) {
float escala = getEscala(canvas);
setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int)(movie.height()*escala)));
canvas.scale(escala,escala);
canvas.drawColor(Color.TRANSPARENT);
super.onDraw(canvas);
long horaAtual = android.os.SystemClock.uptimeMillis();
if (movieStart == 0) {
movieStart = horaAtual;
}
if (movie != null) {
int sequencia = (int) ((horaAtual - movieStart) % movie.duration());
movie.setTime(sequencia);
movie.draw(canvas, 0, 0);
this.invalidate();
}
}
private void initializeView() {
if (inputStreamGif == null) {
inputStreamGif = getContext().getResources().openRawResource(+R.drawable.carregando);
}
movie = Movie.decodeStream(inputStreamGif);
movieStart = 0;
this.invalidate();
}
Layout element:
<view.elements.Gif
android:id="@+id/ivExercicio"
android:minHeight="900dp"
android:tag="carregando"
android:contentDescription="@string/contentDescription"
android:layout_gravity="center"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
The error:
E/Adreno-ES20﹕ <check_framebuffer_attachment:854>: Invalid texture format! Returning error!
E/Adreno-ES20﹕ <check_framebuffer_object_status:1237>: Framebuffer color attachment incomplete. Returning GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT!
E/Adreno-ES20﹕ <check_framebuffer_attachment:854>: Invalid texture format! Returning error!
E/Adreno-ES20﹕ <check_framebuffer_object_status:1237>: Framebuffer color attachment incomplete. Returning GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT!