SearchView - Choose between two target Activities according to the query result
- by vitorgreati
My application has to do the following:
- if the user enters a query that matches exactly an object in my database, a Activity that shows this object should appear;
- if the query doesn't match an exact object, a ArrayList with related objects will be returned and an Activity will display this list.
So, as I'm using a SearchView on my ActionBar, I want to know how to open the right Activity based on the result of the query, something like this:
if(objectFound) openActivityThatShowsThisObject();
else openActivityWithRelatedResults();
I saw in other question that I could use a facade Activity, but I don't know if that is a good approach.
Any help will be appreciated, thanks!