1

I'm creating an app which obtains users location and location of various of interest. I need to add an intent to send the data of my location and the point's location to a navigation app. How do I achieve this?

Javier Brooklyn
  • 624
  • 3
  • 9
  • 25

1 Answers1

0

Try this code:

 Button map_button = (Button) findViewById(R.id.map_btn);
        map_button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = null, chooser;
                intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse("geo:xx.xxxxxx,xx.xxxxxx"));
                chooser = Intent.createChooser(intent,"Lunch Map");
                try {
                    startActivity(chooser);
                }catch (ActivityNotFoundException e) {
                    e.getCause();
                }

            }
        });

where xx.xxxxxx is your location.

Tushar Lathiya
  • 940
  • 9
  • 26