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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:51:35+00:00 2026-06-17T11:51:35+00:00

i’m just programming a password manager but every time I run it, it crashed

  • 0

i’m just programming a password manager but every time I run it, it crashed in cause of NullPointerException. I checked the code but i’m a new developer. Someone here who knows why? 🙁

Code of MainActivity.java:

package de.lennartschoch.passwordmanager;

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;
import android.widget.EditText;

public class MainActivity extends Activity {

Button login;
EditText masterpassfield;
static String masterpass;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    login = (Button) findViewById(R.id.login);
    masterpass = "";
    masterpassfield = (EditText) findViewById(R.id.masterpass);

    if(masterpass.equals("")) {

        Intent intent = new Intent(this,NewMasterpass.class);
        startActivity(intent);
        return;
    }

    login.setOnClickListener(new OnClickListener() {


        @Override
        public void onClick(View view) {

            if(masterpassfield.getText().toString().equals(masterpass)) {

                Intent success = new Intent(view.getContext(), Passwords.class);
                startActivityForResult(success, 0);

            }

        }});
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}

}

Code of NewMasterpass.java:

package de.lennartschoch.passwordmanager;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class NewMasterpass extends Activity {

EditText masterpasscreate;
EditText repeat;
Button finish;
TextView mistake;

/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_new_masterpass);

    masterpasscreate = (EditText) findViewById(R.id.masterpasscreate);
    repeat = (EditText) findViewById(R.id.repeatcreate);
    finish = (Button) findViewById(R.id.finish);
    mistake = (TextView) findViewById(R.id.mistake);

    finish.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View view) {

            if(!masterpasscreate.getText().toString().equals(repeat.getText().toString())) {

                mistake.setText("The passwords are different.");
                mistake.setTextColor(Color.RED);

            }
            else if(masterpasscreate.getText().toString().equals("") || repeat.getText().toString().equals("")) {

                mistake.setText("Both textfields must be filled in");
                mistake.setTextColor(Color.RED);

            }
            else {

                MainActivity.masterpass = masterpasscreate.getText().toString();
                Intent myIntent = new Intent(view.getContext(), MainActivity.class);
                startActivityForResult(myIntent, 0);
            }

        }});


}
}

LogCat error:

01-20 17:17:52.629: D/AndroidRuntime(561): Shutting down VM
01-20 17:17:52.629: W/dalvikvm(561): threadid=1: thread exiting with uncaught exception         (group=0x409961f8)
01-20 17:17:52.639: E/AndroidRuntime(561): FATAL EXCEPTION: main
01-20 17:17:52.639: E/AndroidRuntime(561): java.lang.RuntimeException: Unable to start activity         ComponentInfo{de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.MainActivit    y}: java.lang.NullPointerException
01-20 17:17:52.639: E/AndroidRuntime(561):  at     android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
01-20 17:17:52.639: E/AndroidRuntime(561):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
01-20 17:17:52.639: E/AndroidRuntime(561):  at android.app.ActivityThread.access$600(ActivityThread.java:122)
01-20 17:17:52.639: E/AndroidRuntime(561):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
01-20 17:17:52.639: E/AndroidRuntime(561):  at android.os.Handler.dispatchMessage(Handler.java:99)
01-20 17:17:52.639: E/AndroidRuntime(561):  at android.os.Looper.loop(Looper.java:137)
01-20 17:17:52.639: E/AndroidRuntime(561):  at android.app.ActivityThread.main(ActivityThread.java:4340)
01-20 17:17:52.639: E/AndroidRuntime(561):  at java.lang.reflect.Method.invokeNative(Native Method)
01-20 17:17:52.639: E/AndroidRuntime(561):  at java.lang.reflect.Method.invoke(Method.java:511)
01-20 17:17:52.639: E/AndroidRuntime(561):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-20 17:17:52.639: E/AndroidRuntime(561):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-20 17:17:52.639: E/AndroidRuntime(561):  at dalvik.system.NativeStart.main(Native Method)
01-20 17:17:52.639: E/AndroidRuntime(561): Caused by: java.lang.NullPointerException
01-20 17:17:52.639: E/AndroidRuntime(561):  at de.lennartschoch.passwordmanager.MainActivity.onCreate(MainActivity.java:26)
01-20 17:17:52.639: E/AndroidRuntime(561):  at android.app.Activity.performCreate(Activity.java:4465)
01-20 17:17:52.639: E/AndroidRuntime(561):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-20 17:17:52.639: E/AndroidRuntime(561):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
01-20 17:17:52.639: E/AndroidRuntime(561):  ... 11 more
01-20 17:17:57.129: I/Process(561): Sending signal. PID: 561 SIG: 9
01-20 17:21:37.499: D/AndroidRuntime(608): Shutting down VM
01-20 17:21:37.499: W/dalvikvm(608): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
01-20 17:21:37.511: E/AndroidRuntime(608): FATAL EXCEPTION: main
01-20 17:21:37.511: E/AndroidRuntime(608): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.NewMasterpass}; have you declared this activity in your AndroidManifest.xml?
01-20 17:21:37.511: E/AndroidRuntime(608):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
01-20 17:21:37.511: E/AndroidRuntime(608):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
01-20 17:21:37.511: E/AndroidRuntime(608):  at android.app.ActivityThread.access$600(ActivityThread.java:122)
01-20 17:21:37.511: E/AndroidRuntime(608):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
01-20 17:21:37.511: E/AndroidRuntime(608):  at android.os.Handler.dispatchMessage(Handler.java:99)
01-20 17:21:37.511: E/AndroidRuntime(608):  at android.os.Looper.loop(Looper.java:137)
01-20 17:21:37.511: E/AndroidRuntime(608):  at android.app.ActivityThread.main(ActivityThread.java:4340)
01-20 17:21:37.511: E/AndroidRuntime(608):  at java.lang.reflect.Method.invokeNative(Native Method)
01-20 17:21:37.511: E/AndroidRuntime(608):  at java.lang.reflect.Method.invoke(Method.java:511)
01-20 17:21:37.511: E/AndroidRuntime(608):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-20 17:21:37.511: E/AndroidRuntime(608):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-20 17:21:37.511: E/AndroidRuntime(608):  at dalvik.system.NativeStart.main(Native Method)
01-20 17:21:37.511: E/AndroidRuntime(608): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.NewMasterpass}; have you declared this activity in your AndroidManifest.xml?
01-20 17:21:37.511: E/AndroidRuntime(608):  at  android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508)
01-20 17:21:37.511: E/AndroidRuntime(608):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
01-20 17:21:37.511: E/AndroidRuntime(608):  at android.app.Activity.startActivityForResult(Activity.java:3190)
01-20 17:21:37.511: E/AndroidRuntime(608):  at android.app.Activity.startActivity(Activity.java:3297)
01-20 17:21:37.511: E/AndroidRuntime(608):  at de.lennartschoch.passwordmanager.MainActivity.onCreate(MainActivity.java:30)
01-20 17:21:37.511: E/AndroidRuntime(608):  at android.app.Activity.performCreate(Activity.java:4465)
01-20 17:21:37.511: E/AndroidRuntime(608):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-20 17:21:37.511: E/AndroidRuntime(608):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
01-20 17:21:37.511: E/AndroidRuntime(608):  ... 11 more
01-20 17:22:30.769: D/AndroidRuntime(655): Shutting down VM
01-20 17:22:30.769: W/dalvikvm(655): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
01-20 17:22:30.779: E/AndroidRuntime(655): FATAL EXCEPTION: main
01-20 17:22:30.779: E/AndroidRuntime(655): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.NewMasterpass}; have you declared this activity in your AndroidManifest.xml?
01-20 17:22:30.779: E/AndroidRuntime(655):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
01-20 17:22:30.779: E/AndroidRuntime(655):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
01-20 17:22:30.779: E/AndroidRuntime(655):  at android.app.ActivityThread.access$600(ActivityThread.java:122)
01-20 17:22:30.779: E/AndroidRuntime(655):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
01-20 17:22:30.779: E/AndroidRuntime(655):  at android.os.Handler.dispatchMessage(Handler.java:99)
01-20 17:22:30.779: E/AndroidRuntime(655):  at android.os.Looper.loop(Looper.java:137)
01-20 17:22:30.779: E/AndroidRuntime(655):  at android.app.ActivityThread.main(ActivityThread.java:4340)
01-20 17:22:30.779: E/AndroidRuntime(655):  at java.lang.reflect.Method.invokeNative(Native Method)
01-20 17:22:30.779: E/AndroidRuntime(655):  at java.lang.reflect.Method.invoke(Method.java:511)
01-20 17:22:30.779: E/AndroidRuntime(655):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-20 17:22:30.779: E/AndroidRuntime(655):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-20 17:22:30.779: E/AndroidRuntime(655):  at dalvik.system.NativeStart.main(Native Method)
01-20 17:22:30.779: E/AndroidRuntime(655): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {de.lennartschoch.passwordmanager/de.lennartschoch.passwordmanager.NewMasterpass}; have you declared this activity in your AndroidManifest.xml?
01-20 17:22:30.779: E/AndroidRuntime(655):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508)
01-20 17:22:30.779: E/AndroidRuntime(655):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
01-20 17:22:30.779: E/AndroidRuntime(655):  at android.app.Activity.startActivityForResult(Activity.java:3190)
01-20 17:22:30.779: E/AndroidRuntime(655):  at android.app.Activity.startActivity(Activity.java:3297)
01-20 17:22:30.779: E/AndroidRuntime(655):  at de.lennartschoch.passwordmanager.MainActivity.onCreate(MainActivity.java:30)
01-20 17:22:30.779: E/AndroidRuntime(655):  at android.app.Activity.performCreate(Activity.java:4465)
01-20 17:22:30.779: E/AndroidRuntime(655):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-20 17:22:30.779: E/AndroidRuntime(655):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
01-20 17:22:30.779: E/AndroidRuntime(655):  ... 11 more
01-20 17:22:33.180: I/Process(655): Sending signal. PID: 655 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-06-17T11:51:36+00:00Added an answer on June 17, 2026 at 11:51 am

    Declare the NewMasterPass activity in your manifest xml as clearly mentioned in the logcat!

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms

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.