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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:55:03+00:00 2026-06-10T12:55:03+00:00

here is the logcat below, i cannot understand what a null pointer exeption means,

  • 0

here is the logcat below, i cannot understand what a null pointer exeption means, or any of the stuff under it.

08-18 14:59:21.080: E/AndroidRuntime(13333): FATAL EXCEPTION: main
08-18 14:59:21.080: E/AndroidRuntime(13333): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{k.t.m/k.t.m.MainActivity}: java.lang.NullPointerException
08-18 14:59:21.080: E/AndroidRuntime(13333):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1894)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at android.app.ActivityThread.access$600(ActivityThread.java:128)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at android.os.Handler.dispatchMessage(Handler.java:99)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at android.os.Looper.loop(Looper.java:137)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at android.app.ActivityThread.main(ActivityThread.java:4514)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at java.lang.reflect.Method.invokeNative(Native Method)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at java.lang.reflect.Method.invoke(Method.java:511)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at dalvik.system.NativeStart.main(Native Method)
08-18 14:59:21.080: E/AndroidRuntime(13333): Caused by: java.lang.NullPointerException
08-18 14:59:21.080: E/AndroidRuntime(13333):    at android.app.Activity.findViewById(Activity.java:1794)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at k.t.m.MainActivity.<init>(MainActivity.java:14)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at java.lang.Class.newInstanceImpl(Native Method)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at java.lang.Class.newInstance(Class.java:1319)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at android.app.Instrumentation.newActivity(Instrumentation.java:1027)
08-18 14:59:21.080: E/AndroidRuntime(13333):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1885)
08-18 14:59:21.080: E/AndroidRuntime(13333):    ... 11 more

here is the main java that i have so far… Thanks to everyone that helps me out with this problem.

package k.t.m;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.support.v4.app.NavUtils;
import android.widget.*;

public class MainActivity extends Activity {

    TextView main = (TextView) findViewById(R.id.main);
    Button mainButton1 = (Button) findViewById(R.id.mainButton1);
    Button mainButton2 = (Button) findViewById(R.id.mainButton2);

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

        mainButton1.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                milesToKilometers();
            }

        });

        mainButton2.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                kilometersToMiles();
            }

        });

    }

    protected void kilometersToMiles() {

        main.setVisibility(View.INVISIBLE);
        mainButton1.setVisibility(View.INVISIBLE);
        mainButton2.setVisibility(View.INVISIBLE);

    }

    protected void milesToKilometers() {

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }


}
  • 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-10T12:55:04+00:00Added an answer on June 10, 2026 at 12:55 pm

    You are calling findViewById() before you have called setContentView(), which will not work well.

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

Sidebar

Related Questions

Here is the logcat: 01-15 16:06:03.622: ERROR/AndroidRuntime(22300): Uncaught handler: thread main exiting due to
Here is my LogCat log: 08-25 22:35:27.989: ERROR/AndroidRuntime(327): Caused by: android.database.CursorIndexOutOfBoundsException: Index -1 requested,
Here is the code: create table `team`.`User`( `UserID` bigint NOT NULL AUTO_INCREMENT , `Username`
Here is my SQL script CREATE TABLE tracks( track_id int NOT NULL AUTO_INCREMENT, account_id
Here is my LogCat log: 07-17 14:05:10.226: INFO/ActivityManager(71): Starting activity: Intent { cmp=com.mohit.gtd/.TaskEdit }
I have got a runtime exception while developing an App. Here is my LogCat.
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }
Here's my code in the <head></head> : <link rel=stylesheet href=http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css /> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js></script>
Here is the code in a function I'm trying to revise. This example works
Here is my work environment: Eclipse Juno as IDE with maven2 plugin on it

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.