I am trying to use the SearchWidget Action bar functionality using a custom set of data. The problem is when i enter any character in the search bar the suggestion ui is empty. From the log I see that the ContentProvider is used. I dont however see any log from the "Searchable Activity".
@Override
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
// TODO: Implement this to handle query requests from clients.
String query = uri.getLastPathSegment().toLowerCase();
Log.d("app", "AAAAAAAAAAAAA "+query);
String[] columnNames = {"_id", "Column1"};
MatrixCursor matrixCursor = new MatrixCursor(columnNames);
matrixCursor.addRow(new String[]{"1a", "r1v1"});
matrixCursor.addRow(new String[]{"2a", "r2v1"});
return matrixCursor;
//adapter.swapCursor(matrixCursor);
//throw new UnsupportedOperationException("Not yet implemented");
}
My SearchableActivity has following:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_searchable);
Log.d("app", "NNNNNNNNNNNNNN");
// Get the intent, verify the action and get the query
Intent intent = getIntent();
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
} else if (Intent.ACTION_VIEW.equals(intent.getAction())) {
// Handle a suggestions click (because the suggestions all use ACTION_VIEW)
Uri data = intent.getData();
}
}
I guess I am missing some very simple steps to connect some dots and display the results. Can anyone help?