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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:30:15+00:00 2026-05-26T10:30:15+00:00

I’m new to android development. I can’t figure out why this is crashing in

  • 0

I’m new to android development. I can’t figure out why this is crashing in the emulator, When i run this program on my Android emulator it opens then quickly closes giving me a “Unfortunately hello world has stopped message.

            public class HelloAndroidActivity extends Activity {
                /** Called when the activity is first created. */
                @Override
                public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.main);
                    TextView t=(TextView)findViewById(R.id.textView1);  
                    t.setText("Secoknd text to display!"); 

                }   
            }

xml file :

            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="fill_parent"
                android:orientation="horizontal" >





                <TextView
                    android:id="@+id/textView1"
                    android:layout_width="match_parent"
                    android:layout_height="38dp"
                    android:editable="true"
                    android:text="TextView" />

            </LinearLayout>

LogCat:

            10-20 20:07:48.784: D/AndroidRuntime(601): Shutting down VM
            10-20 20:07:48.784: W/dalvikvm(601): threadid=1: thread exiting with uncaught exception (group=0x409951f8)
            10-20 20:07:48.804: E/AndroidRuntime(601): FATAL EXCEPTION: main
            10-20 20:07:48.804: E/AndroidRuntime(601): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.helloandroid/com.example.helloandroid.HelloAndroidActivity}: java.lang.NullPointerException
            10-20 20:07:48.804: E/AndroidRuntime(601):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
            10-20 20:07:48.804: E/AndroidRuntime(601):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
            10-20 20:07:48.804: E/AndroidRuntime(601):  at android.app.ActivityThread.access$600(ActivityThread.java:122)
            10-20 20:07:48.804: E/AndroidRuntime(601):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
            10-20 20:07:48.804: E/AndroidRuntime(601):  at android.os.Handler.dispatchMessage(Handler.java:99)
            10-20 20:07:48.804: E/AndroidRuntime(601):  at android.os.Looper.loop(Looper.java:137)
            10-20 20:07:48.804: E/AndroidRuntime(601):  at android.app.ActivityThread.main(ActivityThread.java:4340)
            10-20 20:07:48.804: E/AndroidRuntime(601):  at java.lang.reflect.Method.invokeNative(Native Method)
            10-20 20:07:48.804: E/AndroidRuntime(601):  at java.lang.reflect.Method.invoke(Method.java:511)
            10-20 20:07:48.804: E/AndroidRuntime(601):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
            10-20 20:07:48.804: E/AndroidRuntime(601):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
            10-20 20:07:48.804: E/AndroidRuntime(601):  at dalvik.system.NativeStart.main(Native Method)
            10-20 20:07:48.804: E/AndroidRuntime(601): Caused by: java.lang.NullPointerException
            10-20 20:07:48.804: E/AndroidRuntime(601):  at com.example.helloandroid.HelloAndroidActivity.onCreate(HelloAndroidActivity.java:16)
            10-20 20:07:48.804: E/AndroidRuntime(601):  at android.app.Activity.performCreate(Activity.java:4465)
            10-20 20:07:48.804: E/AndroidRuntime(601):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
            10-20 20:07:48.804: E/AndroidRuntime(601):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
            10-20 20:07:48.804: E/AndroidRuntime(601):  ... 11 more
            10-20 20:12:48.894: I/Process(601): Sending signal. PID: 601 SIG: 9
  • 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-26T10:30:15+00:00Added an answer on May 26, 2026 at 10:30 am

    If the TextView is null with the code you provided, you must be setting the wrong layout id. Your code sample has setContentView(R.layout.main);. Is it possible that the xml you provided is from a file other than main.xml?

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported

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.