Ich habe eine Textansicht, die zur Ausführungszeit aktualisiert werden muss. Dieser Textansicht durch die folgende XML definiert ist:Android-Textansicht nicht während der Ausführungszeit gefunden
<TextView
android:id="@+id/agi_val"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
Im Aktivitätscode, acces i zu diesem (und anderen Textviews) wie folgt aus:
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");
}
}
Und dann, in 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
}
}
die Sache ist, dass die „agi_val“ Textview gefunden wird, aber die AGI Textview der Tätigkeit, dass ich vorher gerettet hatte, kann es nicht die Ressource „agi_val“, deren acces verlinkt sind. Das Fehlerprotokoll ist das folgende:
///< This first line shows the value of the "agi_val" ID. As you can see, it's not null.
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)
///< This line is the assigment of the text
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)
Jemand weiß, was zur Hölle geschieht? Ich habe zwei Tage versucht, das zu lösen, und ich weiß nicht, wie (ich habe im Internet gesucht, aber ich kann etwas ähnliches nicht finden).
Wenn jemand nach der R-Klassen-ID fragt, entspricht dies der Anzeige in der ersten Zeile des Protokolls.
versuchen ** sauber ** und ** ** Wiederaufbau Projekt –
Ich habe das fast zehnmal getan –