Error in single Sqlite database query using Provider content

Asked

Viewed 31 times

1

I am having a problem that when trying to make a query in the database of my application through Content Provider. When the attempt to query the database starts the application breaks.I did tests using any integer as id for the query, The application works normally searches the database and returns that it did not find the value in the database.But when I use an id the way I need it in this format:3ade68b8gc0b0b3, The application breaks.Log do Erro quando a aplicação quebra.

  • Why do you use this format? If the ID is an integer and Contentprovider expects the URI to have an integer, you must use an integer.

  • the ID I use is a string I concateno forming the URI

  • I get stuck with this id format, because I’m working with an api,e this is the provided identifier, I need to use it to make comparisons and searches . Checking that the ID being consulted in the API is already in the DB of my application

  • If you want to access the bank for this value Content Provider must provide a method for this purpose.

  • if you do it in urimatcher?

  • 1

    Yeah, there’s gotta be one more URI_MATCHER.addURI, but instead of # use *. You have to change at least the method query to deal with this type of URI.

  • thanks friend , helped me solve. I was having a problem with Loader tb, I was forgetting to reset it.There was no renewal of the id I was looking for in DB.You can explain the difference when I use the "#" or when I use it "*".

  • 1

    The # indicates to URI_MATCHER that in this location you should find an integer, while the * indicates a string.

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.