Android search interface vs. simply getting search query -
Android search interface vs. simply getting search query -
i'm trying implement search app , have problem understanding difference between these 2 methods. why have define search configuration (described here: http://developer.android.com/guide/topics/search/search-dialog.html), add together bunch of meta-data manifest, , have separate activity search, when can treat other textview, grab it's text, , query database that? there advantage former method, or disadvantage latter? in mind straight getting text , doing own stuff off of seems lot easier, when after dealing search interface i'll still need query intent , perform actual search that. missing here? thanks!
here's mean straight getting search query (without using search interface):
@override public void oncreateoptionsmenu(menu menu, menuinflater inflater) { super.oncreateoptionsmenu(menu, inflater); menuitem search = menu.finditem(r.id.action_search); searchview searchview = (searchview) search.getactionview(); searchview.setonquerytextlistener(new searchview.onquerytextlistener() { @override public boolean onquerytextsubmit(string query) { // stuff query homecoming true; } @override public boolean onquerytextchange(string newtext) { // stuff newtext homecoming true; } }); }
you have few advantages in working "standard" searching feature:
the search user utilize have "search" boxes on device. if design devices. love in "standard" because in way users simple utilize , compatibility on devices much wider activity life cycle : see here. huge advantage. if & sense fit's design have lot of other features available , checked , working , bugles.daniel
android
Comments
Post a Comment