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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:54:47+00:00 2026-06-05T15:54:47+00:00

Hey I just started dabbling with android programming, and from my short period of

  • 0

Hey I just started dabbling with android programming, and from my short period of time with it I’m a bit frustrated. I can get no errors in eclipse, but when I start my app it immediately force closes. I’m following an android tutorial book verbatim, and still I’m getting errors. My aim here is to create a list view inside a relative layout. Also, for some reason when I assign p.firstName or p.lastName it’ll force close as well, but anyways here’s my code. I’m using API level 15 (ie. Android 4.0.3) if that makes a difference.

 package matthews.zack.test;
 import android.app.Activity;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.Button;
 import android.widget.EditText;
   public class _testActivity extends Activity {

Button save;
People p = new People();
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    //onInitialize();
}

private void onInitialize()
{
     save = (Button)findViewById(android.R.id.button1);
     save.setOnClickListener(new View.OnClickListener() {


        public void onClick(View v) {
            // TODO Auto-generated method stub
            EditText firstName = (EditText)findViewById(android.R.id.text1);
            EditText lastName = (EditText)findViewById(android.R.id.text2);
            p.setFirstName("Hai");//firstName.getText().toString());
            p.setLastName("Hi");//lastName.getText().toString());
            //((EditText)findViewById(android.R.id.text1)).setText("This the tune bada bing bada boom");
        }
    });
}

}

`
and here’s my XML code

`<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width ="fill_parent"
android:layout_height = "fill_parent">
<TableLayout 
android:id="@+id/details"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" 
android:layout_alignParentBottom="true">

<TableRow>

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/firstName" />

<EditText
    android:id="@+id/editText1"
    android:ems="10" 
/>
</TableRow>
<TableRow>
<TextView
android:id="@+id/textView2"
android:layout_width = "wrap_content"
android:layout_height="wrap_content"
android:text="@string/lastName" />
<EditText
    android:id="@+id/editText2"
     />
</TableRow>
<TableRow>
<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/Save" />
</TableRow>
</TableLayout>

<ListView
 android:id = "@+id/listView1"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:layout_alignParentTop="true"
 android:layout_above="@id/details"
 />

</RelativeLayout>

`

Here’s my error output

06-12 00:32:44.871: D/AndroidRuntime(30530): Shutting down VM
06-12 00:32:44.871: W/dalvikvm(30530): threadid=1: thread exiting with uncaught exception (group=0x40a3b1f8)
06-12 00:32:44.879: E/AndroidRuntime(30530): FATAL EXCEPTION: main
06-12 00:32:44.879: E/AndroidRuntime(30530): java.lang.RuntimeException: Unable to start activity ComponentInfo{matthews.zack.test/matthews.zack.test._testActivity}: java.lang.NullPointerException
06-12 00:32:44.879: E/AndroidRuntime(30530):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
06-12 00:32:44.879: E/AndroidRuntime(30530):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
06-12 00:32:44.879: E/AndroidRuntime(30530):    at android.app.ActivityThread.access$600(ActivityThread.java:123)
06-12 00:32:44.879: E/AndroidRuntime(30530):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
06-12 00:32:44.879: E/AndroidRuntime(30530):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-12 00:32:44.879: E/AndroidRuntime(30530):    at android.os.Looper.loop(Looper.java:137)
06-12 00:32:44.879: E/AndroidRuntime(30530):    at android.app.ActivityThread.main(ActivityThread.java:4424)
06-12 00:32:44.879: E/AndroidRuntime(30530):    at java.lang.reflect.Method.invokeNative(Native Method)
06-12 00:32:44.879: E/AndroidRuntime(30530):    at java.lang.reflect.Method.invoke(Method.java:511)
06-12 00:32:44.879: E/AndroidRuntime(30530):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
06-12 00:32:44.879: E/AndroidRuntime(30530):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
06-12 00:32:44.879: E/AndroidRuntime(30530):    at dalvik.system.NativeStart.main(Native Method)
06-12 00:32:44.879: E/AndroidRuntime(30530): Caused by: java.lang.NullPointerException
06-12 00:32:44.879: E/AndroidRuntime(30530):    at matthews.zack.test._testActivity.onInitialize(_testActivity.java:24)
06-12 00:32:44.879: E/AndroidRuntime(30530):    at matthews.zack.test._testActivity.onCreate(_testActivity.java:18)
06-12 00:32:44.879: E/AndroidRuntime(30530):    at android.app.Activity.performCreate(Activity.java:4465)
06-12 00:32:44.879: E/AndroidRuntime(30530):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
06-12 00:32:44.879: E/AndroidRuntime(30530):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
06-12 00:32:44.879: E/AndroidRuntime(30530):    ... 11 more

It’s a bit frustrating that android will force close without telling me the exception. I would appreciate the help. Thanks!

  • 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-05T15:54:48+00:00Added an answer on June 5, 2026 at 3:54 pm

    Here is the mistake:

    save = (Button)findViewById(android.R.id.button1);
    

    You better do something like that:

    save = (Button)findViewById(R.id.button1);
    

    And import the right R file:

    import com.yournamespace.R;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey. I just started with Android. I'm using the ViewFlipper layout with 2 LinearLayouts.
Hey everyone! Started programming with Bluetooth on Android awhile ago. But now I've run
Hey all, I'm just wondering if it is possible to get the name of
Hey guys, I am just trying to pull all the records from my database
hey guys I just started trying to convert my query structure to PDO and
hey all, just getting started on hadoop and curious what the best way in
hey all, I'm just getting started with c3p0 for database connection pooling. It's attaching
Hey, I'm trying to get an extension to wait for a xml message from
Hey, I've just started learning JavaScript and I'm making a little script that generates
Hey basically just having a little trouble with the following, submitting a message from

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.