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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:37:48+00:00 2026-06-05T04:37:48+00:00

I have no idea why Android/Java is doing this, It’s kind hard to think

  • 0

I have no idea why Android/Java is doing this, It’s kind hard to think as I’m extremely tired and literally can’t think for myself at this current time.

I’m creating static functions and imputing and executing the code that way, I don’t think that’s the reason as it hasn’t even got past the if statement yet; what do you all think? I bet it’s an easy solution, I just can’t figure it out for the life of me.

Code:

public class LogIn extends Activity {
    Button login;
    EditText user;
    EditText pass;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);
        TextView top = (TextView) findViewById(R.id.textView2);
        EditText user = (EditText) findViewById(R.id.etUser);
        EditText pass = (EditText) findViewById(R.id.etPass);
        CheckBox stay = (CheckBox) findViewById(R.id.cBStay);
        Button login = (Button) findViewById(R.id.btLogin);
        Process();

   }

    private void Process() {
        // TODO Auto-generated method stub
    login.setOnClickListener( new View.OnClickListener() {

        public void onClick(View v) {
            // TODO Auto-generated method stub
            String user1 = user.getText().toString();
             String pass1 = pass.getText().toString();
            if(user1 !=null &user1.length()>=1 & pass1 !=null &pass1.length()>=1) {
                ComHelper.SendLogin(user1, pass1);
            }
        }
    });


    }



}

LogCat:

06-03 22:34:01.178: E/AndroidRuntime(2599): FATAL EXCEPTION: main
06-03 22:34:01.178: E/AndroidRuntime(2599): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.gta5news.qwuik/com.gta5news.qwuik.LogIn}: java.lang.NullPointerException
06-03 22:34:01.178: E/AndroidRuntime(2599):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
06-03 22:34:01.178: E/AndroidRuntime(2599):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
06-03 22:34:01.178: E/AndroidRuntime(2599):     at android.app.ActivityThread.access$600(ActivityThread.java:123)
06-03 22:34:01.178: E/AndroidRuntime(2599):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
06-03 22:34:01.178: E/AndroidRuntime(2599):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-03 22:34:01.178: E/AndroidRuntime(2599):     at android.os.Looper.loop(Looper.java:137)
06-03 22:34:01.178: E/AndroidRuntime(2599):     at android.app.ActivityThread.main(ActivityThread.java:4424)
06-03 22:34:01.178: E/AndroidRuntime(2599):     at java.lang.reflect.Method.invokeNative(Native Method)
06-03 22:34:01.178: E/AndroidRuntime(2599):     at java.lang.reflect.Method.invoke(Method.java:511)
06-03 22:34:01.178: E/AndroidRuntime(2599):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-03 22:34:01.178: E/AndroidRuntime(2599):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-03 22:34:01.178: E/AndroidRuntime(2599):     at dalvik.system.NativeStart.main(Native Method)
06-03 22:34:01.178: E/AndroidRuntime(2599): Caused by: java.lang.NullPointerException
06-03 22:34:01.178: E/AndroidRuntime(2599):     at com.gta5news.qwuik.LogIn.Process(LogIn.java:32)
06-03 22:34:01.178: E/AndroidRuntime(2599):     at com.gta5news.qwuik.LogIn.onCreate(LogIn.java:26)
06-03 22:34:01.178: E/AndroidRuntime(2599):     at android.app.Activity.performCreate(Activity.java:4465)
06-03 22:34:01.178: E/AndroidRuntime(2599):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
06-03 22:34:01.178: E/AndroidRuntime(2599):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
  • 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-05T04:37:50+00:00Added an answer on June 5, 2026 at 4:37 am

    I know this for a fact, but only because there is a single line in the Process() method.

    Your instance member login has never been initialized, therefore, it is null, and thus, it throws a NullPointerException when you call the Process() method.

    If you look in your onCreate() method, you are not saving your Button ‘login’ to the instance member, but instead to a local member.

    login = (Button) findViewById(R.id.btLogin);
    

    This should fix one problem, but you will have the same issue for the rest of your instance members too (at least user and pass).

    user = (EditText) findViewById(R.id.etUser);
    pass = (EditText) findViewById(R.id.etPass);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm fairly new to Java & Android, so I have little idea what I
I'm new in Java and in programming on android. Have a look at this
I am programming in Java doing an android app, in my manifest I have
I have to implement Captcha in my android app code, but have no idea
Hello Can Any one have idea about below code and its related error. code:
I have no idea what strategy to take with this, but I'd like to
I have android application that is written regular way. layouts, java, APK. Now, depending
I have an idea for an app and am currently learning Android development. I'm
this problem has been doing my head in and I hope you can help!
I see this post How do I set up IntelliJ IDEA for Android applications?

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.