title: how to display location message in chat window same like whatsapp in android programmatically?
body: <p>I am developing a chat application. Where user can <strong><em>send location same like whatsapp</em></strong>. (I am not talking about share live location functionality). For this requirement i have use google place picker api. Here I am attaching a code of that.</p>
  
  <p><strong>build.gradle</strong></p>
  
  <pre><code>implementation 'com.google.android.gms:play-services-maps:10.2.0'
  implementation 'com.google.android.gms:play-services:10.2.0'
  </code></pre>
  
  <p><strong>AndroidManifest.xml</strong></p>
  
  <pre><code>&lt;meta-data
      android:name="com.google.android.geo.API_KEY"
      android:value="YOUR_API_KEY" /&gt;
  &lt;meta-data
      android:name="com.google.android.gms.version"
      android:value="@integer/google_play_services_version" /&gt;
  </code></pre>
  
  <p>in java file</p>
  
  <pre><code> PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
              try {
                  dismiss();
                  mActivity.startActivityForResult(builder.build(currentFragment.getActivity()), PLACE_PICKER_REQUEST);
              } catch (GooglePlayServicesRepairableException e) {
                  Log.e(this.getClass().getSimpleName(),"GooglePlayServicesRepairableException");
                  e.printStackTrace();
              } catch (GooglePlayServicesNotAvailableException e) {
                  Log.e(this.getClass().getSimpleName(),"GooglePlayServicesNotAvailableException");
                  e.printStackTrace();
              }
  </code></pre>
  
  <p>And this is how handled onActivityResult method</p>
  
  <pre><code>@Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          if (requestCode == PLACE_PICKER_REQUEST) {
              if (resultCode == RESULT_OK) {
                  Place place = PlacePicker.getPlace(this, data);
              }
          }
      }
  </code></pre>
  
  <p>Now after selecting that location want to display it similar to like this.
  <a href="https://i.stack.imgur.com/E7vlv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/E7vlv.png" alt="enter image description here"></a></p>
  
  <p>So how can I achieve this?</p>