Skip to content

Instantly share code, notes, and snippets.

View KhaledAlharthi's full-sized avatar
:octocat:
All good

Khaled Alharthi KhaledAlharthi

:octocat:
All good
View GitHub Profile
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
private void openMaps(long lat, long lon){
Uri gmmIntentUri = Uri.parse(String.format(Locale.US, "google.navigation:q=%d,%d", lat, lon));
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
}
/*
* This functions is used to retrieve neighborhood, and regoin from known (lat, lng) coordinates
* the returned pattern: حي قرطبة، الرياض or الرياض if neighborhood is unknown
*
*/
public static String getAddress(Context context, double LATITUDE, double LONGITUDE) {
StringBuilder strAdd = new StringBuilder();
Geocoder geocoder = new Geocoder(context, Locale.forLanguageTag("ar"));
try {