Android Stack Nullpointer On Selecting A Suggestion In Search Widget
I am using search widget as auto completed in my home screen. Auto Complete functionally is working fine but when I select any suggestion app is crashing with weird NullPointerExce
Solution 1:
First, the SearchView's code on your code is not that of your test device's version so the line number does not match. It should occur in launchSuggestion()
method as the log says, not the createIntent()
you posted.
The problem is not in the android's framework code, it crashed while processing the suggestion list provided, likely to met null
data in the list.
From your code, following part is making suggestion list:
// Set the auto suggestionsArrayList<String> list = newArrayList<String>(Arrays.asList(suggestionList));
AutoSuggestionAdapter autoSuggestionAdapter = newAutoSuggestionAdapter(this,
R.layout.autosuggestion_layout, list);
In here, the adapter grabs data from suggestionList
, but if one of its element is null
it can lead to NullPointerException
.
I don't know what is in suggestionList
, but can be sure that it is caused by a null in it.
Post a Comment for "Android Stack Nullpointer On Selecting A Suggestion In Search Widget"