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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:52:11+00:00 2026-05-28T00:52:11+00:00

Why is my app force closing when I hit the button to start the

  • 0

Why is my app force closing when I hit the button to start the Activity of First

This is the startup Activity:

public class ForeverAlone extends Activity implements OnClickListener{
    /** Called when the activity is first created. */

    Button start;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        start = (Button) findViewById(R.id.bStart);
        start.setOnClickListener(this);
    }

            @Override
            public void onClick(View v) {
                Intent myIntent = new Intent(ForeverAlone.this, First.class);
                ForeverAlone.this.startActivity(myIntent);
            }

    }

This is the Activity that is MEANT to come up after I hit the button:

public class First extends Activity implements OnClickListener {

    Button firstNext;
    EditText firstFacebook, firstReallife;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.first);
        firstNext = (Button) findViewById(R.id.bFirstNext);
        firstFacebook = (EditText) findViewById(R.id.etFirst1);
        firstReallife = (EditText) findViewById(R.id.etFirst2);
        firstNext.setOnClickListener(this);
        String firstFB = firstFacebook.getText().toString();
        String firstRL = firstReallife.getText().toString();
        DataHelper.insert(firstFB, firstRL);
    }



        @Override
        public void onClick(View v) {
            Intent myIntent = new Intent(First.this, Second.class);
            First.this.startActivity(myIntent);
        }
}

Any help at all will be appreciated!

[Edit]

Here’s the LogCat:

01-08 19:19:55.656: D/dalvikvm(363): GC_EXTERNAL_ALLOC freed 50K, 53% free 2553K/5379K, external 1625K/2137K, paused 76ms
01-08 19:19:57.966: D/AndroidRuntime(363): Shutting down VM
01-08 19:19:57.966: W/dalvikvm(363): threadid=1: thread exiting with uncaught exception (group=0x40015560)
01-08 19:19:57.986: E/AndroidRuntime(363): FATAL EXCEPTION: main
01-08 19:19:57.986: E/AndroidRuntime(363): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.kenning.foreveralone/com.kenning.foreveralone.First}: java.lang.NumberFormatException: unable to parse '' as integer
01-08 19:19:57.986: E/AndroidRuntime(363):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
01-08 19:19:57.986: E/AndroidRuntime(363):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
01-08 19:19:57.986: E/AndroidRuntime(363):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-08 19:19:57.986: E/AndroidRuntime(363):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
01-08 19:19:57.986: E/AndroidRuntime(363):  at android.os.Handler.dispatchMessage(Handler.java:99)
01-08 19:19:57.986: E/AndroidRuntime(363):  at android.os.Looper.loop(Looper.java:123)
01-08 19:19:57.986: E/AndroidRuntime(363):  at android.app.ActivityThread.main(ActivityThread.java:3683)
01-08 19:19:57.986: E/AndroidRuntime(363):  at java.lang.reflect.Method.invokeNative(Native Method)
01-08 19:19:57.986: E/AndroidRuntime(363):  at java.lang.reflect.Method.invoke(Method.java:507)
01-08 19:19:57.986: E/AndroidRuntime(363):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-08 19:19:57.986: E/AndroidRuntime(363):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-08 19:19:57.986: E/AndroidRuntime(363):  at dalvik.system.NativeStart.main(Native Method)
01-08 19:19:57.986: E/AndroidRuntime(363): Caused by: java.lang.NumberFormatException: unable to parse '' as integer
01-08 19:19:57.986: E/AndroidRuntime(363):  at java.lang.Integer.parseInt(Integer.java:362)
01-08 19:19:57.986: E/AndroidRuntime(363):  at java.lang.Integer.parseInt(Integer.java:332)
01-08 19:19:57.986: E/AndroidRuntime(363):  at java.lang.Integer.<init>(Integer.java:105)
01-08 19:19:57.986: E/AndroidRuntime(363):  at com.kenning.foreveralone.DataHelper.insert(DataHelper.java:9)
01-08 19:19:57.986: E/AndroidRuntime(363):  at com.kenning.foreveralone.First.onCreate(First.java:27)
01-08 19:19:57.986: E/AndroidRuntime(363):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-08 19:19:57.986: E/AndroidRuntime(363):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
01-08 19:19:57.986: E/AndroidRuntime(363):  ... 11 more

[Edit]

I’ve found the cause of the “force close” problem.

It’s these lines of code:

String firstFB = firstFacebook.getText().toString();
String firstRL = firstReallife.getText().toString();
DataHelper.insert(firstFB, firstRL);

How do I stop the method from running into them and sort of skip them in a way?

  • 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-28T00:52:12+00:00Added an answer on May 28, 2026 at 12:52 am

    You are getting the instance of the EditTexts

        firstFacebook = (EditText) findViewById(R.id.etFirst1);
        firstReallife = (EditText) findViewById(R.id.etFirst2);
    

    then getting their values

        String firstFB = firstFacebook.getText().toString();
        String firstRL = firstReallife.getText().toString();
    

    and using them here

        DataHelper.insert(firstFB, firstRL);
    

    but the EditTexts are empty so you are essentially passing an empty string in, hence the

    Caused by: java.lang.NumberFormatException: unable to parse '' as integer
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my app keeps force closing before it starts... eclipse returns no errors in my
This is my logcat and the problem is that the application is force closing
How to quit the app or force close the app when multiple activity running
My app is force closing when I delete the last of my characters from
I am accessing the internet to get information. The app is force closing when
java.lang.RuntimeException: Unable to start activity....java.lang.ClassCastException: android.widget.RelativeLayout I got this exception out of nowhere; this
I can start my app and close later. But after closing, if I go
I am programming an iPhone app, and I need to force it to exit
Okay, I've got my normal app which is in portrait mode. I can force
My app uses a WebRequest at certain points to get pages from itself. This

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.