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

  • Home
  • SEARCH
  • 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 4538508
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:49:16+00:00 2026-05-21T14:49:16+00:00

It’s hard to explain in the title. Basically as far as I can tell

  • 0

It’s hard to explain in the title. Basically as far as I can tell the submit button is taking the name and placing it in the array like I want. What I need now is for the Play(done) Button to transfer the user and the data to the next class (which I believe is coded correctly) and I need it to start a game. The game which you will see in the second class (get the data from the previous) I need it to display the names from the names array 1 at a time and randomly assign them a task to do from the tasks array.

Currently the app is force closing after I click the play button. I’m linking both classes cause I’m pretty sure the problem is in the second class. Thanks for your help ahead of time.

Class1

public class Class1 extends Activity
{
    int players=0;
    String names[];

public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.class1);

    final EditText input = (EditText) findViewById(R.id.nameinput);

    final ArrayList<String> names = new ArrayList<String>();



    Button submitButton = (Button) findViewById(R.id.submit_btn);
    submitButton.setOnClickListener(new View.OnClickListener()
    {
        public void onClick(View submit1)
        {
            players++;
            for(int i=0; i < 6; i++)
            {
                names.add(input.getText().toString());

                input.setText("");
            }
        }
    });

    Button doneButton = (Button) findViewById(R.id.done_btn);
    doneButton.setOnClickListener(new View.OnClickListener()
    {
        public void onClick(View done1)
        {
            Intent done = new Intent(Class1.this, Game.class);
            Bundle bundle = new Bundle();
            bundle.putStringArrayList("arrayKey", names);

            done.putExtra("players", players);
            //done.putExtra("names", names[players]);
            startActivity(done);
        }
    });
}

Game Class

public class Game extends Activity
{
    int players, counter=0, score, ptasks,rindex;
    String[] names, tasks;
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.game);

    Bundle bundle = this.getIntent().getExtras();
    String[] names = bundle.getStringArray("arrayKey");

    Intent game = getIntent();
    players = game.getIntExtra("players", 1);
    //names = game.getStringArrayExtra("names");

    Random generator = new Random();

    tasks[0]= "";
    tasks[1]= "";
    tasks[2]= "";
    tasks[3]= "";
    tasks[4]= "";
    tasks[5]= "";
    tasks[6]= "";
    tasks[7]= "";
    tasks[8]= "";
    tasks[9]= "";



    while (counter <5)
    {
        for (int i = 0; i < players; i++)
        {
            TextView name1 = (TextView) findViewById(R.id.pname);
            name1.setText( names[i]+":");

            ptasks = 10;
            rindex = generator.nextInt(ptasks);

            TextView task = (TextView) findViewById(R.id.task);
            task.setText( tasks[rindex]);


        }
        Button failButton = (Button) findViewById(R.id.fail_btn);
        failButton.setOnClickListener(new View.OnClickListener()
        {
            public void onClick(View failed)
            {

            }
        });

        Button notButton = (Button) findViewById(R.id.notbad_btn);
        notButton.setOnClickListener(new View.OnClickListener()
        {
            public void onClick(View notbad)
            {

            }
        });

        Button champButton = (Button) findViewById(R.id.champ_btn);
        champButton.setOnClickListener(new View.OnClickListener()
        {
            public void onClick(View champp)
            {

            }
        });


        counter++;
    }


}

Thought I should also mention that these buttons on the 2nd page I would like to assign a score to whichever name array person is up and keep track until the final round where it will display the winner. If anyone has any idea how to make that work.

  • 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-05-21T14:49:17+00:00Added an answer on May 21, 2026 at 2:49 pm

    Have you made sure to include the Game activity as an Application Node in your AndroidManifest?

    If not, open your manifest to the application tab, on the bottom hit Add, and add an Activity of the name .Game

    Without this, that intent never gets received by the other class.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.