I'm stuck on a problem with mapbox.
The search place doesn't work.
I have tried many things but nothing works.
When i click on the search button, nothing happen, and when i'm searching a place(by tipping in the search bar), nothing happen too, there is no suggestion
The xml:file
<com.mapbox.mapboxsdk.plugins.places.autocomplete.ui.SearchView
android:layout_width="match_parent"
android:background="@drawable/layout_form_text"
android:elevation="3dp"
android:gravity="bottom|left"
android:padding="10dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="19dp"
android:layout_height="wrap_content"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_location_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="16dp"
android:tint="@android:color/white"
app:backgroundTint="@color/colorPrimary"
app:srcCompat="@android:drawable/ic_search_category_default" />
PlacePluginActivity file :
public class PlacesPluginActivity extends AppCompatActivity implements OnMapReadyCallback {
private static final int REQUEST_CODE_AUTOCOMPLETE = 1;
private MapView mapView;
private MapboxMap mapboxMap;
private CarmenFeature home;
private CarmenFeature work;
private String geojsonSourceLayerId = "geojsonSourceLayerId";
private String symbolIconId = "symbolIconId";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mapbox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
Mapbox.getInstance(this, Token);
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_layout_map_priere);
mapView = findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
}
private void initSearchFab() {
findViewById(R.id.fab_location_search).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new PlaceAutocomplete.IntentBuilder()
.accessToken("pk.eyJ1IjoibWVoZGluIiwiYSI6ImNrYTRobzR4YTB1MnAzbG9nMGljejBpb2UifQ.nG3vtoddC1TCHW3Skpkttg")
.placeOptions(PlaceOptions.builder().build())
.build(PlacesPluginActivity.this);
startActivityForResult(intent, REQUEST_CODE_AUTOCOMPLETE);
}
});
}
}
I don't know why it's not working, I can't find the problem here