SearchView - Choose between two target Activities according to the query result

Posted by vitorgreati on Stack Overflow See other posts from Stack Overflow or by vitorgreati
Published on 2013-11-10T21:50:06Z Indexed on 2013/11/10 21:52 UTC
Read the original article Hit count: 228

Filed under:
|

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!

© Stack Overflow or respective owner

Related posts about android

Related posts about searchview