I'm trying to do a Suggestion Provider in Android. The suggestions are showed depending on the text which I have entered (this part is already done) but when I want to recover the data (its _id) from the content provider, the instruction getData() returns null.
In the SuggestionProvider I give value to SUGGEST_COLUMN_TEXT_1,SUGGEST_COLUMN_TEXT_2 and SUGGEST_COLUMN_INTENT_DATA_ID:
HashMap<String,String> map = new HashMap<String,String>();
SQLiteQueryBuilder builder = new SQLiteQueryBuilder();
builder.setTables("place");
Map<String, String> projectionMap = new HashMap<String, String>();
projectionMap.put(Place.COL_NAME, Place.COL_NAME+" AS " + SearchManager.SUGGEST_COLUMN_TEXT_1);
projectionMap.put(Place.COL_ADDRESS, Place.COL_ADDRESS+" AS " + SearchManager.SUGGEST_COLUMN_TEXT_2);
projectionMap.put("_id", "_id" + " AS " + SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID);
projectionMap.put("_id", "_id");
builder.setProjectionMap(projectionMap);
And in the SearchableActivity I use getDataString() or getData() but they return null:
private void handleIntent(Intent intent)
{
if (Intent.ACTION_VIEW.equals(intent.getAction()))
{
Log.w("test",intent.getDataString()+"a");
}
else if (Intent.ACTION_SEARCH.equals(intent.getAction()))
{
...
}
}