Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8062321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:37:38+00:00 2026-06-05T10:37:38+00:00

I am creating an app in which the players enter their names into edit

  • 0

I am creating an app in which the players enter their names into edit texts. This information is retrieved and sent to a second activity through extras. Whenever I run this, I get a Resources$NotFoundException. I am nut sure if this is from my code or from my resources folder.

Here is my code (UPDATED WITHOUT TOAST STATEMENTS)

private void getNames(int number){      

    Intent intent = new Intent(Setup.this, Test.class);
    intent.putExtra("numberofplayers", number);

    try {

    if(!player1.getText().toString().contentEquals(""))
        p1 = player1.getText().toString();
    else
        p1= "Player 1";
    if(!player2.getText().toString().contentEquals(""))
        p2 = player2.getText().toString();
    else
        p2= "Player 2";
    if(!player3.getText().toString().contentEquals(""))
        p3 = player3.getText().toString();
    else
        p3= "Player 3";
    if(!player4.getText().toString().contentEquals(""))
        p4 = player4.getText().toString();
    else
        p5= "Player 5";
    if(!player6.getText().toString().contentEquals(""))
        p6 = player6.getText().toString();
    else
        p6= "Player 6";
    if(!player7.getText().toString().contentEquals(""))
        p7 = player7.getText().toString();
    else
        p7= "Player 7";
    if(!player8.getText().toString().contentEquals(""))
        p8 = player8.getText().toString();
    else
        p8= "Player 8";

    switch (number) {
    case 2:
        String[] a = {p1,p2};
        names=a;
        break;
    case 3:
        String[] b = {p1,p2,p3};
        names=b;
        break;
    case 4:
        String[] c = {p1,p2,p3,p4};
        names=c;
        break;
    case 5:
        String[] d= {p1,p2,p3,p4,p5};
        names=d;
        break;
    case 6:
        String[] e = {p1,p2,p3,p4,p5,p6};
        names=e;
        break;
    case 7:
        String[] f = {p1,p2,p3,p4,p5,p6,p7};
        names=f;
        break;
    case 8:
        String[] g = {p1,p2,p3,p4,p5,p6,p7,p8};
        names=g;
        break;
    }
    } catch (Exception e) {
        Log.e("Setup.class Error:", e.getMessage());
    }
    //Toast.makeText(this, number + "", Toast.LENGTH_SHORT).show();

    //for(int q =0;q<names.length;q++)
    //  Toast.makeText(this, names[q], Toast.LENGTH_SHORT).show();

    intent.putExtra("namearray", names);
    startActivity(intent);
}

Here is the code for the receiving activity:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle ext = getIntent().getExtras();
    int i= ext.getInt("numberofplayers");
    String[] names = ext.getStringArray("namearray");

    Toast.makeText(this, i, Toast.LENGTH_SHORT).show();

    for(int q =0;q<names.length;q++)
        Toast.makeText(this, names[q], Toast.LENGTH_SHORT).show();
}

And here is the logcat error (UPDATED LOGCAT REPORT):

06-06 21:21:07.267: E/AndroidRuntime(2538): FATAL EXCEPTION: main
06-06 21:21:07.267: E/AndroidRuntime(2538): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.brightdesign.truthordare/com.brightdesign.truthordare.Test}: android.content.res.Resources$NotFoundException: String resource ID #0x2
06-06 21:21:07.267: E/AndroidRuntime(2538):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at android.app.ActivityThread.access$600(ActivityThread.java:123)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at android.os.Looper.loop(Looper.java:137)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at android.app.ActivityThread.main(ActivityThread.java:4424)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at java.lang.reflect.Method.invokeNative(Native Method)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at java.lang.reflect.Method.invoke(Method.java:511)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at dalvik.system.NativeStart.main(Native Method)
06-06 21:21:07.267: E/AndroidRuntime(2538): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x2
06-06 21:21:07.267: E/AndroidRuntime(2538):     at android.content.res.Resources.getText(Resources.java:247)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at android.widget.Toast.makeText(Toast.java:260)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at com.brightdesign.truthordare.Test.onCreate(Test.java:16)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at android.app.Activity.performCreate(Activity.java:4465)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
06-06 21:21:07.267: E/AndroidRuntime(2538):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
06-06 21:21:07.267: E/AndroidRuntime(2538):     ... 11 more
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T10:37:40+00:00Added an answer on June 5, 2026 at 10:37 am

    This is your first Toast call:

    Toast.makeText(this, number, Toast.LENGTH_SHORT).show();
    

    Here, the second argument is an integer (number), so it thinks that is a string ID. Try replacing number with number+"".

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating the app where the players put their names into a program,
I am creating an app which requires the users to enter certain values when
I'm creating an app which can create, edit or view a place. When I
I am creating an app which will have a question in a UILabel and
I am creating an app which has around 15 different animations. Some animations are
I am in the process of creating an app which requires irregular shaped buttons.
I am creating a web app which uses jQuery to authenticate: $.ajax({ url: /session/create?format=json,
I'm creating an Android app which must do some web surfing in the background
I am currently creating a Dashboard app which is created with Ruby on Rails.
I'm creating a Django app in which I have a table which has 'items',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.