0

I am trying to open map from intent.I want to set marker text in this.can somebody help me in this my code is given below

    @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            String latitude = latiTV.getText().toString();
            String longitude = longiTV.getText().toString();
            String label = addressTV.getText().toString();
            String uriBegin = "geo:" + latitude + "," + longitude;
            String query = latitude + "," + longitude + "(" + label + ")";
            String encodedQuery = Uri.encode(query);
            String uriString = uriBegin + "?q=" + encodedQuery + "&z=10";
            System.out.println(uriString);
            Uri uri = Uri.parse(uriString);
            Intent intent = new Intent(android.content.Intent.ACTION_VIEW, uri);
            startActivity(intent);

        }
Nadeem Yousaf
  • 563
  • 10
  • 31

1 Answers1

0

To open the Google map from Intent you can try this:

    String uri = String.format(Locale.ENGLISH, "geo:%f,%f", 27.175015, 78.042155);
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
    startActivity(intent);

For more detail you can see this link

Community
  • 1
  • 1
Ashish Tiwari
  • 2,168
  • 4
  • 30
  • 54