Skip to main content

Google Maps Intents (GoToGoogleMapActivity)


import android.content.Intent; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class GoToGoogleMapActivity extends AppCompatActivity { private Button BtnGoToMap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_go_to_google_map); BtnGoToMap = (Button) findViewById(R.id.BtnGoToMap); BtnGoToMap.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Uri gmmIntentUri = Uri.parse("geo:37.7749,-122.4194"); //_________________________________ // Uri gmmIntentUri = Uri.parse("geo:37.7749,-122.4192?q=" + Uri.encode("1st & Pike, Seattle")); // Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); // mapIntent.setPackage("com.google.android.apps.maps"); // if (mapIntent.resolveActivity(getPackageManager()) != null) { // startActivity(mapIntent); // } //_________________________________ // Creates an Intent that will load a map of San Francisco // Uri gmmIntentUri = Uri.parse("geo:37.7749,-122.4194"); // Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); // mapIntent.setPackage("com.google.android.apps.maps"); // startActivity(mapIntent); //__________________________________ // Search for restaurants nearby // Uri gmmIntentUri = Uri.parse("geo:0,0?q=restaurants"); // Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); // mapIntent.setPackage("com.google.android.apps.maps"); // startActivity(mapIntent); //__________________________________ // Search for restaurants in San Francisco // Uri gmmIntentUri = Uri.parse("geo:37.7749,-122.4194?q=restaurants"); // Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); // mapIntent.setPackage("com.google.android.apps.maps"); // startActivity (mapIntent); //__________________________________ // You can further bias the search results by specifying a zoom parameter along with the query string. // In the below example, adding a zoom of 10 will attempt to find restaurants at a city level instead of nearby. // Uri gmmIntentUri = Uri.parse("geo:37.7749,-122.4194?z=10&q=restaurants"); // Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); // mapIntent.setPackage("com.google.android.apps.maps"); // startActivity(mapIntent); //__________________________________ // Searching for a specific address will display a pin at that location. // Uri gmmIntentUri = Uri.parse("geo:0,0?q=1600 Amphitheatre Parkway, Mountain+View, California"); // Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); // mapIntent.setPackage("com.google.android.apps.maps"); // startActivity(mapIntent); //__________________________________ // The below Intent will request turn-by-turn navigation to Taronga Zoo, in Sydney Australia: // Halar, Shree Nagar Society, Valsad, Gujarat Uri gmmIntentUri = Uri.parse("google.navigation:q=Torrent Traders+Halar,+Valsad+Gujarat"); Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); mapIntent.setPackage("com.google.android.apps.maps"); startActivity(mapIntent); //__________________________________ //__________________________________ //__________________________________ } }); } }

Comments

Popular posts from this blog

Transparent Color Code

Transparent Color Code : Color hexadecimal notation is like the following:  #AARRGGBB A: alpha R: red G: green B: blue ____________________________________________ E.g. for 50% white you'd use             #80FFFFFF.              # ( Transparent  hex value ) (Any Color code) ____________________________________________ Normal opaque black hex- "#000000" Fully transparent - "#00000000" Fully opaque - "#FF000000" 50% transparent - "#80000000" ____________________________________________ Percentages to hex values.  100% — FF 95% — F2 90% — E6 85% — D9 80% — CC 75% — BF 70% — B3 65% — A6 60% — 99 55% — 8C 50% — 80 45% — 73 40% — 66 35% — 59 30% — 4D 25% — 40 20% — 33 15% — 26 10% — 1A 5% — 0D 0% — 00 ____________________________________________ All hex value from 100% to 0% alpha: 100% — FF 99% — FC 98% — FA 97% — F7 96% — F5 95% — F2 94% — F0 93% ...

Android Loading Control

Android Loading Control res/anim/ rotate_anim.xml <?xml version="1.0" encoding="utf-8"?> <animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"     android:drawable="@drawable/img_loading"     android:pivotX="50%"     android:pivotY="50%" /> res/drawable/loading_anim.xml <?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android"     android:oneshot="false" >     <item         android:drawable="@drawable/img1"         android:duration="200"/>     <item         android:drawable="@drawable/img2"         android:duration="200"/>     <item         android:drawable="@drawable/img3"         android:duration="200"/> </animat...

onClick open browser with given URL

onClick  open browser with given  URL Output : // on click its open in browser with url = http://www.google.com Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(" http://www.google.com ")); intent.setComponent(new ComponentName("com.android.browser", "com.android.browser.BrowserActivity")); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getApplicationContext().startActivity(intent);