Error Caused by: android.content.res.Resources$NotFoundException: String resource

I have the following method :

private void displayTotalPlayers(){

numberOfPlayers = (TextView) findViewById(R.id.numberOfTotalPlayers);

numberOfPlayers.setText(R.string.totalPlayers + playerListGame.myPlayers.size());

}

and when I run this method I can the error:

E/AndroidRuntime: FATAL EXCEPTION: main

Process: com.example.android.footysortit, PID: 26205

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.footysortit/com.example.android.footysortit.ComposeMessage}: android.content.res.Resources$NotFoundException: String resource ID #0x7f0c0034

at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)

at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)

at android.app.ActivityThread.-wrap11(Unknown Source:0)

at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)

at android.os.Handler.dispatchMessage(Handler.java:106)

at android.os.Looper.loop(Looper.java:164)

at android.app.ActivityThread.main(ActivityThread.java:6494)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f0c0034

at android.content.res.Resources.getText(Resources.java:339)

at android.widget.TextView.setText(TextView.java:5496)

at com.example.android.footysortit.ComposeMessage$override.displayTotalPlayers(ComposeMessage.java:142)

at com.example.android.footysortit.ComposeMessage$override.finishedPlayersSet(ComposeMessage.java:135)

at com.example.android.footysortit.ComposeMessage$override.onCreate(ComposeMessage.java:40)

at com.example.android.footysortit.ComposeMessage$override.access$dispatch(Unknown Source:96)

at com.example.android.footysortit.ComposeMessage.onCreate(ComposeMessage.java:0)

at android.app.Activity.performCreate(Activity.java:7009)

at android.app.Activity.performCreate(Activity.java:7000)

at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)

at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)

at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 

at android.app.ActivityThread.-wrap11(Unknown Source:0) 

at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 

at android.os.Handler.dispatchMessage(Handler.java:106) 

at android.os.Looper.loop(Looper.java:164) 

at android.app.ActivityThread.main(ActivityThread.java:6494) 

at java.lang.reflect.Method.invoke(Native Method) 

at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 

Now I thought It may be due to when I initialise the...

Read More »

By: StackOverFlow - Monday, 16 April

Related Posts