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

  • Home
  • SEARCH
  • 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 6895387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:54:07+00:00 2026-05-27T06:54:07+00:00

I have a really strange issue with my application and I don’t know why

  • 0

I have a really strange issue with my application and I don’t know why it’s happening (only in emulator). I’m using a custom database helper class and I don’t have any problems with it. But I have an issue with a specific column in a database table which I’m using really often. So depending on a some extras which I send from a parent activity I’m running different sql statements. Here is what I’m using :

String sql = "";
    switch (sort) {
    case 1:
            if (extra != 0) {
                sql = "SELECT DISTINCT c.objectId FROM cards AS c "
                        + "INNER JOIN cardtags AS ct "
                        + "ON (c.objectId=ct.cardId) "
                        + "WHERE c.collectionId=" 
                        + collId 
                        + " AND c.repeatsCount>0"+ " AND ct.tagId="
                        + extra;

            } else if (extra == 0) {
                sql = "SELECT DISTINCT c.objectId FROM cards AS c "
                        + "INNER JOIN cardtags AS ct "
                        + "ON (c.objectId=ct.cardId) "
                        + "WHERE c.collectionId=" 
                        + collId 
                        + " AND c.repeatsCount>0";
            }
        break;
    case 2:
            if (extra != 0) {
                sql = "SELECT DISTINCT cd.objectId FROM cards AS cd "
                        + "INNER JOIN categories AS ct "
                        + "ON (cd.categoryId=ct.objectId) "
                        + "WHERE cd.collectionId=" 
                        + collId
                        + " AND ct.objectId=" 
                        + extra 
                        + " AND cd.repeatsCount>0";

            } else if (extra == 0) {
                sql = "SELECT DISTINCT cd.objectId FROM cards AS cd "
                        + "INNER JOIN categories AS ct "
                        + "ON (cd.categoryId=ct.objectId) "
                        + "WHERE cd.collectionId=" 
                        + collId 
                        + " AND cd.repeatsCount>0";
            }
        break;
    case 3:
            String AscDesc = "";
            if (ascDesc == 0) {
                AscDesc = "ASC";
                sql = "SELECT DISTINCT objectId FROM cards "
                        + "WHERE collectionId="
                        + collId 
                        + " AND repeatsCount>0"
                        + " ORDER BY dateCreated "
                        + AscDesc;

            } else if (ascDesc != 0) {
                AscDesc = "DESC";
                sql = "SELECT DISTINCT objectId FROM cards  "
                        + "WHERE collectionId="
                        + collId 
                        + " AND repeatsCount>0"
                        + " ORDER BY dateCreated "
                        + AscDesc;
            }
        break;
    }
    Cursor myCursor = userDbHelper.executeSQLQuery(sql);
    if (myCursor.getCount() == 0) {
        myCursor.close();
    } else if (myCursor.getCount() > 0) {
        myCardID = new ArrayList<Integer>();
        myCardID.clear();
        for (myCursor.move(0); myCursor.moveToNext(); myCursor.isAfterLast()) {
            int cardId1 = myCursor.getInt(myCursor.getColumnIndexOrThrow("objectId"));
            myCardID.add(cardId1);
        }
    }

When I try to start this activity it’s throwing me an exception (ONLY IN EMULATOR,on real device – HTC Desire, HTC EVO 3D there is no problem)

"11-30 14:51:18.899: E/AndroidRuntime(14818): Caused by: java.lang.IllegalArgumentException: column 'objectId' does not exist"

on line : int cardId1 = myCursor.getInt(myCursor.getColumnIndexOrThrow("objectId"));

But the strange things is that when I download the database file from the emulator and open it, I can see clearly that I have column objectId there and I’m using that column in other files too, but it’s not throwing me an exception. So I’m wondering is it some kind of emulator bug, because I don’t get anything like this on device or maybe I’m doing something wrong.

Any ideas?

  • 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-27T06:54:08+00:00Added an answer on May 27, 2026 at 6:54 am

    The problem is the alias for the column in the select statement. Only in case 3 does your cursor actually contain a column called objectId so when you do myCursor.getColumnIndexOrThrow("objectId") it throws an exception.

    In case 1 the column in the cursor is “c” and in case 2 it is “cards”.

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

Sidebar

Related Questions

I have a really strange issue. I am working on a Java SWING application
I have a really strange issue when using hibernate to connect to a MySQLDB
This is a really strange issue. I have developed a small MVC application and
I have a really strange orientation issue. I have a sequence of view controllers
I have a really strange issue relating to how I handle navigation in an
I am currently struggling with a really really strange issue. I have a telephone
I'm seeing a really strange issue with JPopupMenu's and JComboBox's. When the application is
I am having a really strange issue with my edit page: If I have
Got really strange Firefox issue. Using the Microsoft __doPostBack javascript function in web forms
I have a really strange issue in my project. I have a facebook app

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.