I know this is years old but just so someone else does not experience this 
nightmare, the problem described by James was happening to me because of 
the subtle difference between SearchManager.SUGGEST_COLUMN_INTENT_DATA and 
SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID

If you use SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID then it will yield 
one result, because it expects your searchable.xml configuration to specify 
the URI part that this ID will be appended on to.

If you do not use a URI based scheme to open your search suggestions then 
use SearchManager.SUGGEST_COLUMN_INTENT_DATA instead, IE:-

String[] columns = new String[] {

            BaseColumns._ID,

            SearchManager.SUGGEST_COLUMN_TEXT_1,

            SearchManager.SUGGEST_COLUMN_TEXT_2,

            SearchManager.SUGGEST_COLUMN_INTENT_DATA,

            SearchManager.SUGGEST_COLUMN_SHORTCUT_ID,

            SearchManager.SUGGEST_COLUMN_QUERY

        }
Hope that helps someone else as it wasted hours of my time! :)

Regards,

Ian

On Wednesday, 18 August 2010 22:47:02 UTC+1, James Chou wrote:
>
> I am having a problem with global search only showing 1 search 
> suggestion even though I am returning a cursor with multiple rows. 
> This problem doesn't exist for me in 2.1, nor do I see any other 
> applications having the same issue I am having. Even when I try 
> something as basic as this: 
>
> private Cursor createMatrixCursorWithMultipleRows() 
> { 
>         String[] matrixColumns = new String[] { BaseColumns._ID, 
> SearchManager.SUGGEST_COLUMN_TEXT_1 }; 
>
>         MatrixCursor mc = new MatrixCursor( matrixColumns ); 
>
>         mc.newRow().add( 0 ).add( new String( "0" ) ); 
>         mc.newRow().add( 1 ).add( new String( "1" ) ); 
>         mc.newRow().add( 2 ).add( new String( "2" ) ); 
>
>         return mc; 
> } 
>
> The only global search suggestion I will see in 2.2 is "0". Anybody 
> have any ideas what I could be doing wrong?

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to