Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- accept.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- customDialog.dismiss();
- Location userClickedLocation = mRealm.createObject(Location.class);
- String address = getAddressFromLngLat(point.getLatitude(), point.getLongitude());
- Latitude lat = point.getLatitude();
- Longitude long = point.getLongitude();
- saveToDb(address, lat, long);
- MarkerOptions markerOptions = new MarkerOptions();
- markerOptions.setPosition(point);
- mapboxMap.addMarker(markerOptions);
- }
- });
- private void saveToDb(String address, lat: Latitude, long: Longitude) {
- new HandlerThread("RealmThread") {
- @Override
- protected void onLooperPrepared() {
- mRealm.beginTransaction();
- Location userClickedLocation = mRealm.createObject(Location.class);
- userClickedLocation.setAddress(address);
- userClickedLocation.setLat(lat);
- userClickedLocation.setLng(long);
- mRealm.commitTransaction();
- }
- }.start();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement