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 8060595
In Process

The Archive Base Latest Questions

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

I am creating the app where the players put their names into a program,

  • 0

I am creating the app where the players put their names into a program, the program sends their names to the next activity in a String array, and the next program puts the array into a list an then shuffles it. For some reason, everytime I try to use the.setText function, the app gets a nullpointerexception error. I have tested the list with a toast to verify that it is not null, which it is not. Any suggestions?

endInstructions = (Button)findViewById(R.id.buttonEndInstructions);

    player = (TextView)findViewById(R.id.textViewPlayerName);

    endInstructions.setOnClickListener(this);

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

    names = Arrays.asList(sarray);
    Collections.shuffle(names);

    Toast.makeText(this, names.get(0), Toast.LENGTH_SHORT).show();

    //player.setText(names.get(0));

Thanks in advance!

  • 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:02:44+00:00Added an answer on June 5, 2026 at 10:02 am

    There are not a million solutions…

    Player is null, you can check that by testing:

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

    What does that mean? Probably that your current layout does not contains a textview called “textViewPlayerName”

    Please double check your xml layout or be sure that you used setContentView before 😉

    Edit: as endInstructions is not null regarding your code, you corretly used setContentView before…

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

Sidebar

Related Questions

I am creating an app in which the players enter their names into edit
I'm considering creating my own GAE app to track players' highscores in my videogames.
I'm currently creating my first android app and I've a simple class 'Player' I
I'm creating and app that will rely on a database, and I have all
I am creating an app that is having a UIWebView which contains an advert.
I am creating an app which will have a question in a UILabel and
I am creating console app, involving lots of services. I want to display a
I am creating an app that runs on the logitech revue. The UI is
hey I'm creating an app with two switches on it that change the background
I am creating an app which has around 15 different animations. Some animations are

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.