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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:15:48+00:00 2026-06-11T07:15:48+00:00

I face a problem when start my app and I want to know what

  • 0

I face a problem when start my app and I want to know what is the problem exactly.

I get this in log cat:

09-08 12:40:35.690: W/dalvikvm(1382): threadid=1: thread exiting with uncaught exception (group=0x40015560)
09-08 12:40:35.740: E/AndroidRuntime(1382): FATAL EXCEPTION: main
09-08 12:40:35.740: E/AndroidRuntime(1382): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.yahya.myfirstapp/com.yahya.myfirstapp.Main}: java.lang.NullPointerException
09-08 12:40:35.740: E/AndroidRuntime(1382):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
09-08 12:40:35.740: E/AndroidRuntime(1382):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
09-08 12:40:35.740: E/AndroidRuntime(1382):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
09-08 12:40:35.740: E/AndroidRuntime(1382):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
09-08 12:40:35.740: E/AndroidRuntime(1382):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-08 12:40:35.740: E/AndroidRuntime(1382):     at android.os.Looper.loop(Looper.java:123)
09-08 12:40:35.740: E/AndroidRuntime(1382):     at android.app.ActivityThread.main(ActivityThread.java:3683)
09-08 12:40:35.740: E/AndroidRuntime(1382):     at java.lang.reflect.Method.invokeNative(Native Method)
09-08 12:40:35.740: E/AndroidRuntime(1382):     at java.lang.reflect.Method.invoke(Method.java:507)
09-08 12:40:35.740: E/AndroidRuntime(1382):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-08 12:40:35.740: E/AndroidRuntime(1382):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-08 12:40:35.740: E/AndroidRuntime(1382):     at dalvik.system.NativeStart.main(Native Method)
09-08 12:40:35.740: E/AndroidRuntime(1382): Caused by: java.lang.NullPointerException
09-08 12:40:35.740: E/AndroidRuntime(1382):     at com.yahya.myfirstapp.Main.onCreate(Main.java:19)
09-08 12:40:35.740: E/AndroidRuntime(1382):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-08 12:40:35.740: E/AndroidRuntime(1382):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
09-08 12:40:35.740: E/AndroidRuntime(1382):     ... 11 more
09-08 12:40:41.260: I/Process(1382): Sending signal. PID: 1382 SIG: 9

and this is Main.java

package com.yahya.myfirstapp;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Main extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button b = (Button) findViewById(android.R.id.button1);
        b.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                startActivity(new Intent(Main.this, Second.class));

            }
        });
    }
}

and this Second.java

package com.yahya.myfirstapp;

import android.app.Activity;
import android.os.Bundle;

public class Second extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        setContentView(R.layout.second);
        }
}

activity_main.xml

<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:text="@string/welcome" />

</RelativeLayout>

second.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:text="@string/test_secondactivity" />

    <TextView android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:text="@string/welcome" />

</LinearLayout>
  • 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-11T07:15:49+00:00Added an answer on June 11, 2026 at 7:15 am

    Correct this line:

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

    to be:

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

    android.R is used to access built in system resources imbeded in the Android OS and there is no resource called button1

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

Sidebar

Related Questions

few days to start the iPad development and i face the some problem, In
This problem with calling up the font that has been declared at the start
This is a design problem I face regularly and I'd like to find some
I am new to iphone developement, during development I face problem due to this
I must be the first to face this problem because I can't find even
I face this problem. I have a filter that sets the character encoding of
I often face the problem of wanting to add additional methods to classes I
I begin in Python language and face a problem with my script. On stackoverflow,
I face the following problem function book($memberid, $classid){ if (!book){ // update the db
Sometimes i face the following problem : string txt = con.Request.Params[Par_name].ToString();//the original par value

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.