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

The Archive Base Latest Questions

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

I am developing an Android (API level 7) app in Eclipse 3.7.2. I have

  • 0

I am developing an Android (API level 7) app in Eclipse 3.7.2. I have the most curious problem:

There is a class called LoginData to hold login information:

public class LoginData {
  private final String login;
  private final String password;

  public LoginData(final String login, final String password) {
    this.login = login;                                      // breakpoint 2 here
    this.password = password;
  }

  public String getLogin() {
    return login;
  }
  public String getPassword() {
    return password;
  }
}

Then there is a method to retrieve it (in another class):

public static LoginData getLoginData(final Context context) {
  final SharedPreferences prefs = getPrefs(context);
  final String login = prefs.getString(LOGIN, null);
  final String pass = prefs.getString(PASS, null);
  if (Utils.isEmpty(login) || Utils.isEmpty(pass)) {        // breakpoint 1 here
    return null;
  }
  return new LoginData(login, pass);
}

Method isEmpty() looks like this:

public static boolean isEmpty(final String s) {
  return s == null || "".equals(s);
}

And a method calling getLoginData() inside an AsyncTask:

@Override
protected WSResult doInBackground(final Params... params) {
  final LoginData loginData = Prefs.getLoginData(context);
  ...

context is an activity in which the async task is located.

Now when I run this code, loginData is null. Tracing the problem, I put a breakpoint 1 in the specified location. I see that both login and pass is not empty, and I see the program flow go to the last line, return new LoginData(...);. From there it returns… a null.

Tracing the problem further I add breakpoint 2, only to find that the constructor LoginData(...) does not get invoked.

So my first question is: am I missing something really obvious here? If not, there is some weird problem with the code that gets compiled and run.

Some remarks:

  • LoginData is used in another location in the program, and works – breakpoint 2 catches on.
  • I tried renaming LoginData to something else, in case it’s cached somewhere or there is a weird name clash.
  • I tried running this on a Android 2.1 emulator from Eclipse, as well as on a Galaxy Tab.
  • I tried cleaning & building the project again.
  • I tried closing & opening the project again.
  • I tried deleting the project from workspace and importing it again.

I would like to avoid the necessity to create a new Eclipse workspace (that is my final chance, it helped me in a similar case when dealing with Java EE).

What to do?

  • 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-06T11:54:37+00:00Added an answer on June 6, 2026 at 11:54 am
    if (Utils.isEmpty(login) || Utils.isEmpty(pass))
    

    try replacing this check with

    if (login==null || pass==null)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an app for Android in Eclipse. Currently I target API level 3,
I'm developing an Android app (API level 8). How do I add some right
I am developing an Android App @ 1.6 API level. I need to adjust
Iam developing an android app.about google maps API for android i want to ask
I'm currently developing the presentation layer of an android app. The api which I'm
I'm developing an Android application that is targeting API level 8 (2.2, Froyo). I'm
Currently i'm developing an Android project on Android Platform 2.3.3, API Level 10 .
I am developing Android 2.1 API 7 app. To implement action bar , I
I'm having the following issue developing in android 2.2 (API 8): I have a
I'm developing with API level 8 on android 2.2 I read this about the

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.