title: Android, Allow user to draw polyline on map
body: <p>Im trying hard to allow user to draw polyline on map when they touch on the map, i dnt know where i went wrong, I think the problem is with onMapTouch method because map displayed normally but when I touch map it says "Unfortunately application has stopped working", what you think, Here is logcat:</p>
  
  <p>17319-17319/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
      Process: com.example.sarahn.myapplication, PID: 17319
      java.lang.IllegalArgumentException: no position in marker options
              at com.google.l.a.ce.a(Unknown Source)
              at com.google.maps.api.android.lib6.d.ft.a(Unknown Source)
              at com.google.android.gms.maps.internal.l.onTransact(SourceFile:167)
              at android.os.Binder.transact(Binder.java:380)
              at com.google.android.gms.maps.internal.IGoogleMapDelegate$zza$zza.addMarker(Unknown Source)
              at com.google.android.gms.maps.GoogleMap.addMarker(Unknown Source)
              at com.example.sarahn.myapplication.MapsActivity.onMapClick(MapsActivity.java:91)
              at com.google.android.gms.maps.GoogleMap$8.onMapClick(Unknown Source)
              at com.google.android.gms.maps.internal.zzj$zza.onTransact(Unknown Source)
              at android.os.Binder.transact(Binder.java:380)
              at com.google.android.gms.maps.internal.ar.a(SourceFile:93)
              at com.google.maps.api.android.lib6.gmm6.c.ac.b(Unknown Source)
              at com.google.maps.api.android.lib6.gmm6.n.bt.d(Unknown Source)
              at com.google.maps.api.android.lib6.gmm6.n.ak.onSingleTapConfirmed(Unknown Source)
              at com.google.maps.api.android.lib6.gmm6.h.g.onSingleTapConfirmed(Unknown Source)
              at com.google.maps.api.android.lib6.gmm6.h.i.handleMessage(Unknown Source)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:211)
              at android.app.ActivityThread.main(ActivityThread.java:5317)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:372)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1016)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)</p>
  
  <pre><code>public class MapsActivity   extends                                                                     FragmentActivit                                                                  implementsGoogleMap.OnMapClickListener{
  
  private GoogleMap mMap;
  ArrayList&lt;LatLng&gt; arrayList;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_maps);
      setUpMapIfNeeded();
      arrayList = new ArrayList&lt;LatLng&gt;();
      SupportMapFragment f =                                               (SupportMapFragmen)                                                                                                                                                                                                                                                                                                         getSupportFragmentManager().findFragmentById(R.id.map);
      mMap= f.getMap();
      mMap.setMyLocationEnabled(true);
      mMap.setOnMapClickListener(this);
      }
  
      @Override
      protected void onResume() {
      super.onResume();
      setUpMapIfNeeded();
      }
  
      public void onMapClick(LatLng latLng) {
  
      MarkerOptions markerOptions = new MarkerOptions();
      markerOptions.position(latLng);
      mMap.addMarker(markerOptions);
      PolylineOptions p = new PolylineOptions();
      p.color(Color.RED);
      p.width(5);
      arrayList.add(latLng);
      p.addAll(arrayList);
      mMap.addPolyline(new PolylineOptions());
      mMap.addMarker(new MarkerOptions());
  
  
  
      }
  </code></pre>