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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:27:52+00:00 2026-05-19T15:27:52+00:00

Hy! I don’t find the error. The error should be at the btlogin.setOnClickListener Login

  • 0

Hy!

I don’t find the error.
The error should be at the btlogin.setOnClickListener

Login Class

package android.skiptvad;

public class Login extends Activity{
 ProgressDialog pd = null;
 //final SharedPreferences settings = getSharedPreferences("pref", 0);
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.login);
  final SharedPreferences settings = getSharedPreferences("pref", 0);
  final EditText user = (EditText)findViewById(R.id.login_etuser);
  final EditText pw = (EditText)findViewById(R.id.login_etpw);
  Button btlogin = (Button)findViewById(R.id.login_btlog);
  Button btnew = (Button)findViewById(R.id.login_btnew);
  final CheckBox cb = (CheckBox)findViewById(R.id.login_cb);

  if (settings.getString("user", "") != "")
  {
   user.setText(settings.getString("user", ""));
   pw.setText(settings.getString("pw", ""));
  }



  btlogin.setOnClickListener(new OnClickListener() {

   @Override
   public void onClick(View v) {

    if (!user.getText().toString().equals("") && !pw.getText().toString().equals(""))
    {
     pd.setCancelable(true);
     pd = ProgressDialog.show(Login.this,"","Loading. Please wait...", true);
     List<NameValuePair> params = new ArrayList<NameValuePair>();
                   params.add(new BasicNameValuePair("username", user.getText().toString()));
                   params.add(new BasicNameValuePair("password", pw.getText().toString()));
                   Handler handler = new Handler(){
                   @Override
                   public void handleMessage(Message msg) {
                    pd.cancel();
                      if (msg.obj.toString()!= null)
                      {
                     JSONParse json = null;
                     try {
        json = new JSONParse(msg.obj.toString());
      } catch (JSONException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
      }
      String session = json.getsessionid();
      SharedPreferences.Editor editor = settings.edit();
                       editor.putString("session_id", session);
                       editor.commit();
                       finish();

                      }
                      else
                      {

                       runOnUiThread(new  Runnable() {
       public void run() {
        Toast toast ;
                toast =  Toast.makeText(getApplicationContext(), "error", 500);
            toast.show();
       }
      });
                      }
                   }
                   };
     HttpConnection con = new HttpConnection(params, "http://surfkid.redio.de/login", handler);
     Log.e("xxxcon", "ok");
     con.start();
    }
    if (cb.isChecked())
    {
   SharedPreferences.Editor editor = settings.edit();
                         editor.putString("user", user.getText().toString());
                         editor.putString("pw", pw.getText().toString());
                         editor.commit();
    }

   }
  });
  btnew.setOnClickListener(new OnClickListener() {

   @Override
   public void onClick(View v) {
     startActivityForResult(new Intent(Login.this, NewAccount.class), 1);

   }
  });
 }


}

LogCat:

01-28 14:11:03.180: ERROR/AndroidRuntime(12132): FATAL EXCEPTION: main
01-28 14:11:03.180: ERROR/AndroidRuntime(12132): java.lang.NullPointerException
01-28 14:11:03.180: ERROR/AndroidRuntime(12132):     at android.skiptvad.Login$1.onClick(Login.java:71)
01-28 14:11:03.180: ERROR/AndroidRuntime(12132):     at android.view.View.performClick(View.java:2461)
01-28 14:11:03.180: ERROR/AndroidRuntime(12132):     at android.view.View$PerformClick.run(View.java:8888)
01-28 14:11:03.180: ERROR/AndroidRuntime(12132):     at android.os.Handler.handleCallback(Handler.java:587)
01-28 14:11:03.180: ERROR/AndroidRuntime(12132):     at android.os.Handler.dispatchMessage(Handler.java:92)
01-28 14:11:03.180: ERROR/AndroidRuntime(12132):     at android.os.Looper.loop(Looper.java:123)
01-28 14:11:03.180: ERROR/AndroidRuntime(12132):     at android.app.ActivityThread.main(ActivityThread.java:4627)
01-28 14:11:03.180: ERROR/AndroidRuntime(12132):     at java.lang.reflect.Method.invokeNative(Native Method)
01-28 14:11:03.180: ERROR/AndroidRuntime(12132):     at java.lang.reflect.Method.invoke(Method.java:521)
01-28 14:11:03.180: ERROR/AndroidRuntime(12132):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
01-28 14:11:03.180: ERROR/AndroidRuntime(12132):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
01-28 14:11:03.180: ERROR/AndroidRuntime(12132):     at dalvik.system.NativeStart.main(Native Method)
  • 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-19T15:27:53+00:00Added an answer on May 19, 2026 at 3:27 pm

    I think ‘pd’ is null when you try to set it as cancelable… It looks like you don’t create it until the next line…

     pd.setCancelable(true);
     pd = ProgressDialog.show(Login.this,"","Loading. Please wait...", true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't really know how to formulate the title, but it should be pretty obvious
Don't ask why, but is there any way to suppress a failed linking error?
Don't know what to do with this error. How to add data in SQL
I don't get to see the source code but the .class file. Can I
Don't know why but I can't find a solution to this. I have 3
Don't know why this conversion fails. SELECT CAST('32.999' AS INT) throws the error saying
don't know better title for this, but here's my code. I have class user
don't know if the title describes anything about what I'm trying to say but
Don't ask me how but I'm in a situation where I have DCPs published
don't know what happened in my jcrop selection. I think I pressed some keys

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.