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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:21:32+00:00 2026-05-30T06:21:32+00:00

First off, i’ll post a picture to make it easier for you guys to

  • 0

First off, i’ll post a picture to make it easier for you guys to understand.

enter image description here

As you can see, there’s an EditText and a button.
I want the button to save the contents of the EditText into a string + start a new activity.

In the next activity, i then want to convert the string into an Integer.

This is my current code:

SENDER ACTIVITY

        startscore = (EditText) findViewById(R.id.startscore);

proceed = (Button) findViewById(R.id.bProceed);
proceed.setOnClickListener(new OnClickListener() {

    public void onClick(View v) {

        Intent myIntent = new Intent(Introscreen.this, BillardScoreboardActivity.class);
        String s = startscore.getText().toString();
        Bundle b = new Bundle();
        b.putString("lol", s);
        //put into your intent
        myIntent.putExtras(b);
        Introscreen.this.startActivity(myIntent);

    }
}); 
}

RECEIVER ACTIVITY

        int counter1, counter2, counter3, counter4, counter5;

            oncreate.....{

            Bundle b = getIntent().getExtras();
    String s = b.getString("lol");




    column1tv = (TextView) findViewById(R.id.column1text);
    column2tv = (TextView) findViewById(R.id.column2text);
    column3tv = (TextView) findViewById(R.id.column3text);
    column4tv = (TextView) findViewById(R.id.column4text);
    column5tv = (TextView) findViewById(R.id.column5text);

    column1tv.setText(counter1);
    column2tv.setText(counter2);
    column3tv.setText(counter3);
    column4tv.setText(counter4);
    column5tv.setText(counter5);

Hope you can help me troubleshooting it, to figure out the problem.

The problem:

Upon clicking the button, it shuts down the application and gives me those error codes:

02-23 15:01:24.136: E/AndroidRuntime(295): FATAL EXCEPTION: main

java.lang.RuntimeException: Unable to start activity
ComponentInfo{inno.games/inno.games.BillardScoreboardActivity}:
java.lang.NumberFormatException: unable to parse '' as integer

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

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

at android.app.ActivityThread.access$2300(ActivityThread.java:125)

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

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

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

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

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

at java.lang.reflect.Method.invoke(Method.java:521)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)

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

at dalvik.system.NativeStart.main(Native Method)

Caused by: java.lang.NumberFormatException: unable to parse '' as integer

at java.lang.Integer.parseInt(Integer.java:412)

at java.lang.Integer.parseInt(Integer.java:382)

at inno.games.BillardScoreboardActivity.onCreate(BillardScoreboardActivity.java:35)

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

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

... 11 more

enter image description here

  • 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-30T06:21:34+00:00Added an answer on May 30, 2026 at 6:21 am

    It’s breaking while trying to convert an empty string to an integer. Something is wrong while passing your string to the next activity. Try passing your string extra through a bundle instead:

    Bundle b = new Bundle();
    b.putString("key", string);
    //put into your intent
    yourIntent.putExtras(b);
    

    Then get it in your next activity:

    Bundle b = getIntent().getExtras();
    String s = b.getString("key");
    

    You also do need to switch your declarations of your TextViews and when you set them. You can’t set them if they are not yet declared.

    Edit: One more thing. I’m assuming you only want integers typed into that EditText. You should set the inputType on it, if you haven’t already.

    Edit 2: Don’t feel retarded, we were all beginners at one point! Firstly, try using a bundle and see if what you type into your EditText is properly passed to the next activity.

    Second, you set the inputType for the EditText in your XML file. Should be something like android:inputType="number".

    The declarations are these lines:

    column1tv = (TextView) findViewById(R.id.column1text);
    

    You’re creating an object for your TextViews. Then, you set them here:

    column1tv.setText(counter1);
    

    You must create and instantiate the object before you can do anything with it.

    Edit 3:
    Okay, from the screenshot you posted, I gathered the following:

    First- You’re creating the objects counter1, counter2, etc.. but you’re never instantiating them with anything. Which is probably where you’re getting your latest exception.

    Second- You’re getting the warning on the String s = b.getString("lol"); because it’s an unused local variable. (Check the problems tab in Eclipse and you’ll see what the warnings/problems you have in your code). You’re not doing anything with the string value that was passed from the previous activity.

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

Sidebar

Related Questions

First off, I want to apologize beforehand, as I know there is a lot
First off I apologize if there is another post out there that answers this,
First off, I want to say there is no use case for this. The
First off, I'm not an expert with MySQL queries, and I can't seem to
First off I'm horrible with regex, hoping I can get some help here cause
First off, don't link to the Don't parse HTML with Regex post :) I've
First off, I'd love to post some real code for this question, but I
first off I can't seem to figure what the first parameter in the pushState
First off, I apologize if this doesn't make sense. I'm new to XHTML, CSS
First off, I understand the reasons why an interface or abstract class (in the

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.