Open tschlarman opened 5 years ago
This also seems to be caused by setting the PlaceOptionsBuilder.historyCount(). If you set it to more than the number of searches made (kept by the plugin) it crashes. So if you set it to 10, but the user has only made 3 searches it will crash as soon as the search UI is displayed.
If the user has made numerous searches (more than this value anyway) than it works fine. historyCount() seem like a nice way to limit the history results returned and leaving places from InjectedFeatures to fill out the rest up to PlaceOptionsBuilder.limit().
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
I eventually abandoned this plugin and wrote my own.
The following code throws an exception:
PlaceAutocompleteFragment.java:218 for (int x = 0; x < historyCount; x++) { searchHistoryView.getResultsList().add(searchHistoryEntities.get(x).getCarmenFeature()); }
Looks like historyCount = 3, but searchHistoryEntites.size() == 0
Not exactly sure why it got into this state internally, but it's causing the app to crash.
Stack trace: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.get(ArrayList.java:437) at com.mapbox.mapboxsdk.plugins.places.autocomplete.ui.PlaceAutocompleteFragment.updateSearchHistoryView(PlaceAutocompleteFragment.java:218) at com.mapbox.mapboxsdk.plugins.places.autocomplete.ui.PlaceAutocompleteFragment$2.onChanged(PlaceAutocompleteFragment.java:279) at com.mapbox.mapboxsdk.plugins.places.autocomplete.ui.PlaceAutocompleteFragment$2.onChanged(PlaceAutocompleteFragment.java:276) at androidx.lifecycle.LiveData.considerNotify(LiveData.java:113) at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:131) at androidx.lifecycle.LiveData.setValue(LiveData.java:289) at androidx.lifecycle.MutableLiveData.setValue(MutableLiveData.java:33) at androidx.lifecycle.LiveData$1.run(LiveData.java:91) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7319) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:934)