Tengo un TextView que no se actualiza en tiempo de ejecución. Dicho TextView está definido por el siguiente codigo en XML:
<TextView
android:id="@+id/agi_val"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
En el código de la actividad, accedo al TextView de esta forma:
private TextView AGI;
///< Some stuff
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_abf__char_gen__basic_info);
abfToolsSaveData = (ABFToolsSaveData) getIntent().getParcelableExtra("SaveDataClass");
this.AGI = (TextView) findViewById(R.id.agi_val);
///< Some stuff
if (abfToolsSaveData != null) {
this.chargeData(true);
} else {
Log.d("INFO", "abfToolsSaveData is null");
}
}
Y en chargeData(boolean):
public void chargeData(boolean firstTime){
if(firstTime){
MainCharacteristics mc = abfToolsSaveData.getCharacter().getMainCharacteristics(); ///< We get the main characteristics, auto-generated the first time
/**
* Set the Text Views with the default value
*/
if(AGI != null){ ///< I've done this to check if the text view is null or not
Log.d("INFO", String.valueOf(AGI));
AGI.setText(mc.getAGI());
}
else
Log.d("INFO","AGI IS NULL");
///< Some stuff
}
}
La cosa es que "agi_val" lo encuentra, pero el TextView AGI de la actividad, no puede accerder al recurso agi_val. El log del error es el siguiente:
///< Esta primera linea es mi salida por pantalla que demuestra que AGI tiene acceso a agi_val:
09-20 10:07:32.344 1266-1266/com.noeselmastersonlosdados.sliferdragon.penandpapercompanion D/INFO: android.support.v7.widget.AppCompatTextView{b670993 V.ED.... ......ID 0,0-0,0 #7f0d0077 app:id/agi_val}
09-20 10:07:32.344 1266-1266/com.noeselmastersonlosdados.sliferdragon.penandpapercompanion W/ResourceType: No package identifier when getting value for resource number 0x00000009
--------- beginning of crash
09-20 10:07:32.347 1266-1266/com.noeselmastersonlosdados.sliferdragon.penandpapercompanion E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.noeselmastersonlosdados.sliferdragon.penandpapercompanion, PID: 1266
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.noeselmastersonlosdados.sliferdragon.penandpapercompanion/com.noeselmastersonlosdados.sliferdragon.penandpapercompanion.ABF_CharGen_BasicInfo}: android.content.res.Resources$NotFoundException: String resource ID #0x9
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x9
at android.content.res.Resources.getText(Resources.java:299)
at android.widget.TextView.setText(TextView.java:4132)
///< Esta linea referencia a la asignación del texto
at com.noeselmastersonlosdados.sliferdragon.penandpapercompanion.ABF_CharGen_BasicInfo.chargeData(ABF_CharGen_BasicInfo.java:73)
at com.noeselmastersonlosdados.sliferdragon.penandpapercompanion.ABF_CharGen_BasicInfo.onCreate(ABF_CharGen_BasicInfo.java:54)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Alguien sabe que esta sucediendo? He probado a hacer un Clean y Rebuild, a reiniciar el programa, y muchas otras cosas que he encontrado por internet, pero nada me da la solución al problema.