Crash setTextViewTextSize en un widget solo sin Jelly Bean

I am making a widget in which you can specify the text size

controles.setTextViewTextSize(, TypedValue.COMPLEX_UNIT_SP, textSize);

I am working with android 4.1

android:minSdkVersion="8" android:targetSdkVersion="16"

The problem is that it works correctly in android 4.1, but in any other version (ICS, gingerbread, etc) shows a forced close.

java.lang.NoSuchMethodError: android.widget.RemoteViews.setTextViewTextSize

If I remove the line of code where it is used "setTextViewTextSize", the application works perfectly.

I find no information about the reason for this error.

Agradezco cualquier ayuda.


preguntado el 28 de agosto de 12 a las 12:08

3 Respuestas

if you wish to use something that works on all versions, use this:


contestado el 19 de mayo de 13 a las 00:05

Respondido 28 ago 12, 12:08

and what is the method that I can use in earlier versions of android? thanks - Sergio76

hice esto

   remoteViews.setTextViewTextSize(, TypedValue.COMPLEX_UNIT_PX, 100f);

Respondido el 27 de enero de 16 a las 22:01

this solutions works but don't forget that last param is float - so we must use f at the end, it will be like: remoteViews.setTextViewTextSize(, TypedValue.COMPLEX_UNIT_PX, 100f); - Choletski

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.