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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:19:30+00:00 2026-06-05T21:19:30+00:00

This is what I have, but its failing saying that the table does not

  • 0

This is what I have, but its failing saying that the table does not exists. I am positive it does incase anyone asks that. But this is some of the code that does that:

What gets called


/*Constants*/
public static final String AUTHORITY = "content://com.smartcal.eventprovider";
private static final int EVENTS_INFO = 1;
baseUri = Uri.withAppendedPath(baseUri, "events_info");
    return new CursorLoader(this, baseUri, args.getStringArray("projection"), 
            args.getString("selection"), args.getStringArray("selectionArgs"), args.getBoolean("sortOrder") ? args.getString("sortOrder") : null );

What matches is


private String getTable(Uri uri) {
    String table = "";
    switch(sUriMatcher.match(uri)){
    case EVENTS_INFO: table = "events_info";
    }
    return table;
}

private static final UriMatcher sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);

static
{
    sUriMatcher.addURI(AUTHORITY, "events_info", 1);

}

And my query() method in custom ContentProvider


@Override
public Cursor query(Uri uri, String[] projection, String selection,
        String[] selectionArgs, String sortOrder) {
    database = openHelper.getWritableDatabase();

    return database.query(getTable(uri), projection, selection, selectionArgs, null, null, null);
}

Error:


06-19 17:34:14.366: E/AndroidRuntime(686): Caused by: 
java.lang.IllegalStateException: Invalid tables

EDIT:

When using Alex’s IllegalArgumentException, this is what I got back from the error:

06-19 19:17:42.277: E/AndroidRuntime(1134): Caused by: 
java.lang.IllegalArgumentException: Unknown URI
content://com.smartcal.eventprovider/events_info

As you can tell, it should match, assuming the sUriMatcher.addURI() method is working correctly.

  • 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-05T21:19:31+00:00Added an answer on June 5, 2026 at 9:19 pm

    Your problem might stem from the fact that your code isn’t very well organized…

    First thing,

    private String getTable(Uri uri) {
        switch(sUriMatcher.match(uri)) {
            case EVENTS_INFO: 
                return "events_info"; // return
    
            /** PROVIDE A DEFAULT CASE HERE **/
            default:
               // If the URI doesn't match any of the known patterns, throw an exception.
               throw new IllegalArgumentException("Unknown URI " + uri);
        }
    }
    

    Second thing,

    /** Use constants, not raw ints **/
    sUriMatcher.addURI(AUTHORITY, "events_info", EVENT_INFO);
    

    Other than that, you might want to provide some more info.

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

Sidebar

Related Questions

I have seen many answers for this type of question but its not related
I have 3 where clauses in LINQ, but its failing - I tried this
The config below seemed to have worked but now its failing. I followed this
Greetings I may have imagined this but does anyone know if Last.fm previously used
i have this code and its working but i want it to return dailyTotals
i have this application but how to use its? and example for 7-zip can?
I have a weird problem. I create this window, but its blank until i
what's the problem there, I have uploaded this video to server, but now its
I have this query. It matches anything which has South in its name. But
I have this code in my index.php. In Mozilla its ok. But in Ie

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.