I think the following scenario is common, but I cannot figure out how to implement it:
We have three actions and one database. We ask the user for input to search the database. The request should not receive any, none of the results.
- If you do not receive anything, you simply inform the user.
- If you get only one, you show it in a new action with the correct presentation.
- If you get a lot, you show them in a list to allow the user to choose the right one, and then pass this activity, which shows data only in case of only one result.
The problem is that in order to find out the number of results, you need to execute the query (and get the cursor) in the first step. And in the case when you get more than one result, you need to send data ( pass the cursor? ) To the acitivty list. Repeated query execution in list activity may not be right, right?
I know that you can share cursors using the content provider, but since the actions are performed from the same application and the data is private (useless from the outside), there is no reason to make it accessible to anyone else.
I read here that you can sort a convenient cursor and send it in a bundle, but I'm not sure if this is correct.
Any idea on how to solve this problem?
Thanks in advance.