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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:35:15+00:00 2026-05-25T20:35:15+00:00

So this is supposed to be really really simple, since I’m just in the

  • 0

So this is supposed to be really really simple, since I’m just in the beginning stages of this app. Remember, I’m a beginner so excuse the noob code :p

The app crashes (force close) whenever I click the button to go on to the next page. Code is given below:

    Button b = (Button) findViewById(R.id.button1);
    final EditText et1 = (EditText) findViewById(R.id.editText1);
    final EditText et2 = (EditText) findViewById(R.id.editText2);

    b.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent i = new Intent(User.this, Game.class);
            i.putExtra("p1", et1.getText().toString());
            i.putExtra("p2", et2.getText().toString());

            Toast.makeText(User.this, "Activity 2 about to launch", Toast.LENGTH_SHORT).show();
            Toast.makeText(User.this, "Activity 2 launched", Toast.LENGTH_SHORT).show();
            startActivity(i);
        }
    });
}

}

Next page is below:

TextView tv = (TextView) findViewById(R.id.textView2);

Button b1 = (Button) findViewById(R.id.button1);
Button b2 = (Button) findViewById(R.id.button2);
Button b3 = (Button) findViewById(R.id.button3);    
Button b4 = (Button) findViewById(R.id.button4);
Button b5 = (Button) findViewById(R.id.button5);
Button b6 = (Button) findViewById(R.id.button6);    
Button b7 = (Button) findViewById(R.id.button7);
Button b8 = (Button) findViewById(R.id.button8);
Button b9 = (Button) findViewById(R.id.button9);

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

    Toast.makeText(Game.this, "Welcome "+getIntent().getExtras().getString("p1")+" and "+getIntent().getExtras().getString("p2"), Toast.LENGTH_SHORT).show();

}
  • 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-25T20:35:16+00:00Added an answer on May 25, 2026 at 8:35 pm

    A really common way to crash your application (especially when you are new to Android) is by forgetting to declare an Activity in your manifest file. I’m betting that this has caused your error.

    Your code looks good, and it should start the Game Activity. However, even if you have properly defined the Game class, it will not work unless you declare Game in your manifest file. Your manifest should already include some code about your original Activity that looks something like this:

    <activity android:name=".YourApplication"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    

    This declares a new activity and adds some filters to make sure it is the first thing opened when you launch the application. You should make sure you add a line like this right below it, so that the system knows about your Game class

    <activity android:name=".Game" android:label="Game">  
    

    For future reference and debugging more complex errors, you will want to know about the LogCat.

    The logcat usually makes fixing errors incredibly simple. When you get an error, the logcat output in Eclipse typically looks like this

    07-25 13:19:10.593: ERROR/AndroidRuntime(22861): FATAL EXCEPTION: main
    ERROR/AndroidRuntime(22861): java.lang.RuntimeException: /some sort of error/
        .../A lot of description/
        ...
    07-25 13:19:10.593: ERROR/AndroidRuntime(22861): Caused by: /Whatever the specific error was/
        07-25 13:19:10.593: ERROR/AndroidRuntime(22861):at com.chris.formStuff.FormStuffActivity.onCreate(FormStuffActivity.java:25)
        ...
        ...
    

    When you get errors like this you want to look at the “Caused by…” line, and the first few after that. This will describe the error and give you the exact line it occurred at.

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

Sidebar

Related Questions

This code is supposed to be able to sort the items in self.array based
This piece of code is supposed to go through a list and preform some
I would like to ask a really simple question. I am just passing a
This should be really simple. If I have a String like this: ../Test?/sample*.txt then
I can't understand this recursion even though it's a really simple example. When it
This problem is very simple, but I just can't figure it out added to
I really HATE to ask this because I thought this is supposed to be
This should be really simple, but I can't figure it out. So: how do
This is supposed to be a no brainer but I still can’t figure it
I know this is supposed to output what kind of shell I'm using, which

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.